Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→
Page 1 .. 313 314 315 316 317 318 319 320 321 322 323 .. 5022
502,152 events total
2020-09-30 02:15:41 Shun131 joins (sid377723@gateway/web/irccloud.com/x-qfflzmcznnjkrwrn)
2020-09-30 02:15:42 zopsi joins (zopsi@2600:3c00::f03c:91ff:fe14:551f)
2020-09-30 02:15:47 auri_ joins (~auri_@fsf/memeber/auri-)
2020-09-30 02:15:47 Aquazi joins (uid312403@gateway/web/irccloud.com/x-qegeokaunvltnjjt)
2020-09-30 02:15:49 PotatoGim joins (sid99505@gateway/web/irccloud.com/x-nntthzpvnqfcnxqs)
2020-09-30 02:16:02 × filwisher quits (~filwisher@cpc76738-dals23-2-0-cust186.20-2.cable.virginm.net) (Ping timeout: 260 seconds)
2020-09-30 02:16:06 <Axman6> halogenandtoast: xs ?^ each . _BaseSkillOf
2020-09-30 02:16:08 unclechu joins (unclechuma@gateway/shell/matrix.org/x-bgindqyxdmllwdai)
2020-09-30 02:16:29 PotatoHatsue joins (berbermanp@gateway/shell/matrix.org/x-lcuapfbpkatzswxh)
2020-09-30 02:16:34 <dolio> Yeah, if you have some better building blocks it will help.
2020-09-30 02:16:54 polyrain_ joins (~polyrain@2001:8003:e501:6901:4af:ac65:fda8:8e33)
2020-09-30 02:16:57 jabruen[m] joins (jabruenmat@gateway/shell/matrix.org/x-akmaydnltwuauerf)
2020-09-30 02:17:20 × mirrorbird quits (~psutcliff@2a00:801:3fb:53b9:b09b:cd4e:4e4a:44a9) (Quit: Leaving)
2020-09-30 02:17:30 <halogenandtoast> Axman6: where is that lens coming from :p
2020-09-30 02:17:36 <halogenandtoast> I surely did not write it
2020-09-30 02:17:37 × thecoffemaker quits (~thecoffem@unaffiliated/thecoffemaker) (Ping timeout: 264 seconds)
2020-09-30 02:18:21 jkaye[m] joins (jkayematri@gateway/shell/matrix.org/x-xibdbttwtjjbthkv)
2020-09-30 02:18:24 <vivekramaswamy> Hello All, I came here as there is no one in the haskell beginners channel, i really have a simple question. the type constructor for a list is defined as data [] a = [] | a
2020-09-30 02:18:40 × rzmt quits (~rzmt@87-92-180-112.rev.dnainternet.fi) (Ping timeout: 246 seconds)
2020-09-30 02:18:44 themsay[m] joins (themsaymat@gateway/shell/matrix.org/x-yeakmiacdwmqfqaq)
2020-09-30 02:19:18 <vivekramaswamy> Hello All, I came here as there is no one in the haskell beginners channel, i really have a simple question. the type constructor for a list is defined as data [] a = [] | a:[a] how can I construct a list with a single element using these data constructor for the list
2020-09-30 02:19:22 <ski> there are people in there. however, there was just a netsplit, so perhaps that's why it didn't seem like way
2020-09-30 02:19:32 <glguy> vivekramaswamy: this channel is fine for beginner questions
2020-09-30 02:19:46 × polyrain quits (~polyrain@2001:8003:e501:6901:3476:44e3:8b50:e5ca) (Ping timeout: 244 seconds)
2020-09-30 02:19:48 <ski> add an element to the empty list
2020-09-30 02:19:51 <halogenandtoast> vivekramaswamy: a:[] ?
2020-09-30 02:19:52 rzmt joins (~rzmt@87-92-180-112.rev.dnainternet.fi)
2020-09-30 02:20:11 hyiltiz-M joins (hyiltizkde@gateway/shell/kde/matrix/session)
2020-09-30 02:20:11 joshmeredith joins (sid387798@gateway/web/irccloud.com/x-lhhtwrcyukiolswv)
2020-09-30 02:20:11 jchia_ joins (~jchia@58.32.37.220)
2020-09-30 02:20:11 ezzieyguywuf joins (~Unknown@unaffiliated/ezzieyguywuf)
2020-09-30 02:20:11 pong joins (chiya@2406:3003:2077:2341::babe)
2020-09-30 02:20:11 coeus joins (~coeus@p200300d02724ef00d20f0ecf5ac74df4.dip0.t-ipconnect.de)
2020-09-30 02:20:11 magog joins (~wee@unaffiliated/magog)
2020-09-30 02:20:11 Taneb joins (~Taneb@2001:41c8:51:10d:aaaa:0:aaaa:0)
2020-09-30 02:20:11 nopf joins (~frosch@static.179.17.76.144.clients.your-server.de)
2020-09-30 02:20:11 M2tias joins (m2@seri.fi)
2020-09-30 02:20:12 × hyiltiz-M quits (hyiltizkde@gateway/shell/kde/matrix/session) (Changing host)
2020-09-30 02:20:12 hyiltiz-M joins (hyiltizkde@gateway/shell/kde/matrix/x-gsazjbgdfcbtdfre)
2020-09-30 02:20:18 <vivekramaswamy> yeah but we dont have a data constructor like a:[]
2020-09-30 02:20:25 BalterNotz joins (ca420871@202.66.8.113)
2020-09-30 02:20:36 <ski> so use multiple data constructors, when making a singleton list
2020-09-30 02:20:56 <halogenandtoast> vivekramaswamy: you are misreading how that constructor is working there. It's recursive (if implemented correctly)
2020-09-30 02:21:03 <glguy> vivekramaswamy: (:) and [] are the two data constructors for list
2020-09-30 02:21:08 <vivekramaswamy> But this is a sum type, I can only use one of the constructors right
2020-09-30 02:21:22 <ski> `[]' is the empty list. if `x' is an element, and `xs' is a list, then `x:xs' is the list that starts with the element `x', and continues with all the elements (possibly zero of them) in the list `xs'
2020-09-30 02:21:41 <ski> why would you think that, vivekramaswamy ?
2020-09-30 02:21:43 thecoffemaker joins (~thecoffem@unaffiliated/thecoffemaker)
2020-09-30 02:22:10 <halogenandtoast> vivekramaswamy: you are using one of the constructors, the constructor on the right just happens to be recursive.
2020-09-30 02:22:43 <vivekramaswamy> where I am getting confused is this is a:[] == a:[a]
2020-09-30 02:22:52 <halogenandtoast> One is a value, one is a type
2020-09-30 02:23:03 <halogenandtoast> *data constructor
2020-09-30 02:23:27 <ski> vivekramaswamy : `a:[a]' in `data [a] = [] | a:[a]' is a "template". it means that if you have `x' of type `a', and `xs' of type `[a]', then `x:xs' has type `[a]'
2020-09-30 02:23:49 toorevitimirp joins (~tooreviti@117.182.182.201)
2020-09-30 02:24:06 <ski> in place of actual values (left and right operand to the infix operator `:'), you have the expected types of those operands, in the `data' type declaration
2020-09-30 02:24:16 <vivekramaswamy> to construct a list with a single element I will have to use one of the data constructors right. I can't use [], also the second constructors presumes a value already in the list a:[]
2020-09-30 02:24:24 <ski> when actually using the data constructors, you'd use actual values of those two types
2020-09-30 02:24:40 lagothrix is now known as Guest22008
2020-09-30 02:24:40 × Guest22008 quits (~lagothrix@unaffiliated/lagothrix) (Killed (moon.freenode.net (Nickname regained by services)))
2020-09-30 02:24:48 <ski> vivekramaswamy : the second one adds an element in front of an existing list
2020-09-30 02:24:49 lagothrix joins (~lagothrix@unaffiliated/lagothrix)
2020-09-30 02:25:20 snakemasterflex joins (~snakemast@213.100.206.23)
2020-09-30 02:26:16 <vivekramaswamy> correct , an already existing list a:[a], but for a list with only one element it will cons to a:[] adding element to the empty list, where is that covered in the data constructors
2020-09-30 02:26:18 <halogenandtoast> vivekramaswamy: you have to start with the premise that you are reading those constructors incorrectly which is why you don't see the solution yet.
2020-09-30 02:26:19 <glguy> vivekramaswamy: Would it be less confusing if we used this definition:
2020-09-30 02:26:20 <glguy> % data List a = Empty | Prepend a (List a)
2020-09-30 02:26:25 <yahb> glguy:
2020-09-30 02:27:01 <glguy> That's the same thing with different names avoiding symbols and ambiguity between the type and value levels
2020-09-30 02:27:01 <ski> % deriving instance Show a => Show (List a)
2020-09-30 02:27:04 <yahb> ski:
2020-09-30 02:27:26 × drbean quits (~drbean@TC210-63-209-160.static.apol.com.tw) (Ping timeout: 244 seconds)
2020-09-30 02:28:07 SolarAquarion joins (SolarAquar@gateway/shell/panicbnc/x-nikabmyijjgiqeue)
2020-09-30 02:28:08 × polyrain_ quits (~polyrain@2001:8003:e501:6901:4af:ac65:fda8:8e33) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2020-09-30 02:28:15 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 272 seconds)
2020-09-30 02:28:45 <Axman6> vivekramaswamy: the way that list is defined is quitre confusing to beginners, a better definition using GADT syntax is: data [] a where [] :: [a]; (:) :: a -> [a] -> [a] -- a list is EITHER: an empty list [] which has type [a] OR a (:) (pronounced "cons") with has a value of type a and a value of type [a]
2020-09-30 02:28:49 <glguy> % Prepend "singleton" Empty
2020-09-30 02:28:50 <yahb> glguy: Prepend "singleton" Empty
2020-09-30 02:29:25 <Axman6> :t (:)
2020-09-30 02:29:26 <lambdabot> a -> [a] -> [a]
2020-09-30 02:29:29 <halogenandtoast> Axman6: beginners and GADT in the same sentence, what world is this?
2020-09-30 02:29:42 <ski> that declaration means that `Empty' has type `List a' (for any type `a'); and also that `Prepend x xs' has type `List a' (for any type `a'), provided that `x' has (that) type `a', and `xs' has type `List a'
2020-09-30 02:29:55 <ski> halogenandtoast : `GADTSyntax', not `GADT'
2020-09-30 02:30:12 <Axman6> halogenandtoast: GDTS syntax is oftewn much easier for beginners to understand, as it;s much more consistent than the normal sum type syntax, which mixes constructors and the types they hold
2020-09-30 02:30:18 × snakemasterflex quits (~snakemast@213.100.206.23) (Ping timeout: 260 seconds)
2020-09-30 02:30:26 o1lo01ol_ joins (~o1lo01ol1@bl8-213-81.dsl.telepac.pt)
2020-09-30 02:30:31 <ski> vivekramaswamy : is glguy's alternative list type definition making any more sense to you, atm ?
2020-09-30 02:31:12 <Axman6> > 1 : []
2020-09-30 02:31:15 <lambdabot> [1]
2020-09-30 02:31:18 × o1lo01ol1o quits (~o1lo01ol1@bl8-213-81.dsl.telepac.pt) (Read error: Connection reset by peer)
2020-09-30 02:31:19 <Axman6> > (:) 1 []
2020-09-30 02:31:20 polyrain joins (~polyrain@2001:8003:e501:6901:4af:ac65:fda8:8e33)
2020-09-30 02:31:21 <lambdabot> [1]
2020-09-30 02:31:36 <vivekramaswamy> Thank you very much for the help, but I am still very confused about this. Let me re -read all the messages again and try and make sense of them
2020-09-30 02:31:50 <Axman6> :t []
2020-09-30 02:31:51 <lambdabot> [a]
2020-09-30 02:31:53 <Axman6> : (:)
2020-09-30 02:31:57 <Axman6> :t (:)
2020-09-30 02:31:58 <lambdabot> a -> [a] -> [a]
2020-09-30 02:32:56 <vivekramaswamy> I get this 1:[], but where is this one covered in the 2 data constructors defines [] | a:[a]
2020-09-30 02:33:10 <ski> vivekramaswamy : it uses both of the data constructors

All times are in UTC.