Home liberachat/#haskell: Logs Calendar

Logs: liberachat/#haskell

←Prev  Next→ 1,799,081 events total
2026-02-11 10:44:00 absence joins (torgeihe@hildring.pvv.ntnu.no)
2026-02-11 10:44:17 oskarw joins (~user@user/oskarw)
2026-02-11 10:45:23 Googulator33 is now known as Googulator
2026-02-11 10:46:18 × sord937 quits (~sord937@gateway/tor-sasl/sord937) (Remote host closed the connection)
2026-02-11 10:46:38 sord937 joins (~sord937@gateway/tor-sasl/sord937)
2026-02-11 11:03:40 comerijn joins (~merijn@77.242.116.146)
2026-02-11 11:05:42 trickard__ is now known as trickard
2026-02-11 11:06:44 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 260 seconds)
2026-02-11 11:15:49 × comerijn quits (~merijn@77.242.116.146) (Ping timeout: 255 seconds)
2026-02-11 11:15:50 × trickard quits (~trickard@cpe-54-98-47-163.wireline.com.au) (Read error: Connection reset by peer)
2026-02-11 11:16:03 trickard_ joins (~trickard@cpe-54-98-47-163.wireline.com.au)
2026-02-11 11:20:48 <tomsmeding> controversional BlockArguments printing :p
2026-02-11 11:28:34 merijn joins (~merijn@77.242.116.146)
2026-02-11 11:29:50 × Enrico63 quits (~Enrico63@host-79-22-157-220.retail.telecomitalia.it) (Quit: Client closed)
2026-02-11 11:30:09 <Leary> Haskell98 printing in a better timeline.
2026-02-11 11:34:44 × comonad quits (~comonad@p200300d02722ae00dce4ce9451b59974.dip0.t-ipconnect.de) (Ping timeout: 260 seconds)
2026-02-11 11:34:44 <ski> got annoyed at not having `BlockArguments'-style printing of trailing lambda (including inside of an outer bracketting), with a simple standard precedence printer that i used for some examples i was playing around with, so i threw the above together, to see whether my initial hunch for how to do it would work
2026-02-11 11:34:58 × trickard_ quits (~trickard@cpe-54-98-47-163.wireline.com.au) (Read error: Connection reset by peer)
2026-02-11 11:35:10 × merijn quits (~merijn@77.242.116.146) (Ping timeout: 246 seconds)
2026-02-11 11:35:11 trickard_ joins (~trickard@cpe-54-98-47-163.wireline.com.au)
2026-02-11 11:36:32 <ski> (i'd first done it in a kludgey way, with the traditional precedences, but it turned out to not work for more complex examples. oh, and yea, i'm pretty sure this should work for mixfix with individual precedences specified for the ends of the constituent lexemes (cf. Annika Aasa's papers on parsing))
2026-02-11 11:38:20 × j1n37 quits (~j1n37@user/j1n37) (Read error: Connection reset by peer)
2026-02-11 11:39:44 <bwe> Why is the second (Megaparsec) parser not being evaluated? `parseMaybe (try (1 <$ "abc") <|> 1 <$ "abcd") "abcd"` -- parseTest is of no help as it moans about ambiguous types. And no, encapsulating each parser with try doesn't help either (assuming the backtracing is the issue).
2026-02-11 11:40:18 <bwe> tomsmeding: Thanks for the recommendation of the fsnotify package (yet to check it out).
2026-02-11 11:40:24 j1n37 joins (~j1n37@user/j1n37)
2026-02-11 11:42:26 <Leary> bwe: Why would it be? The first succeeds.
2026-02-11 11:46:01 × trickard_ quits (~trickard@cpe-54-98-47-163.wireline.com.au) (Ping timeout: 246 seconds)
2026-02-11 11:46:31 <bwe> I mean `parseMaybe (try (1 <$ "abc") <|> 1 <$ "abcd") "abcd"` of course. There, the second does not succeed, but I want it to succeed.
2026-02-11 11:47:34 <__monty__> bwe: <|> uses its left argument if it succeeds, so if it does the right argument is never tried.
2026-02-11 11:47:53 <__monty__> In this case I assume you want to flip the argument order basically.
2026-02-11 11:53:21 trickard_ joins (~trickard@cpe-54-98-47-163.wireline.com.au)
2026-02-11 11:54:19 Enrico63 joins (~Enrico63@host-79-22-157-220.retail.telecomitalia.it)
2026-02-11 11:54:34 × housemate quits (~housemate@202.7.248.67) (Ping timeout: 260 seconds)
2026-02-11 11:55:22 merijn joins (~merijn@77.242.116.146)
2026-02-11 11:56:33 weary-traveler joins (~user@user/user363627)
2026-02-11 11:58:10 comonad joins (~comonad@p200300d02722ae00dce4ce9451b59974.dip0.t-ipconnect.de)
2026-02-11 11:58:36 <bwe> __monty__: But why does it return Nothing, then? (Flipping fixes it for me but I still don't understand the concept.)
2026-02-11 12:00:15 <Leary> bwe: "This function also parses eof, so if the parser doesn't consume all of its input, it will fail."
2026-02-11 12:02:36 <bwe> Leary: So this answers why `parseMaybe` behaves differently than when I combine the parser with others. What's then the right function to (unit) test parser combinator segments?
2026-02-11 12:03:15 <merijn> bwe: I mean, you could just add "<* eof" to each parse before feeding to parseMaybe? :)
2026-02-11 12:03:51 <merijn> i.e.: parseMaybe (foo <* eof) "stuff here"
2026-02-11 12:04:51 <Leary> I think they want the opposite; add `<* takeWhileP (const True)`.
2026-02-11 12:05:03 <__monty__> Or use parseTest and just add the type annotation that it complains about.
2026-02-11 12:06:35 <Leary> `parseTest` seems to be for visual inspection, not automated testing.
2026-02-11 12:13:21 <ski> (seems to me like the failing end of input ought to trigger backtracking, with the `try' present there, no ?)
2026-02-11 12:14:09 <Leary> No, it's outside of the `<|>`.
2026-02-11 12:14:25 trickard_ is now known as trickard
2026-02-11 12:18:29 prdak1 joins (~Thunderbi@user/prdak)
2026-02-11 12:18:34 × prdak quits (~Thunderbi@user/prdak) (Ping timeout: 246 seconds)
2026-02-11 12:18:34 prdak1 is now known as prdak
2026-02-11 12:22:56 <ski> (mm, right. for some reason i was thinking it did the right distributive law, with `try' .. too bad)
2026-02-11 12:23:25 × prdak quits (~Thunderbi@user/prdak) (Ping timeout: 264 seconds)
2026-02-11 12:23:56 machinedgod joins (~machinedg@d75-159-126-101.abhsia.telus.net)
2026-02-11 12:24:42 <tomsmeding> bwe: as people have said, thep roblem is that "abc" succeeds, so the left argument to (<|>) succeeds, so the (<|>) as a whole succeeds and that's that. (Mega)parsec does not do arbitrary backtracking: its model is that if a parser fails while having consumed input, it's an error; if a parser fails without consuming input, we backtrack. 'try' wraps its argument to "undo" the input consumption upon
2026-02-11 12:24:44 <tomsmeding> error.
2026-02-11 12:25:31 <tomsmeding> The solutions here seem to be swapping the two parsers (in which case the try shouldn't be necessary any more), or augmenting the "abc" parser to explicitly reject a following 'd'
2026-02-11 12:25:45 <tomsmeding> ("abc" >> notFollowedBy "d"), for example
2026-02-11 12:26:05 <tomsmeding> or ("abc" >> eof), if appropriate
2026-02-11 12:26:58 <tomsmeding> I'm not a fan of this model of "backtracking is an error without consuming input", as it's unintuitive and at times inflexible; I prefer my parser combinators more explicit about backtracking and failure
2026-02-11 12:27:41 <tomsmeding> but I also have to be honest that if you make things more explicit, the whole system doesn't necessarily get nicer -- the rule does somehow strike a balance where a lot of cases can be expressed fairly neatly
2026-02-11 12:29:53 ski would like a mode & determinism tracking system that could be used to ensure that you get the intended efficient switching rather than backtracking, when you expect it, without removing the more general case, nor making it less convenient to express
2026-02-11 12:30:53 fp joins (~Thunderbi@wireless-86-50-141-104.open.aalto.fi)
2026-02-11 12:31:28 tremon joins (~tremon@83.80.159.219)
2026-02-11 12:34:33 <ski> (oh, and it should satisfy the right (and left, upto permutation of solutions) distribution law, and also the law that if `p' parses tokens `s' and `q' parses tokens `t', then `p >> q' ought to parse tokens `s <> t' (so, no `eof' nor `lookAhead'))
2026-02-11 12:35:00 × fp quits (~Thunderbi@wireless-86-50-141-104.open.aalto.fi) (Ping timeout: 252 seconds)
2026-02-11 12:37:28 × Beowulf quits (florian@2a01:4f9:3b:2d56::2) (Server closed connection)
2026-02-11 12:38:04 Beowulf joins (florian@2a01:4f9:3b:2d56::2)
2026-02-11 12:43:28 × driib3180 quits (~driib@vmi931078.contaboserver.net) (Server closed connection)
2026-02-11 12:44:06 driib3180 joins (~driib@vmi931078.contaboserver.net)
2026-02-11 12:46:45 karenw joins (~karenw@user/karenw)
2026-02-11 12:52:57 prdak joins (~Thunderbi@user/prdak)
2026-02-11 12:56:19 rensenwxre is now known as fwam
2026-02-11 12:57:26 × prdak quits (~Thunderbi@user/prdak) (Ping timeout: 252 seconds)
2026-02-11 12:58:39 juri_ joins (~juri@212.86.50.13)
2026-02-11 12:58:47 × lisbeths quits (uid135845@id-135845.lymington.irccloud.com) (Quit: Connection closed for inactivity)
2026-02-11 12:58:47 × juri_ quits (~juri@212.86.50.13) (Read error: Connection reset by peer)
2026-02-11 13:01:28 × APic quits (apic@apic.name) (Server closed connection)
2026-02-11 13:02:45 <gentauro> ski: with `lookAhead` you bind your parser logic to a monadic context right? Isn't it better su rely only on (Selective) Applicative and Functors?
2026-02-11 13:03:29 <ski> well, i said "no [..] `lookAhead'"
2026-02-11 13:04:15 juri_ joins (~juri@212.86.50.13)
2026-02-11 13:04:25 × juri_ quits (~juri@212.86.50.13) (Read error: Connection reset by peer)
2026-02-11 13:04:48 × omnifunctor quits (~omnifunct@user/semifunctor) (Server closed connection)
2026-02-11 13:05:02 omnifunctor joins (~omnifunct@user/semifunctor)
2026-02-11 13:06:04 <gentauro> ski: got it
2026-02-11 13:06:38 APic joins (apic@apic.name)
2026-02-11 13:09:50 juri_ joins (~juri@212.86.50.13)
2026-02-11 13:10:03 × juri_ quits (~juri@212.86.50.13) (Read error: Connection reset by peer)
2026-02-11 13:22:31 Square joins (~Square4@user/square)
2026-02-11 13:26:14 fp joins (~Thunderbi@130.233.70.158)
2026-02-11 13:26:32 × trickard quits (~trickard@cpe-54-98-47-163.wireline.com.au) (Remote host closed the connection)
2026-02-11 13:26:43 × _________ quits (~nobody@user/noodly) (Ping timeout: 260 seconds)
2026-02-11 13:27:25 _________ joins (~nobody@user/noodly)
2026-02-11 13:28:28 rekahsoft joins (~rekahsoft@bras-base-orllon1103w-grc-20-76-67-111-168.dsl.bell.ca)
2026-02-11 13:32:13 emaczen joins (~user@user/emaczen)
2026-02-11 13:49:33 pr1sm joins (~pr1sm@24.91.163.31)
2026-02-11 13:57:19 housemate joins (~housemate@2001:8004:6970:4f3c:c4f4:395a:ec93:7dc)
2026-02-11 14:00:45 × infinity0 quits (~infinity0@pwned.gg) (Ping timeout: 245 seconds)
2026-02-11 14:02:38 mzg_ is now known as mzg
2026-02-11 14:05:19 × Googulator quits (~Googulato@2a01-036d-0106-216f-6164-ec92-51a0-9cde.pool6.digikabel.hu) (Quit: Client closed)
2026-02-11 14:05:36 Googulator joins (~Googulato@2a01-036d-0106-216f-6164-ec92-51a0-9cde.pool6.digikabel.hu)

All times are in UTC.