Logs: liberachat/#haskell
| 2021-06-28 14:52:04 | × | mastarija quits (~mastarija@31.217.22.187) (Quit: Leaving) |
| 2021-06-28 14:52:37 | → | wroathe joins (~wroathe@c-68-54-25-135.hsd1.mn.comcast.net) |
| 2021-06-28 14:53:24 | → | slowButPresent joins (~slowButPr@user/slowbutpresent) |
| 2021-06-28 14:53:41 | × | slowButPresent quits (~slowButPr@user/slowbutpresent) (Client Quit) |
| 2021-06-28 14:55:18 | → | slowButPresent joins (~slowButPr@user/slowbutpresent) |
| 2021-06-28 14:55:49 | × | mikoto-chan quits (~mikoto-ch@ip-213-49-189-31.dsl.scarlet.be) (Quit: mikoto-chan) |
| 2021-06-28 14:56:01 | → | eggplantade joins (~Eggplanta@2600:1700:bef1:5e10:48c3:15b7:84fd:d26e) |
| 2021-06-28 14:58:49 | → | Guest33 joins (~textual@c-107-4-204-12.hsd1.mn.comcast.net) |
| 2021-06-28 14:59:39 | → | acidjnk joins (~acidjnk@p200300d0c72b9537492df79c17753059.dip0.t-ipconnect.de) |
| 2021-06-28 14:59:46 | → | tzh joins (~tzh@c-24-21-73-154.hsd1.or.comcast.net) |
| 2021-06-28 15:00:09 | → | Gurkenglas joins (~Gurkengla@dslb-002-203-144-156.002.203.pools.vodafone-ip.de) |
| 2021-06-28 15:00:15 | × | eggplantade quits (~Eggplanta@2600:1700:bef1:5e10:48c3:15b7:84fd:d26e) (Ping timeout: 250 seconds) |
| 2021-06-28 15:04:50 | × | dunkeln quits (~dunkeln@188.71.193.140) (Ping timeout: 272 seconds) |
| 2021-06-28 15:04:51 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-06-28 15:04:59 | → | myShoggoth joins (~myShoggot@75.164.51.64) |
| 2021-06-28 15:05:11 | × | azeem quits (~azeem@176.201.40.58) (Ping timeout: 268 seconds) |
| 2021-06-28 15:05:39 | × | boxscape_ quits (~boxscape_@vpn-44-171.hq.eso.org) (Changing host) |
| 2021-06-28 15:05:39 | → | boxscape_ joins (~boxscape_@user/boxscape) |
| 2021-06-28 15:08:08 | → | azeem joins (~azeem@176.201.40.58) |
| 2021-06-28 15:09:18 | → | warnz joins (~warnz@2600:1700:77c0:5610:eca1:bc9d:4345:931f) |
| 2021-06-28 15:09:22 | × | lavaman quits (~lavaman@98.38.249.169) (Ping timeout: 252 seconds) |
| 2021-06-28 15:09:33 | → | mastarija joins (~mastarija@31.217.22.187) |
| 2021-06-28 15:10:27 | × | nschoe quits (~quassel@2a04:cec0:1046:3438:9225:4581:e2d4:35d5) (Ping timeout: 268 seconds) |
| 2021-06-28 15:10:34 | → | shapr joins (~user@pool-100-36-247-68.washdc.fios.verizon.net) |
| 2021-06-28 15:10:44 | → | nschoe joins (~quassel@178.251.84.79) |
| 2021-06-28 15:13:17 | → | xkuru joins (~xkuru@user/xkuru) |
| 2021-06-28 15:14:09 | × | warnz quits (~warnz@2600:1700:77c0:5610:eca1:bc9d:4345:931f) (Ping timeout: 268 seconds) |
| 2021-06-28 15:15:15 | × | sekun_ quits (~sekun@180.190.223.119) (Ping timeout: 265 seconds) |
| 2021-06-28 15:15:43 | → | zava joins (~zava@ip5f5bdf0f.dynamic.kabel-deutschland.de) |
| 2021-06-28 15:16:01 | <zava> | hey I'm having issues with a parsec homework. It needs a final touch. Would you guys humor me pls? |
| 2021-06-28 15:16:52 | × | azeem quits (~azeem@176.201.40.58) (Read error: Connection reset by peer) |
| 2021-06-28 15:17:17 | × | tromp quits (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 2021-06-28 15:17:24 | <jophish> | final touches are probably an appropriate part of homework to help with |
| 2021-06-28 15:17:50 | <c_wraith> | you also tend to get better results by just asking your question than you do from asking if you can ask your question |
| 2021-06-28 15:17:57 | → | azeem joins (~azeem@dynamic-adsl-94-34-9-28.clienti.tiscali.it) |
| 2021-06-28 15:21:28 | × | xkuru quits (~xkuru@user/xkuru) (Quit: Unvirtualizing) |
| 2021-06-28 15:21:35 | → | eggplantade joins (~Eggplanta@2600:1700:bef1:5e10:48c3:15b7:84fd:d26e) |
| 2021-06-28 15:21:59 | <zava> | ok thanks you're right c_wraith |
| 2021-06-28 15:22:25 | → | peterhil joins (~peterhil@dsl-hkibng32-54f849-252.dhcp.inet.fi) |
| 2021-06-28 15:24:21 | <zava> | https://controlc.com/4ab86ca3 |
| 2021-06-28 15:24:50 | <zava> | the only test failing is sample5 |
| 2021-06-28 15:25:27 | <zava> | i want it to throw an error but I don't know how to make haskell check if there's any letter that isn't hexadecimal in there instead of just ignoring it |
| 2021-06-28 15:25:39 | → | Erutuon joins (~Erutuon@user/erutuon) |
| 2021-06-28 15:26:28 | × | ormaaj quits (~ormaaj@2001:470:69fc:105::35ca) (Changing host) |
| 2021-06-28 15:26:28 | → | ormaaj joins (~ormaaj@user/ormaaj) |
| 2021-06-28 15:26:47 | <c_wraith> | is there a requirement to not use do notation? Because that'd be a lot easier to read with it. |
| 2021-06-28 15:26:48 | → | tromp joins (~textual@dhcp-077-249-230-040.chello.nl) |
| 2021-06-28 15:28:26 | <zava> | it wasn't mentioned in the lecture + documentation thereof |
| 2021-06-28 15:28:33 | <zava> | I've seen it a lot though |
| 2021-06-28 15:28:41 | → | boxscape_89 joins (~boxscape_@p4ff0b158.dip0.t-ipconnect.de) |
| 2021-06-28 15:29:41 | × | DNH quits (~DNH@8.43.122.6) (Quit: My MacBook has gone to sleep. ZZZzzz…) |
| 2021-06-28 15:31:25 | × | boxscape_ quits (~boxscape_@user/boxscape) (Ping timeout: 268 seconds) |
| 2021-06-28 15:32:13 | <c_wraith> | as a side note, you could benefit from using string instead of char multiple times, when matching the prefix |
| 2021-06-28 15:33:54 | <c_wraith> | anyway... you pass test 6, but fail test 5? that's unusual |
| 2021-06-28 15:34:07 | × | justsomeguy quits (~justsomeg@user/justsomeguy) (Quit: WeeChat 3.0.1) |
| 2021-06-28 15:35:18 | <c_wraith> | oh, I see, test 6 fails on the prefix. Missed that. |
| 2021-06-28 15:35:33 | <zava> | oh yes true |
| 2021-06-28 15:36:01 | <c_wraith> | ok. first thing I'd do is add sample7 = "0xag" and add it to your test suite |
| 2021-06-28 15:36:08 | → | warnz joins (~warnz@2600:1700:77c0:5610:eca1:bc9d:4345:931f) |
| 2021-06-28 15:36:14 | <c_wraith> | see if that is failing the same way as sample5 |
| 2021-06-28 15:36:23 | <c_wraith> | if it is, you know both branches have the same problem |
| 2021-06-28 15:36:54 | → | dunkeln joins (~dunkeln@188.71.193.140) |
| 2021-06-28 15:37:49 | <zava> | expected "" but got "0xa" |
| 2021-06-28 15:39:11 | <c_wraith> | Ok, I just checked... the problem isn't your grammar, exactly. It's how runParsec/runP work :) |
| 2021-06-28 15:39:45 | <c_wraith> | runParser (string "ab") () "" "abc" --> Right "ab" |
| 2021-06-28 15:39:53 | <zava> | y |
| 2021-06-28 15:40:16 | <zava> | runP (string "ab") () "" "cab" --> Left ... |
| 2021-06-28 15:40:44 | <c_wraith> | as long as the parser succeeds, it doesn't care if there was extra input |
| 2021-06-28 15:40:57 | × | warnz quits (~warnz@2600:1700:77c0:5610:eca1:bc9d:4345:931f) (Ping timeout: 272 seconds) |
| 2021-06-28 15:41:16 | <c_wraith> | I think in parsec, your best way of handling this is to use eof |
| 2021-06-28 15:41:35 | <zava> | oh yes I saw that somewhere in the lecture |
| 2021-06-28 15:41:44 | → | DNH joins (~DNH@8.44.0.30) |
| 2021-06-28 15:41:51 | <zava> | do you have an usecaseexample? |
| 2021-06-28 15:41:53 | <c_wraith> | runParser (string "ab" >> eof) () "" "abc" --> Left ... |
| 2021-06-28 15:42:17 | <zava> | cool let me try |
| 2021-06-28 15:42:25 | <merijn> | Classic mistake :) |
| 2021-06-28 15:42:48 | <c_wraith> | to be honest, ignoring extra input is a weird default |
| 2021-06-28 15:42:51 | <merijn> | <- adds eof at the end of every parser out of paranoid habit :p |
| 2021-06-28 15:43:00 | <merijn> | c_wraith: It makes sense when you wanna compose things |
| 2021-06-28 15:43:24 | <merijn> | c_wraith: You'd just expect a convenient "parseFinal x = runParser (x >> eof)" to exist |
| 2021-06-28 15:43:31 | <c_wraith> | but runParser doesn't return anything you can use to compose. |
| 2021-06-28 15:43:50 | <zava> | ((char '0' >>= \s -> char 'x' >>= \t -> many1 hexDigit >>= \u >> eof -> return (Hex ([s,t] ++u))) like this I get a parseerror for ">>". changing it to "->" didnt work either |
| 2021-06-28 15:44:14 | <c_wraith> | You should add the eof in your call to runP, not as part of hexParser |
| 2021-06-28 15:45:17 | <c_wraith> | err, parseHex |
| 2021-06-28 15:45:35 | <c_wraith> | If you put it in parseHex, you break the ability to compose parseHex with other parsers |
| 2021-06-28 15:46:37 | <zava> | hmm I'm sorry I'm stuck |
| 2021-06-28 15:46:48 | <zava> | I tried putting it behind parseHex in the parse method |
| 2021-06-28 15:46:54 | <zava> | brb 5 min |
| 2021-06-28 15:47:10 | × | tromp quits (~textual@dhcp-077-249-230-040.chello.nl) (Quit: My iMac has gone to sleep. ZZZzzz…) |
| 2021-06-28 15:50:49 | <c_wraith> | oh. I see, the problem is that >> means the parser is returning () |
| 2021-06-28 15:51:01 | <c_wraith> | you could change that to <* instead of >> |
| 2021-06-28 15:52:08 | <c_wraith> | or if you're unfamiliar with that operator, you could do the standard dance (parseHex >>= \h -> eof >> return h) |
| 2021-06-28 15:52:22 | <c_wraith> | Those do the same thing |
| 2021-06-28 15:53:20 | × | ubert1 quits (~Thunderbi@p200300ecdf259d13e6b318fffe838f33.dip0.t-ipconnect.de) (Quit: ubert1) |
| 2021-06-28 15:53:33 | <zava> | lol now it works |
| 2021-06-28 15:53:35 | <zava> | thanks a lot! |
| 2021-06-28 15:53:39 | → | lavaman joins (~lavaman@98.38.249.169) |
| 2021-06-28 15:53:51 | <zava> | (parseHex <* eof) did the trick |
| 2021-06-28 15:54:19 | × | Lycurgus quits (~juan@cpe-45-46-140-49.buffalo.res.rr.com) (Quit: Exeunt) |
| 2021-06-28 15:54:23 | <c_wraith> | yeah, that operator means "do the left argument, do the right argument, return the value returned by the left argument" |
All times are in UTC.