Logs: liberachat/#haskell
| 2021-06-16 23:25:54 | → | benin036 joins (~benin@183.82.207.180) |
| 2021-06-16 23:27:20 | → | eggplantade joins (~Eggplanta@2600:1700:bef1:5e10:cded:c7cb:4d63:a64a) |
| 2021-06-16 23:27:28 | × | dhil quits (~dhil@80.208.56.181) (Ping timeout: 268 seconds) |
| 2021-06-16 23:28:13 | → | fizbin joins (~fizbin@c-68-83-100-68.hsd1.nj.comcast.net) |
| 2021-06-16 23:29:46 | → | Axman6 joins (~Axman6@user/axman6) |
| 2021-06-16 23:29:58 | × | spirgel quits (spirgel@gateway/vpn/protonvpn/spirgel) (Ping timeout: 244 seconds) |
| 2021-06-16 23:34:37 | → | henninb joins (~user@63.226.174.157) |
| 2021-06-16 23:35:25 | × | henninb quits (~user@63.226.174.157) (Remote host closed the connection) |
| 2021-06-16 23:38:28 | → | fendor_ joins (~fendor@77.119.131.250.wireless.dyn.drei.com) |
| 2021-06-16 23:39:33 | × | trent1 quits (~trent@2001:8003:340d:d00:b2de:b98:7a93:b0ea) (Quit: WeeChat 3.1) |
| 2021-06-16 23:40:25 | → | ddellacosta joins (~ddellacos@86.106.121.100) |
| 2021-06-16 23:40:42 | × | fendor quits (~fendor@178.165.130.116.wireless.dyn.drei.com) (Ping timeout: 240 seconds) |
| 2021-06-16 23:41:53 | → | ecameron[m] joins (~ecameronm@2001:470:69fc:105::35df) |
| 2021-06-16 23:42:42 | × | sbmsr quits (~pi@104-6-130-18.lightspeed.miamfl.sbcglobal.net) (Ping timeout: 240 seconds) |
| 2021-06-16 23:45:21 | × | ddellacosta quits (~ddellacos@86.106.121.100) (Ping timeout: 268 seconds) |
| 2021-06-16 23:45:57 | <ecameron[m]> | Hey, not sure if this is the currently most active haskell channel but I'm having some issues with writing a simple parser using Text.ParserCombinators.ReadP. I'm just experimenting to see if I've got the concepts down. I belive there is something wrong with my `add` and `mul` parsers but I don't know what, https://paste.tomsmeding.com/hfFJmTiY |
| 2021-06-16 23:46:54 | <monochrom> | Did you run into an error message? Did you run into unexpected behaviour? |
| 2021-06-16 23:48:04 | <Axman6> | you have char '(' twice |
| 2021-06-16 23:48:09 | <ecameron[m]> | It just returns `Nothing` on the input, even just running `runParser expr "add 1 2"` returns nothing |
| 2021-06-16 23:48:12 | <Axman6> | probably want char ')' |
| 2021-06-16 23:48:28 | <monochrom> | Uh why is mul doing string "add" and Add, add doing string "mult" and Mult? :) |
| 2021-06-16 23:48:29 | <Axman6> | (that isn't your problem, but it is a problem :) |
| 2021-06-16 23:49:15 | <Axman6> | what in the parser is handling the spaces after the string "add" or "mult"? |
| 2021-06-16 23:49:47 | <ecameron[m]> | Ah, maybe I need a `skipSpaces` after that too |
| 2021-06-16 23:50:22 | <Axman6> | IS there a IsString instance for ReadP? writing "(" *> expr <* ")" might make picking up these small errors a bit easier |
| 2021-06-16 23:50:33 | <Axman6> | but for now, get this style working |
| 2021-06-16 23:51:03 | <Axman6> | much1, on nom nom |
| 2021-06-16 23:53:07 | <Axman6> | @hoogle ReadP |
| 2021-06-16 23:53:08 | <lambdabot> | module Text.ParserCombinators.ReadP |
| 2021-06-16 23:53:08 | <lambdabot> | Text.ParserCombinators.ReadP data ReadP a |
| 2021-06-16 23:53:08 | <lambdabot> | BasePrelude data ReadP a |
| 2021-06-16 23:54:25 | → | spirgel joins (spirgel@gateway/vpn/protonvpn/spirgel) |
| 2021-06-16 23:54:25 | <ecameron[m]> | adding `skipSpaces` doesn't change the output (`runParser expr "add 1 2"` still returns `Nothing`) but I do feel like it's getting closer to what the issue is |
| 2021-06-16 23:55:47 | <Axman6> | try building it up from parts - waht does runParser (string "add") "add 1 2" return? then runParser (do {string "add"; skipSpaces}) "add 1 2" etc. |
| 2021-06-16 23:55:53 | <Axman6> | in ghci |
| 2021-06-16 23:57:04 | <Axman6> | looks like there's several places where spaces aren't being handled |
| 2021-06-16 23:57:50 | × | jmcarthur quits (~jmcarthur@c-73-29-224-10.hsd1.nj.comcast.net) (Quit: My MacBook Air has gone to sleep. ZZZzzz…) |
| 2021-06-16 23:58:54 | × | spirgel quits (spirgel@gateway/vpn/protonvpn/spirgel) (Ping timeout: 244 seconds) |
| 2021-06-16 23:59:50 | <Axman6> | maybe come up with a rule for where spaces should be handled; every bit of syntax which is specific to a parser should handle its own spaces, so always parse the spaces after you use `string` but if you call another parser it is responsible for any spaces that follow it |
| 2021-06-17 00:00:47 | → | warnz joins (~warnz@2600:1700:77c0:5610:7144:467c:eae6:37e7) |
| 2021-06-17 00:01:06 | <ecameron[m]> | Ah, got it. It was the spaces, thanks |
| 2021-06-17 00:01:37 | <Axman6> | this is the main reason people pretty quickly implement lexers |
| 2021-06-17 00:03:33 | <ecameron[m]> | applicative/monadic parsers still look like magic, just in the type of syntax they provide. I whenever I see a type like `String -> [(a, String)]` in a type I always wonder how you would think to do that and know that it's applicative implementation is going to be helpful |
| 2021-06-17 00:04:03 | <ecameron[m]> | But I guess it's just familiarity with that style of coding? |
| 2021-06-17 00:04:31 | <geekosaur> | familiarity counts for a lot, yes |
| 2021-06-17 00:05:06 | × | warnz quits (~warnz@2600:1700:77c0:5610:7144:467c:eae6:37e7) (Ping timeout: 240 seconds) |
| 2021-06-17 00:05:09 | <Axman6> | yeah, it takes a while but you will soon see a lot of parsers are actually just Applicative; it's not huntil you need to do things like "parse a length N, and then parse N things" you don't actually need Monad |
| 2021-06-17 00:06:15 | <Axman6> | like your mult parser could be: mult = Mult <$> string "mul" *> skipSpaces *> expr <*> expr (I think) |
| 2021-06-17 00:06:58 | <ecameron[m]> | sure, or use ApplicativeDo extension |
| 2021-06-17 00:07:16 | <Axman6> | why bother with the extra noise though? |
| 2021-06-17 00:07:42 | <ecameron[m]> | the do syntax is easier to read than the applicative style to my eyes |
| 2021-06-17 00:09:15 | <Axman6> | if laid out better than IRC allows, the applicative version often reads just as clearly, without the pain of having to name arguments |
| 2021-06-17 00:10:35 | → | spirgel joins (spirgel@gateway/vpn/protonvpn/spirgel) |
| 2021-06-17 00:12:10 | <geekosaur> | I also find do syntax easier to read, but I trust ApplicativeDo about as far as I can throw it, so. |
| 2021-06-17 00:12:42 | → | merijn joins (~merijn@83-160-49-249.ip.xs4all.nl) |
| 2021-06-17 00:13:53 | × | waleee quits (~waleee@2001:9b0:216:8200:d457:9189:7843:1dbd) (Ping timeout: 244 seconds) |
| 2021-06-17 00:15:33 | → | sbmsr joins (~pi@2600:1700:63d0:4830:7dbf:92d8:fd42:235d) |
| 2021-06-17 00:15:34 | × | spirgel quits (spirgel@gateway/vpn/protonvpn/spirgel) (Ping timeout: 268 seconds) |
| 2021-06-17 00:15:55 | → | waleee joins (~waleee@h-98-128-228-119.NA.cust.bahnhof.se) |
| 2021-06-17 00:16:24 | → | ddellacosta joins (~ddellacos@86.106.121.100) |
| 2021-06-17 00:16:50 | × | chisui quits (~chisui@200116b866aa810011dbc50701903cdb.dip.versatel-1u1.de) (Ping timeout: 250 seconds) |
| 2021-06-17 00:17:20 | → | gvx joins (~david@softbank126019120204.bbtec.net) |
| 2021-06-17 00:17:20 | gvx | is now known as dajoer |
| 2021-06-17 00:17:26 | × | haskl quits (~haskeller@2601:643:897f:561d:d8b7:bfb4:b64d:4a57) (Ping timeout: 252 seconds) |
| 2021-06-17 00:20:36 | × | BosonCollider quits (~olofs@90-227-86-119-no542.tbcn.telia.com) (Ping timeout: 244 seconds) |
| 2021-06-17 00:21:14 | × | ddellacosta quits (~ddellacos@86.106.121.100) (Ping timeout: 268 seconds) |
| 2021-06-17 00:24:20 | × | hegstal quits (~hegstal@2a02:c7f:7604:8a00:a0e9:5ac8:9436:b228) (Remote host closed the connection) |
| 2021-06-17 00:25:08 | → | BosonCollider joins (~olofs@90-227-86-119-no542.tbcn.telia.com) |
| 2021-06-17 00:25:27 | <Axman6> | There are definitely times when monadic style helps, but for small functions applicative style can help a lot: parens = "(" *> expr <* skipSpaces <* ")" is pretty clean |
| 2021-06-17 00:26:06 | → | werneta_ joins (~werneta@70-142-214-115.lightspeed.irvnca.sbcglobal.net) |
| 2021-06-17 00:29:11 | → | spirgel joins (spirgel@gateway/vpn/protonvpn/spirgel) |
| 2021-06-17 00:29:19 | × | slice quits (~slice@user/slice) (Quit: zzz) |
| 2021-06-17 00:30:11 | × | awth13 quits (~user@user/awth13) (Read error: Connection reset by peer) |
| 2021-06-17 00:30:23 | × | pretty_dumm_guy quits (trottel@gateway/vpn/protonvpn/prettydummguy/x-88029655) (Quit: WeeChat 3.3-dev) |
| 2021-06-17 00:30:58 | → | awth13 joins (~user@user/awth13) |
| 2021-06-17 00:30:59 | → | slice joins (~slice@user/slice) |
| 2021-06-17 00:32:50 | × | bontaq` quits (~user@ool-18e47f8d.dyn.optonline.net) (Ping timeout: 268 seconds) |
| 2021-06-17 00:33:22 | → | pfurla_ joins (~pfurla@216.131.82.53) |
| 2021-06-17 00:33:27 | × | jolly quits (~jolly@208.180.97.158) (Ping timeout: 268 seconds) |
| 2021-06-17 00:33:31 | → | hmmmas joins (~chenqisu1@183.217.200.246) |
| 2021-06-17 00:34:04 | × | spirgel quits (spirgel@gateway/vpn/protonvpn/spirgel) (Ping timeout: 268 seconds) |
| 2021-06-17 00:34:28 | → | dsf joins (~dsf@cpe-66-75-56-205.san.res.rr.com) |
| 2021-06-17 00:36:41 | × | pfurla quits (~pfurla@ool-182ed2e2.dyn.optonline.net) (Ping timeout: 252 seconds) |
| 2021-06-17 00:38:03 | × | hmmmas quits (~chenqisu1@183.217.200.246) (Client Quit) |
| 2021-06-17 00:38:39 | → | yd502 joins (~yd502@180.168.212.6) |
| 2021-06-17 00:40:43 | × | slice quits (~slice@user/slice) (Quit: zzz) |
| 2021-06-17 00:46:34 | → | spirgel joins (spirgel@gateway/vpn/protonvpn/spirgel) |
| 2021-06-17 00:46:49 | × | merijn quits (~merijn@83-160-49-249.ip.xs4all.nl) (Ping timeout: 272 seconds) |
| 2021-06-17 00:50:55 | → | ddellacosta joins (~ddellacos@86.106.121.100) |
| 2021-06-17 00:51:05 | × | spirgel quits (spirgel@gateway/vpn/protonvpn/spirgel) (Ping timeout: 244 seconds) |
| 2021-06-17 00:51:58 | → | teaSlurper joins (~chris@81.96.113.213) |
| 2021-06-17 00:54:57 | → | slice joins (~slice@user/slice) |
| 2021-06-17 00:55:13 | × | ddellacosta quits (~ddellacos@86.106.121.100) (Ping timeout: 244 seconds) |
| 2021-06-17 00:56:38 | → | jmcarthur joins (~jmcarthur@c-73-29-224-10.hsd1.nj.comcast.net) |
| 2021-06-17 00:57:55 | × | BosonCollider quits (~olofs@90-227-86-119-no542.tbcn.telia.com) (Read error: Connection reset by peer) |
| 2021-06-17 00:58:12 | → | BosonCollider joins (~olofs@90-227-86-119-no542.tbcn.telia.com) |
| 2021-06-17 01:00:10 | × | lbseale quits (~lbseale@user/ep1ctetus) (Read error: Connection reset by peer) |
| 2021-06-17 01:01:41 | → | renzhi joins (~xp@2607:fa49:6540:6e00::2b77) |
| 2021-06-17 01:04:20 | × | Deide quits (~Deide@user/deide) (Quit: Seeee yaaaa) |
| 2021-06-17 01:04:33 | × | sbmsr quits (~pi@2600:1700:63d0:4830:7dbf:92d8:fd42:235d) (Ping timeout: 272 seconds) |
All times are in UTC.