Newest at the top
2025-03-25 14:25:03 +0100 | <EvanR> | "IO wraps the pair" ok now I'm losing it with the burrito analogy, I feel like that might be off the farm |
2025-03-25 14:24:52 +0100 | <tomsmeding> | Liamzee: I agree re ridiculousness of inside/outside, but the original question was about intuition about monad transformer stacks _without_ expanding their definitions |
2025-03-25 14:24:40 +0100 | CiaoSen | (~Jura@2a02:8071:64e1:da0:5a47:caff:fe78:33db) (Ping timeout: 244 seconds) |
2025-03-25 14:24:33 +0100 | <haskellbridge> | <Liamzee> then IO wraps the output (a, s) pair |
2025-03-25 14:24:22 +0100 | <tomsmeding> | > newtype StateT s m a = StateT { runStateT :: s -> m (a,s) } |
2025-03-25 14:24:17 +0100 | <haskellbridge> | <Liamzee> you have a data dependency on state |
2025-03-25 14:24:14 +0100 | <EvanR> | s -> (a, IO s) |
2025-03-25 14:24:12 +0100 | <haskellbridge> | <Liamzee> how ridiculous the notion of outside and inside can be with some of these monad transformers |
2025-03-25 14:24:10 +0100 | <EvanR> | I guess we need to complete all the possibilities |
2025-03-25 14:23:54 +0100 | <haskellbridge> | <Liamzee> i just came up with some nonsense versions to try to illustrate |
2025-03-25 14:23:48 +0100 | <tomsmeding> | lambdabot just expands the newtypes |
2025-03-25 14:23:40 +0100 | <EvanR> | oh it's two versions from Liamzee |
2025-03-25 14:23:32 +0100 | <haskellbridge> | <Liamzee> it's lambdabot |
2025-03-25 14:23:29 +0100 | <tomsmeding> | to wit, neither of the options that Liamzee just gave are particularly useful in practice |
2025-03-25 14:23:24 +0100 | <EvanR> | is the real version of StateT s IO a more like lambdabot or more like Liamzee |
2025-03-25 14:22:59 +0100 | <tomsmeding> | that's up to the blog post writer |
2025-03-25 14:22:45 +0100 | <haskellbridge> | <Liamzee> in the case provided by lambdabot, is IO beneath state or is state beneath IO? |
2025-03-25 14:22:22 +0100 | <haskellbridge> | <Liamzee> IO (s -> (a, s)), s -> (IO a, s) |
2025-03-25 14:22:04 +0100 | <EvanR> | IO is the crunchy outer layer of the purely functional program burrito, so it's just that the "stack" is upside down |
2025-03-25 14:21:43 +0100 | <haskellbridge> | <Liamzee> ummmm |
2025-03-25 14:21:23 +0100 | <tomsmeding> | see, if you just write out `s -> IO (a, s)` all is clear |
2025-03-25 14:20:59 +0100 | <lambdabot> | s -> IO (a, s) |
2025-03-25 14:20:59 +0100 | <tomsmeding> | @unmtl StateT s IO a |
2025-03-25 14:20:55 +0100 | <tomsmeding> | EvanR: case in point why burritos are not appropriate here: if you have StateT s IO a, then even though IO is arguably the "inner" monad here, it's actually the IO burrito that contains the State burrito |
2025-03-25 14:20:14 +0100 | <haskellbridge> | <Liamzee> actually, StateT case is sort of confused, no? |
2025-03-25 14:16:51 +0100 | <Leary> | Yes, it's just a little higher-order tweak on the same idea. |
2025-03-25 14:16:14 +0100 | <int-e> | each value can come with its own m |
2025-03-25 14:15:58 +0100 | <int-e> | oh nm |
2025-03-25 14:15:46 +0100 | <EvanR> | the innermost layer of burritos can't be reset |
2025-03-25 14:15:21 +0100 | <tomsmeding> | okay that last was "inner" |
2025-03-25 14:15:10 +0100 | <tomsmeding> | oh I see |
2025-03-25 14:14:57 +0100 | <EvanR> | scroll up lol |
2025-03-25 14:14:55 +0100 | <int-e> | Leary: but I see what you mean |
2025-03-25 14:14:53 +0100 | <tomsmeding> | EvanR: no one said "last" here |
2025-03-25 14:14:52 +0100 | <EvanR> | "innermost" |
2025-03-25 14:14:46 +0100 | <int-e> | Leary: hmm the example looks dubious (where does m come from?) |
2025-03-25 14:14:46 +0100 | <EvanR> | yes but what is last |
2025-03-25 14:14:37 +0100 | <tomsmeding> | I think that's fairly unambiguous |
2025-03-25 14:14:29 +0100 | <tomsmeding> | where StateT is the outer and IO is the inner |
2025-03-25 14:14:27 +0100 | <EvanR> | ok now that's a burrito |
2025-03-25 14:14:17 +0100 | <tomsmeding> | the "inner" and "outer" here referred to monad transformer stacks like StateT s (ExceptT e IO) a |
2025-03-25 14:14:08 +0100 | <EvanR> | due to your interpretation function producing the opposite order of instructions and LTR RTL language issues |
2025-03-25 14:13:39 +0100 | <EvanR> | "last in the stack" could mean anything |
2025-03-25 14:13:32 +0100 | <EvanR> | and in light of yesterday's discussion of stacks |
2025-03-25 14:12:54 +0100 | <tomsmeding> | everyone who seriously suggests burritos are a good monad intuition are actually burritos themselves |
2025-03-25 14:12:30 +0100 | <EvanR> | burritos |
2025-03-25 14:12:27 +0100 | <EvanR> | I have another rule of thumb |
2025-03-25 14:12:20 +0100 | <EvanR> | inner and outer "things"? |
2025-03-25 14:11:08 +0100 | kh0d | (~kh0d@212.200.247.164) |
2025-03-25 14:10:07 +0100 | <Leary> | Some effect systems like 'effectful' are also effectively reviving these "GADT API"; e.g. https://hackage.haskell.org/package/effectful-core-2.5.1.0/docs/Effectful-Dispatch-Dynamic.html |