Home freenode/#haskell: Logs Calendar

Logs: freenode/#haskell

←Prev  Next→ 502,152 events total
2021-04-14 16:26:13 × wroathe quits (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) (Ping timeout: 240 seconds)
2021-04-14 16:26:45 romesrf joins (~romesrf@44.190.189.46.rev.vodafone.pt)
2021-04-14 16:27:36 × ukari quits (~ukari@unaffiliated/ukari) (Remote host closed the connection)
2021-04-14 16:27:54 × dariof4 quits (~dario@5.11.121.66) (Ping timeout: 252 seconds)
2021-04-14 16:28:20 ukari joins (~ukari@unaffiliated/ukari)
2021-04-14 16:28:59 wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net)
2021-04-14 16:29:27 <romesrf> good afternoon, could someone help me understand Parsec's use of reserved and reservedOp in this small "if" example? https://paste.tomsmeding.com/MZMIiZEW
2021-04-14 16:30:29 <romesrf> i don't understand 1) why use reserved at all, 2) why use reservedOp to parse "then" unlike "if" and "else"
2021-04-14 16:31:41 dmytrish joins (~mitra@2a02:8084:a82:d900:f811:9873:2623:c28b)
2021-04-14 16:32:01 enikar thinks… because then is like an operator between two expressions.
2021-04-14 16:32:16 <enikar> but I'm not sure.
2021-04-14 16:32:33 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 240 seconds)
2021-04-14 16:33:14 <__monty__> romesrf: Because you might want to include rules like "not in reservedWords" for your regular identifier parser.
2021-04-14 16:33:54 <__monty__> I'm not sure about the Op-ness, since surely else looks pretty darn similar?
2021-04-14 16:36:19 <romesrf> my understanding is that `reservedOp name` will fail if name is a prefix to a reserved operation, and `reserved name` will fail if name is a prefix to a reserved name ... :(
2021-04-14 16:36:37 nineonine joins (~nineonine@50.216.62.2)
2021-04-14 16:37:18 <romesrf> all examples i've seen use reserved and reservedOp when defining the parser, but i can't quite understand *why*
2021-04-14 16:38:16 kiweun joins (~kiweun@2607:fea8:2a62:9600:4003:210e:21b8:f2c0)
2021-04-14 16:38:36 × gawen quits (~gawen@movzbl.root.sx) (Quit: cya)
2021-04-14 16:39:35 MrMobius joins (~MrMobius@208.58.206.154)
2021-04-14 16:40:16 justsomeguy joins (~justsomeg@unaffiliated/--/x-3805311)
2021-04-14 16:40:55 gawen joins (~gawen@movzbl.root.sx)
2021-04-14 16:42:59 × kiweun quits (~kiweun@2607:fea8:2a62:9600:4003:210e:21b8:f2c0) (Ping timeout: 258 seconds)
2021-04-14 16:43:26 × ukari quits (~ukari@unaffiliated/ukari) (Remote host closed the connection)
2021-04-14 16:44:05 ukari joins (~ukari@unaffiliated/ukari)
2021-04-14 16:47:24 merijn joins (~merijn@83-160-49-249.ip.xs4all.nl)
2021-04-14 16:48:31 × jamm_ quits (~jamm@unaffiliated/jamm) (Remote host closed the connection)
2021-04-14 16:51:55 × nbloomf quits (~nbloomf@2600:1700:ad14:3020:49a9:cf03:7849:ab6b) (Quit: My MacBook has gone to sleep. ZZZzzz…)
2021-04-14 16:52:13 fendor_ joins (~fendor@77.119.129.135.wireless.dyn.drei.com)
2021-04-14 16:52:49 × merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 268 seconds)
2021-04-14 16:52:59 nbloomf joins (~nbloomf@2600:1700:ad14:3020:b54d:c232:d06e:243a)
2021-04-14 16:53:01 × zaquest quits (~notzaques@5.128.210.178) (Read error: Connection reset by peer)
2021-04-14 16:53:13 <monochrom> reserved eats trailing whitespaces for you.
2021-04-14 16:53:36 <monochrom> But I would use reserved "then", not reservedOp "then".
2021-04-14 16:54:19 <monochrom> reservedOp is really for reserved symbols/punctuations, for example semicolon, not alphanum things.
2021-04-14 16:54:55 × fendor quits (~fendor@91.141.2.26.wireless.dyn.drei.com) (Ping timeout: 265 seconds)
2021-04-14 16:56:14 × hexfive quits (~hexfive@50.35.83.177) (Quit: i must go. my people need me.)
2021-04-14 16:56:26 <romesrf> thank you :)
2021-04-14 16:56:57 <monochrom> https://wiki.haskell.org/Parsing_expressions_and_statements is my better example.
2021-04-14 16:57:19 <romesrf> great, i'll check it out
2021-04-14 16:57:35 seven_three joins (~user@pool-96-233-64-53.bstnma.fios.verizon.net)
2021-04-14 16:57:54 × heatsink quits (~heatsink@108-201-191-115.lightspeed.sntcca.sbcglobal.net) (Remote host closed the connection)
2021-04-14 16:58:45 × rj quits (~x@gateway/tor-sasl/rj) (Ping timeout: 240 seconds)
2021-04-14 17:00:08 × rajivr quits (uid269651@gateway/web/irccloud.com/x-ubwtsitjrarbotro) (Quit: Connection closed for inactivity)
2021-04-14 17:00:24 seven_three parts (~user@pool-96-233-64-53.bstnma.fios.verizon.net) ()
2021-04-14 17:01:20 <monochrom> I have taken a look at the source code of reservedOp. Here is what's wrong with reservedOp "then".
2021-04-14 17:01:34 <romesrf> monochrom: +1 it helped, different wordings and different examples are good for understanding better :) ty
2021-04-14 17:01:52 <monochrom> Suppose your grammar allows "then ;", in which "then" is a reserved word, ";" is a reserved symbol. Two tokens, not one.
2021-04-14 17:01:55 × rmk236 quits (~lcampos@2a02:908:3616:b100:32db:6142:a17f:785a) (Quit: Leaving.)
2021-04-14 17:02:17 <romesrf> yes
2021-04-14 17:02:44 <monochrom> Err I need the grammar to allow "then;" too, no space between them, but still two tokens as said.
2021-04-14 17:03:00 rj joins (~x@gateway/tor-sasl/rj)
2021-04-14 17:03:15 <monochrom> reservedOp "then" >> reservedOp ";" will fail to do that.
2021-04-14 17:03:51 <romesrf> understood! but reserved "then" >> reservedOp ";" would work, right?
2021-04-14 17:04:07 <monochrom> This is because reservedOp "then" goes: string "then" >> notFollowedBy opLetter. (And supposed ';' satisfies opLetter)
2021-04-14 17:04:12 <monochrom> Yes.
2021-04-14 17:05:16 <monochrom> So the dichotomy is not "not infix vs infix", it is "alphanum vs symbols"
2021-04-14 17:05:30 <monochrom> I am OK with "alphanum vs line noise" too. >:)
2021-04-14 17:06:12 <romesrf> pretty cool, thank you
2021-04-14 17:06:24 <geekosaur> unless writing an APL parser :p
2021-04-14 17:06:40 <geekosaur> or J
2021-04-14 17:07:13 Guest_54 joins (c4bf35f2@196.191.53.242)
2021-04-14 17:07:31 <monochrom> There is also K.
2021-04-14 17:07:41 <monochrom> Or is there? I forgot.
2021-04-14 17:07:47 × aweinstock quits (~aweinstoc@cpe-67-248-65-250.nycap.res.rr.com) (Ping timeout: 250 seconds)
2021-04-14 17:07:51 <geekosaur> there is
2021-04-14 17:07:54 zyeri- joins (zyeri@gateway/shell/tilde.team/x-kkkevpuavtvflcri)
2021-04-14 17:07:56 <geekosaur> but nobody talks about it
2021-04-14 17:07:59 <monochrom> But I really love to say "C/C++ and J/Java/Javascript" >:)
2021-04-14 17:08:07 duckonomy_ joins (~duckonomy@177.ip-144-217-84.net)
2021-04-14 17:08:13 × zyeri quits (zyeri@tilde.team/users/zyeri) (Ping timeout: 250 seconds)
2021-04-14 17:08:13 × duckonomy quits (~duckonomy@177.ip-144-217-84.net) (Ping timeout: 250 seconds)
2021-04-14 17:08:13 enikar . o O ( too weird languages )
2021-04-14 17:08:56 × Major_Biscuit quits (~Major_Bis@82-169-100-198.biz.kpn.net) (Quit: WeeChat 3.0.1)
2021-04-14 17:08:57 aweinstock joins (~aweinstoc@cpe-67-248-65-250.nycap.res.rr.com)
2021-04-14 17:09:19 zaquest joins (~notzaques@5.128.210.178)
2021-04-14 17:09:35 <ski> @where C/C++
2021-04-14 17:09:36 <lambdabot> "C/C++ : A new language for the new Millennium" by Richard Heathfield in 2005-02 at <http://web.archive.org/web/20090421080714/http://www.cpax.org.uk/prg/portable/c/c++/rfe00000.html>
2021-04-14 17:09:37 <geekosaur> and J is made worse by Microsoft attempting a J# at one point to embrace-and-extend Java (iirc)
2021-04-14 17:10:21 <monochrom> Wait, how does that make J worse, not make Java worse?
2021-04-14 17:10:46 <koala_man> haha
2021-04-14 17:11:37 <monochrom> Sorry but I'm like "I hit your head and the pain goes to your classmate" or something.
2021-04-14 17:11:38 <geekosaur> C, C++, and C# are at least somewhat (granted, not very) related, J and J# have nothing to do with each other
2021-04-14 17:11:45 × haskellstudent quits (~quassel@213-225-6-101.nat.highway.a1.net) (Ping timeout: 260 seconds)
2021-04-14 17:11:53 <monochrom> Ah
2021-04-14 17:12:08 <geekosaur> at least with F# there's no F that I'm aware of to cause any confusion there
2021-04-14 17:12:32 ski . o O ( "Challenge accepted" ? )
2021-04-14 17:12:51 <geekosaur> probably
2021-04-14 17:12:57 <monochrom> They should have named it H#. Bad press for us is better than no press. Well, at least was, back then.
2021-04-14 17:12:57 kritzefitz joins (~kritzefit@212.86.56.80)
2021-04-14 17:15:52 <koala_man> looks like F was a Fortran inspired language from 1996/1997
2021-04-14 17:16:45 haskellstudent joins (~quassel@213-225-6-101.nat.highway.a1.net)
2021-04-14 17:16:55 <dolio> It's more like ML.
2021-04-14 17:17:01 <dolio> ML#
2021-04-14 17:17:19 <dolio> I guess it has objects, too, so O#.
2021-04-14 17:17:27 idhugo_ joins (~idhugo@87-49-147-45-mobile.dk.customer.tdc.net)
2021-04-14 17:18:15 <enikar> in fact F# is a kind of ocaml#
2021-04-14 17:18:20 <monochrom> Anyone want to name your language E# to be retrospectively hurt by F#? >:)
2021-04-14 17:18:45 <monochrom> Or B# too >:)
2021-04-14 17:24:46 × ram19890 quits (~ram@49.207.130.109) (Ping timeout: 252 seconds)

All times are in UTC.