Newest at the top
2025-03-13 05:54:22 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn |
2025-03-13 05:54:00 +0100 | k_hachig | (~k_hachig@2607:fea8:351d:ef0:a56d:37e8:f63c:429c) (Ping timeout: 246 seconds) |
2025-03-13 05:49:16 +0100 | tusko | (uid478376@user/tusko) tusko |
2025-03-13 05:43:51 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 276 seconds) |
2025-03-13 05:42:33 +0100 | alfiee | (~alfiee@user/alfiee) (Ping timeout: 276 seconds) |
2025-03-13 05:39:25 +0100 | <jackdk> | You're welcome. Best of luck. |
2025-03-13 05:39:12 +0100 | <euouae> | Sounds good, thank you |
2025-03-13 05:39:00 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn |
2025-03-13 05:37:35 +0100 | alfiee | (~alfiee@user/alfiee) alfiee |
2025-03-13 05:33:51 +0100 | <jackdk> | I don't know the guts of megaparsec well enough to say, but when I think back to my experience learning Haskell and the library ecosystem, I found iterative deepening search much more rewarding than deep dives on individual libraries. Do what's most rewarding for you, of course. |
2025-03-13 05:32:27 +0100 | <euouae> | Perhaps I can write this myself? Is it too low-level to try to have efficient Text operations on my own? |
2025-03-13 05:31:46 +0100 | <euouae> | I was hoping a `takeWhileFailure` existed that was /fast/ meaning it crafted the Text string optimally instead of packing from a list |
2025-03-13 05:31:24 +0100 | veryfungi | (~veryfungi@user/veryfungi) (Quit: veryfungi) |
2025-03-13 05:31:12 +0100 | <euouae> | What I imagined I would be doing is a `takeWhileFailure` (I made this up) plus my stateful parser |
2025-03-13 05:30:21 +0100 | <jackdk> | (and then yeah, `fmap Text.pack`) |
2025-03-13 05:30:07 +0100 | <jackdk> | Yeah ok I wouldn't put your control flow info in your monadic state then. If you need to run a thing optionally up to 10 times, I would look at `count'` from package `parser-combinators`. |
2025-03-13 05:29:53 +0100 | euouae | TIL google/libphonenumber |
2025-03-13 05:29:13 +0100 | <euouae> | well, thanks anyway. I'll take the direction of your advice "just do the easy thing, e.g. T.pack on a list, and move on" |
2025-03-13 05:28:44 +0100 | <euouae> | That's why I took that deep dive into mtl heh. But now I'm realizing there's nowhere for me to plug that parser into :P |
2025-03-13 05:28:31 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 265 seconds) |
2025-03-13 05:28:14 +0100 | <euouae> | I'm not actually doing phone numbers. It's not a profiling matter, I was trying to learn more about megaparsec and haskell in general |
2025-03-13 05:27:49 +0100 | <jackdk> | I would profile and be sure you actually have a problem here, too, and potentially consider the libphonenumber bindings |
2025-03-13 05:27:24 +0100 | <euouae> | I could have a parser that reads a single digit plus optional junk, and I want to apply it 10 times, it doesn't seem a possibility to do "fast" at least with my limited understanding |
2025-03-13 05:26:46 +0100 | <euouae> | say I'm trying to parse a phone number and I have some optional stuff like (xxx)-yyy-zzzz or xxxyyy zzzz etc |
2025-03-13 05:25:58 +0100 | <euouae> | yeah but that returns number of tokens |
2025-03-13 05:25:18 +0100 | <jackdk> | `takeP` is also described as "fast" in the haddocks |
2025-03-13 05:23:38 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn |
2025-03-13 05:22:48 +0100 | tavare | (~tavare@user/tavare) tavare |
2025-03-13 05:20:28 +0100 | <euouae> | I thought I was getting somewhere by writing a parser with a stateful counter, but then I realized I have nowhere to plug that parser in, there's no combinator in megaparsec that accepts a parser and spits out a Text "fast". |
2025-03-13 05:19:49 +0100 | <euouae> | they suggest to use takeWhile1P and so on for fast parsing into Text. But it does not allow the predicate to have any state, e.g. I'd like to parse "at most 10" digits, or so; I don't want a list of 10 characters, I want it as a string |
2025-03-13 05:18:58 +0100 | <euouae> | hm... I'm sort of bothered by this megaparsec thing |
2025-03-13 05:13:09 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 260 seconds) |
2025-03-13 05:08:33 +0100 | veryfungi | (~veryfungi@user/veryfungi) veryfungi |
2025-03-13 05:08:16 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn |
2025-03-13 04:58:25 +0100 | <euouae> | yup I follow |
2025-03-13 04:58:10 +0100 | <jackdk> | Yes, the idea is to provide `MonadState st (ParsecT e s m)` by lifting the state actions from the inner `m` in a way that doesn't affect the `ParsecT`. |
2025-03-13 04:58:02 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 268 seconds) |
2025-03-13 04:58:02 +0100 | izzyfalco | (~jake_pers@user/izzyfalco) (Ping timeout: 268 seconds) |
2025-03-13 04:56:48 +0100 | alfiee | (~alfiee@user/alfiee) (Ping timeout: 268 seconds) |
2025-03-13 04:56:33 +0100 | <euouae> | I misread it because I saw "MonadState" followed by "ParsecT" and I didn't realize what I was reading |
2025-03-13 04:55:53 +0100 | <euouae> | oh wait, right. thank you jackdk. |
2025-03-13 04:55:29 +0100 | <jackdk> | euouae: And no, you have `ParsecT Void Text (St.State Int)` which matches the instance `MonadState (ParsecT e s m)` with `e ~ Void`, `s ~ Text`, `m ~ St.State Int`, and this instance is usable because you have the instances `Stream s` and `MonadState Int (St.StateT Int Identity)` (expanding the alias for `St.State`) |
2025-03-13 04:54:56 +0100 | <euouae> | somewhat frustrating to always have to run to haddock online |
2025-03-13 04:53:34 +0100 | <c_wraith> | so if nothing you've imported re-exports the class, the instance won't be listed |
2025-03-13 04:53:22 +0100 | izzyfalco | (~jake_pers@user/izzyfalco) izzyfalco |
2025-03-13 04:53:08 +0100 | <jackdk> | euouae: I had to `:m + Control.Monad.State` to see it |
2025-03-13 04:52:58 +0100 | <c_wraith> | yeah, ghci only shows you instances for classes that it has in scope |
2025-03-13 04:52:55 +0100 | merijn | (~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn |
2025-03-13 04:52:18 +0100 | <euouae> | jackdk: isn't that inverse of what I have in terms of the monadic stack? |
2025-03-13 04:52:11 +0100 | alfiee | (~alfiee@user/alfiee) alfiee |