Logs: liberachat/#haskell
| 2025-12-16 09:50:45 | <dminuoso> | I'll leave the decision up to you whether you should do that. :-) |
| 2025-12-16 09:51:49 | × | merijn quits (~merijn@77.242.116.146) (Ping timeout: 260 seconds) |
| 2025-12-16 09:52:30 | <gentauro> | if you parse, lets say encoded bytes over the wire, where the length is encoded in varInt/zigZag/…, you MUST use `>>=` to parse length to ensure correct boundries with upcoming bytes? |
| 2025-12-16 09:52:59 | <gentauro> | ex: list of strings |
| 2025-12-16 09:53:09 | <dminuoso> | gentauro: I think you could do a kind of recursion trick parsing it with `select` perhaps. |
| 2025-12-16 09:53:20 | <dminuoso> | But it would result in downright silly performance. |
| 2025-12-16 09:53:38 | → | fp joins (~Thunderbi@130.233.70.102) |
| 2025-12-16 09:53:41 | <gentauro> | makes sense |
| 2025-12-16 09:54:07 | → | fp1 joins (~Thunderbi@wireless-86-50-140-165.open.aalto.fi) |
| 2025-12-16 09:55:07 | <dminuoso> | This should be a fun excercise, let me try this. |
| 2025-12-16 09:55:30 | × | tzh quits (~tzh@c-76-115-131-146.hsd1.or.comcast.net) (Quit: zzz) |
| 2025-12-16 09:56:30 | <dminuoso> | I think you should be able to write `>>= :: (Enum a, Selective f) => f a -> (a -> f b) -> f b` |
| 2025-12-16 09:56:30 | chromoblob | ✌️ ski |
| 2025-12-16 09:57:03 | × | poscat0x04 quits (~poscat@user/poscat) (Remote host closed the connection) |
| 2025-12-16 09:57:08 | <dminuoso> | Ah no, not quite. |
| 2025-12-16 09:57:47 | <dminuoso> | `bindEither :: (Enum a, Selective f) => f (Either a b) -> (a -> f b) -> f b` |
| 2025-12-16 09:57:49 | <dminuoso> | This. |
| 2025-12-16 09:58:05 | × | fp quits (~Thunderbi@130.233.70.102) (Ping timeout: 250 seconds) |
| 2025-12-16 09:58:07 | × | fp1 quits (~Thunderbi@wireless-86-50-140-165.open.aalto.fi) (Ping timeout: 240 seconds) |
| 2025-12-16 10:00:10 | → | poscat joins (~poscat@user/poscat) |
| 2025-12-16 10:04:41 | → | humasect_ joins (~humasect@dyn-192-249-132-90.nexicom.net) |
| 2025-12-16 10:04:52 | → | merijn joins (~merijn@77.242.116.146) |
| 2025-12-16 10:06:28 | → | mangoiv joins (~mangoiv@user/mangoiv) |
| 2025-12-16 10:09:18 | × | humasect_ quits (~humasect@dyn-192-249-132-90.nexicom.net) (Ping timeout: 260 seconds) |
| 2025-12-16 10:09:19 | × | merijn quits (~merijn@77.242.116.146) (Ping timeout: 240 seconds) |
| 2025-12-16 10:21:15 | → | merijn joins (~merijn@77.242.116.146) |
| 2025-12-16 10:21:25 | × | xff0x quits (~xff0x@fsb6a9491c.tkyc517.ap.nuro.jp) (Ping timeout: 246 seconds) |
| 2025-12-16 10:24:26 | × | humasect quits (~humasect@dyn-192-249-132-90.nexicom.net) (Remote host closed the connection) |
| 2025-12-16 10:25:14 | × | trickard quits (~trickard@cpe-81-98-47-163.wireline.com.au) (Read error: Connection reset by peer) |
| 2025-12-16 10:25:27 | → | trickard_ joins (~trickard@cpe-81-98-47-163.wireline.com.au) |
| 2025-12-16 10:25:35 | × | merijn quits (~merijn@77.242.116.146) (Ping timeout: 240 seconds) |
| 2025-12-16 10:28:59 | → | haritz joins (~hrtz@2a01:4b00:bc2e:7000:d5af:a266:ca31:5ef8) |
| 2025-12-16 10:28:59 | × | haritz quits (~hrtz@2a01:4b00:bc2e:7000:d5af:a266:ca31:5ef8) (Changing host) |
| 2025-12-16 10:28:59 | → | haritz joins (~hrtz@user/haritz) |
| 2025-12-16 10:31:20 | <dutchie> | I'm having trouble with quoting ghc-options in cabal files. In my .cabal I have: `ghc-options: -Wall -with-rtsopts="-N -I0"` but when I build, I get a warning `Warning: [misplaced-c-opt] Instead of 'ghc-options: -I0"' use 'include-dirs: 0"'` and then my program errors out complaining that the rts option `"-N` is unexpected |
| 2025-12-16 10:31:34 | <dutchie> | how can i pass multiple flags to -with-rtsopts? |
| 2025-12-16 10:31:48 | <[exa]> | dminuoso: Is that precisely the Monad jump though? I somehow felt that having the integers always finite would degrade the capabilities of the stuff a little (as in, you can't encode actual turing machine into that computation, right?) |
| 2025-12-16 10:31:51 | <tomsmeding> | dutchie: you have to put the quotes around the entire thing |
| 2025-12-16 10:31:57 | <tomsmeding> | "-with-rtsopts=-N -I0" |
| 2025-12-16 10:32:14 | <dutchie> | ah i think that's about the only quotation mode i've not tried lol |
| 2025-12-16 10:32:40 | <dminuoso> | [exa]: Like I said, in principle you could recurse over anything enumerable with something like `bindEither :: (Enum a, Selective f) => f (Either a b) -> (a -> f b) -> f b`, but it would result in terrible performance |
| 2025-12-16 10:33:17 | <dutchie> | ty, that's sorted it |
| 2025-12-16 10:33:39 | <dminuoso> | [exa]: So its not just about being finite, but being enumerable. |
| 2025-12-16 10:33:45 | <[exa]> | dminuoso: yeah that is true, I'm more like searching for a theoretical argument |
| 2025-12-16 10:34:51 | <[exa]> | as in, not "how to simulate this with selectives" but "how does this allow you to run an arbitrary monad" |
| 2025-12-16 10:34:58 | <dminuoso> | [exa]: Selective gives you the power to branch. To find a number, you would have to essentially enumerate that branching until you arrive at a branch that matches that precise number/ |
| 2025-12-16 10:35:17 | <dminuoso> | [exa]: That is, you enumerate all possible numbers into a parser tree, and with `select` you can navigate one branch at a time. |
| 2025-12-16 10:35:32 | <dminuoso> | This is not an arbitrary monad. |
| 2025-12-16 10:35:35 | <dminuoso> | Monad is strictly more powerful. |
| 2025-12-16 10:35:44 | <[exa]> | ah okay good |
| 2025-12-16 10:35:54 | <dminuoso> | Monad can do it without having to enumerate. |
| 2025-12-16 10:36:03 | <dminuoso> | So it works on things that are not enumerable. |
| 2025-12-16 10:36:24 | <[exa]> | ahhhhhhhhh ok I think I get the whole problem now |
| 2025-12-16 10:36:26 | <[exa]> | okay |
| 2025-12-16 10:36:28 | <[exa]> | good |
| 2025-12-16 10:36:30 | <[exa]> | thanks |
| 2025-12-16 10:37:08 | → | merijn joins (~merijn@77.242.116.146) |
| 2025-12-16 10:37:28 | <[exa]> | so if this would be a typeclass, it would make sense (not completely a Monad) but it would be more like an efficiency upgrade of Selectives for this exact case, not actual new functionality |
| 2025-12-16 10:37:51 | <dminuoso> | [exa]: One good way to think about selective is to imagine that `Applicative` gives you a kind of diamond that acts "in parallel" (but I mean that in a reall loose sense), whereas `Selective` gives you a diamond that acts as a conditional branch . |
| 2025-12-16 10:39:08 | <dminuoso> | [exa]: And no, not a separate typeclass |
| 2025-12-16 10:39:24 | <dminuoso> | [exa]: The prescribed `bindEither` above should be writable. |
| 2025-12-16 10:39:28 | <dminuoso> | With no extra typeclass |
| 2025-12-16 10:39:54 | <tomsmeding> | I guess you can formulate it as: with Selective you can have branching on previously-computed values, but the whole branching tree must be known before seeing any values |
| 2025-12-16 10:40:14 | <[exa]> | yeah, I wanted this more for the static analysis, the extra action would be somewhat of a kleene star, but you'd know exactly what you need to compute to know how many repetitions are there |
| 2025-12-16 10:40:40 | <tomsmeding> | whereas with Monad, the branches can be decided on _after_ seeing values, which corresponds to a possibly infinite branching tree if you'dd need to specify it all statically |
| 2025-12-16 10:40:49 | <dminuoso> | tomsmeding: Sure. And with `monad` the parse structure is potentially completely unknown, as it can depend on effect results. |
| 2025-12-16 10:40:58 | <dminuoso> | % :t (>>=) |
| 2025-12-16 10:40:59 | <yahb2> | (>>=) :: Monad m => m a -> (a -> m b) -> m b |
| 2025-12-16 10:41:02 | <dminuoso> | It's literally baked into this type. :) |
| 2025-12-16 10:41:07 | <tomsmeding> | yes :) |
| 2025-12-16 10:41:43 | × | merijn quits (~merijn@77.242.116.146) (Ping timeout: 264 seconds) |
| 2025-12-16 10:41:58 | <dminuoso> | Of course, if we applied some black hole theory and cosmology, one could argue that all possible executions are enumeratable - the entropy of the visible universe is finite. |
| 2025-12-16 10:42:03 | <dminuoso> | enumerable? |
| 2025-12-16 10:42:10 | <[exa]> | I probably just want an actual marker there into the selective tree that tells me "this selection is numeric" |
| 2025-12-16 10:42:33 | <tomsmeding> | and give an infinite list of branches? |
| 2025-12-16 10:42:48 | <dminuoso> | Finiteness is a red herring. |
| 2025-12-16 10:42:54 | <dminuoso> | It's just about enumerability I think? |
| 2025-12-16 10:42:59 | <tomsmeding> | is Integer enumerable? |
| 2025-12-16 10:43:09 | <tomsmeding> | (ignoring cosmology arguments) |
| 2025-12-16 10:43:30 | <dminuoso> | `Enum Integer` is a thing |
| 2025-12-16 10:44:06 | <tomsmeding> | but can you simulate `(>>=) @_ @Integer` with Selective? |
| 2025-12-16 10:44:25 | <tomsmeding> | (you can simulate `(>>=) @_ @Bool` trivially using Either () ()) |
| 2025-12-16 10:44:48 | <dminuoso> | Im thinking that perhaps we need at least one bound, or some base case. Enum doesnt seem to have `zero :: Enum a => a` |
| 2025-12-16 10:45:11 | <tomsmeding> | you can also simulate `(>>=) @_ @Int`, with a branching tree that has 2^64 leaves, and a cosmological computer |
| 2025-12-16 10:45:18 | <dminuoso> | There is `toEnum :: Enum a => Int -> a` but Im not sure about its semantics |
| 2025-12-16 10:45:30 | → | merijn joins (~merijn@77.242.116.146) |
| 2025-12-16 10:45:42 | → | Googulator71 joins (~Googulato@2a01-036d-0106-01cb-3c18-a4bd-1bda-7c8b.pool6.digikabel.hu) |
| 2025-12-16 10:45:44 | <dminuoso> | tomsmeding: Even without cosmology arguments, it's very trivial to enumerate over all Integer? |
| 2025-12-16 10:45:48 | <dminuoso> | Assuming infinite memory. |
| 2025-12-16 10:45:55 | <dminuoso> | Integer is countable |
| 2025-12-16 10:45:58 | <tomsmeding> | only if the selective functor itself is lazy, I guess? |
| 2025-12-16 10:46:07 | <tomsmeding> | because the branching tree would be infinitely large |
| 2025-12-16 10:46:14 | <dminuoso> | It just matters whether its countable. |
| 2025-12-16 10:46:20 | <dminuoso> | Or does it? |
| 2025-12-16 10:46:24 | <tomsmeding> | well everything is countable |
| 2025-12-16 10:46:25 | × | Googulator quits (~Googulato@2a01-036d-0106-01cb-3c18-a4bd-1bda-7c8b.pool6.digikabel.hu) (Quit: Client closed) |
| 2025-12-16 10:46:29 | <dminuoso> | Not everything is. |
| 2025-12-16 10:46:34 | <tomsmeding> | in computer science, everything is |
| 2025-12-16 10:47:45 | <tomsmeding> | so if the question is just whether the thing being branched on is countable, then the difference between Selective and Monad would only be one of performance and memory use |
| 2025-12-16 10:48:03 | <dminuoso> | So this is an interesting question. |
All times are in UTC.