2025/03/13

Newest at the top

2025-03-13 06:10:19 +0100 <lambdabot> error: Variable not in scope: toLazyText
2025-03-13 06:10:18 +0100 <euouae> :t toLazyText
2025-03-13 06:10:13 +0100 <euouae> :m Data.Text.Lazy.Builder
2025-03-13 06:09:57 +0100 <lambdabot> error: Variable not in scope: toLazyText
2025-03-13 06:09:56 +0100 <euouae> :t toLazyText
2025-03-13 06:09:25 +0100 <euouae> but the typechecker complains about "Couldn't match type ‘Data.Text.Internal.Lazy.Text’ with ‘Text’"
2025-03-13 06:09:06 +0100 <euouae> I'm using text-2.0.2. I am trying to use `toLazyText :: Builder > Text` (supposedly... <https://hackage.haskell.org/package/text-2.0.2/docs/Data-Text-Lazy-Builder.html#v:toLazyText>)
2025-03-13 06:08:39 +0100 <euouae> I don't understand this error
2025-03-13 06:07:48 +0100k_hachig_(~k_hachig@2607:fea8:351d:ef0:a56d:37e8:f63c:429c) k_hachig
2025-03-13 06:01:33 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 268 seconds)
2025-03-13 05:58:20 +0100ensyde(~ensyde@2601:5c6:c200:6dc0::b413) ensyde
2025-03-13 05:54:22 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn
2025-03-13 05:54:00 +0100k_hachig(~k_hachig@2607:fea8:351d:ef0:a56d:37e8:f63c:429c) (Ping timeout: 246 seconds)
2025-03-13 05:49:16 +0100tusko(uid478376@user/tusko) tusko
2025-03-13 05:43:51 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 276 seconds)
2025-03-13 05:42:33 +0100alfiee(~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 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn
2025-03-13 05:37:35 +0100alfiee(~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 +0100veryfungi(~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 +0100euouaeTIL 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 +0100merijn(~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 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn
2025-03-13 05:22:48 +0100tavare(~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 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 260 seconds)
2025-03-13 05:08:33 +0100veryfungi(~veryfungi@user/veryfungi) veryfungi
2025-03-13 05:08:16 +0100merijn(~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 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 268 seconds)
2025-03-13 04:58:02 +0100izzyfalco(~jake_pers@user/izzyfalco) (Ping timeout: 268 seconds)
2025-03-13 04:56:48 +0100alfiee(~alfiee@user/alfiee) (Ping timeout: 268 seconds)