2025/09/24

Newest at the top

2025-09-24 13:11:11 +0200Athas(athas@sigkill.dk)
2025-09-24 13:10:59 +0200Athas(athas@2a01:7c8:aaac:1cf:d153:5501:dd03:4891) (Quit: ZNC 1.9.1 - https://znc.in)
2025-09-24 13:07:58 +0200CiaoSen(~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db) (Ping timeout: 265 seconds)
2025-09-24 13:06:44 +0200merijn(~merijn@77.242.116.146) merijn
2025-09-24 13:06:21 +0200Vajb(~Vajb@85-76-47-114-nat.elisa-mobile.fi) (Ping timeout: 258 seconds)
2025-09-24 13:03:40 +0200merijn(~merijn@77.242.116.146) (Ping timeout: 258 seconds)
2025-09-24 12:58:37 +0200Enrico63(~Enrico63@2a0b:e541:10d0:0:9efc:e8ff:fe24:3213) (Quit: Client closed)
2025-09-24 12:55:05 +0200Vajb(~Vajb@85-76-47-114-nat.elisa-mobile.fi)
2025-09-24 12:52:56 +0200michalz_(~michalz@185.246.207.203) (Ping timeout: 258 seconds)
2025-09-24 12:51:42 +0200michalz(~michalz@185.246.207.197)
2025-09-24 12:49:50 +0200mulk(~mulk@pd95144c3.dip0.t-ipconnect.de) (Remote host closed the connection)
2025-09-24 12:49:27 +0200trickard_(~trickard@cpe-49-98-47-163.wireline.com.au)
2025-09-24 12:49:14 +0200trickard(~trickard@cpe-49-98-47-163.wireline.com.au) (Read error: Connection reset by peer)
2025-09-24 12:45:46 +0200Vajb(~Vajb@n73ytrjjz36ldo55g3k-1.v6.elisa-mobile.fi) (Ping timeout: 248 seconds)
2025-09-24 12:43:06 +0200wootehfoot(~wootehfoo@user/wootehfoot) (Ping timeout: 248 seconds)
2025-09-24 12:41:21 +0200Vajb(~Vajb@n73ytrjjz36ldo55g3k-1.v6.elisa-mobile.fi)
2025-09-24 12:38:16 +0200wootehfoot(~wootehfoo@user/wootehfoot) wootehfoot
2025-09-24 12:34:35 +0200infinity0(~infinity0@pwned.gg) infinity0
2025-09-24 12:33:13 +0200 <Enrico63> ```
2025-09-24 12:33:13 +0200 <Enrico63>         parse _ = invalid ("Invalid expression: " ++ e)
2025-09-24 12:33:12 +0200 <Enrico63>   where parse [a1,op,a2] = parseOp op <*> parseArg a1 <*> parseArg a2
2025-09-24 12:33:12 +0200 <Enrico63> parseExpression e = parse (words e)
2025-09-24 12:33:11 +0200 <Enrico63> parseExpression :: String -> Validation Expression
2025-09-24 12:33:11 +0200 <Enrico63> ```
2025-09-24 12:33:10 +0200 <Enrico63> Ok, the solution from the site is a bit simpler, ahah:
2025-09-24 12:25:52 +0200 <Enrico63> Thanks Leary and tomsmeding
2025-09-24 12:20:41 +0200arandombit(~arandombi@user/arandombit) arandombit
2025-09-24 12:20:41 +0200arandombit(~arandombi@2603:7000:4600:ffbe:15f4:44c6:cf8f:dc61) (Changing host)
2025-09-24 12:20:41 +0200arandombit(~arandombi@2603:7000:4600:ffbe:15f4:44c6:cf8f:dc61)
2025-09-24 12:19:14 +0200 <Enrico63> So if `hasThreeWords` passed, the computation proceeds as I had alrady done. The trick is that if that fails, then we just return `empty`, so we don't contribute to the list of errors, yet we don't hard-error nor we give a meaningless Ok.
2025-09-24 12:18:10 +0200 <Enrico63> ```
2025-09-24 12:18:09 +0200 <Enrico63>                          _ -> empty
2025-09-24 12:18:09 +0200 <Enrico63>                          (a:op:b:_) -> parseOp op <*> parseIntOrVar a <*> parseIntOrVar b
2025-09-24 12:18:08 +0200 <Enrico63>                       case words str of
2025-09-24 12:18:08 +0200 <Enrico63> parseExpression str = hasThreeWords str *>
2025-09-24 12:18:07 +0200 <Enrico63> parseExpression :: String -> Validation Expression
2025-09-24 12:18:07 +0200 <Enrico63> ```
2025-09-24 12:18:06 +0200 <Enrico63> and together with the others I've defined above, it can be used like this:
2025-09-24 12:18:06 +0200 <Enrico63> ```
2025-09-24 12:18:05 +0200 <Enrico63>                     _ -> invalid $ "Invalid expression: " ++ s
2025-09-24 12:18:05 +0200 <Enrico63>                     (a:op:b:[]) -> pure ()
2025-09-24 12:18:04 +0200 <Enrico63> hasThreeWords s = case words s of
2025-09-24 12:18:04 +0200 <Enrico63> hasThreeWords :: String -> Validation ()
2025-09-24 12:18:03 +0200 <Enrico63> ```
2025-09-24 12:18:03 +0200 <Enrico63> Ok, I have a solution. This is the validator you suggested:
2025-09-24 12:16:13 +0200 <Leary> Neither `k` nor `+` are erroneous, so they wouldn't contribute to the error set either way; it's ambiguous whether parsing should proceed or not (perhaps intentionally so).
2025-09-24 12:15:42 +0200Vajb(~Vajb@n7nfchy4dz4j3x4yypz-1.v6.elisa-mobile.fi) (Ping timeout: 256 seconds)
2025-09-24 12:15:20 +0200 <Enrico63> Oh. I think the key is to use `empty`..
2025-09-24 12:14:10 +0200infinity0(~infinity0@pwned.gg) (Ping timeout: 255 seconds)
2025-09-24 12:11:47 +0200 <Enrico63> So the parsing of `k` and `+` is not meant to have a chance to run