2025/02/03

Newest at the top

2025-02-03 23:53:12 +0100gorignak(~gorignak@user/gorignak) gorignak
2025-02-03 23:52:57 +0100 <ncf> you can also emulate local using state (just update the state before and restore it after), so i guess there's a bit more structure here
2025-02-03 23:52:41 +0100gorignak(~gorignak@user/gorignak) (Quit: quit)
2025-02-03 23:51:27 +0100 <ncf> (well, "m is a submonad of n" = "m embeds into n")
2025-02-03 23:51:17 +0100alfiee(~alfiee@user/alfiee) alfiee
2025-02-03 23:50:37 +0100 <ncf> oh no the definition just says monic, so embedding = submonad
2025-02-03 23:49:32 +0100 <ncf> "state retracts onto reader" i guess
2025-02-03 23:49:06 +0100 <ncf> i guess they mean something different; they also require a left inverse
2025-02-03 23:47:52 +0100 <ncf> https://leventerkok.github.io/papers/erkok-thesis.pdf says embeddings instead of proper submonads (see ยง4.6)
2025-02-03 23:47:07 +0100 <tomsmeding> oh right, preservation of pure and join is sufficient, then you automatically preserve equations on the monad operations in the domain
2025-02-03 23:46:32 +0100 <ncf> https://hackage.haskell.org/package/mmorph-1.2.0/docs/Control-Monad-Morph.html
2025-02-03 23:46:21 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 246 seconds)
2025-02-03 23:46:18 +0100 <ncf> yes (well i just mean it's not invertible)
2025-02-03 23:45:56 +0100 <ncf> preserves the operations (pure and join)
2025-02-03 23:45:54 +0100 <tomsmeding> and does the "proper" in "proper submonad" mean that said monad morphism is not surjective?
2025-02-03 23:45:13 +0100 <tomsmeding> "monad morphism" meaning "preserves the equations"? (excuse my ignorance)
2025-02-03 23:44:51 +0100 <ncf> namely \(Reader f) -> State (\x -> (f x, x))
2025-02-03 23:44:32 +0100 <ncf> it means there's an injective monad morphism from Reader s to State s
2025-02-03 23:43:46 +0100 <tomsmeding> proper subset
2025-02-03 23:43:41 +0100 <tomsmeding> does that mean "you have a subset of the operations at your disposal, and they obey the same equations as they did in State"?
2025-02-03 23:43:01 +0100gorignak(~gorignak@user/gorignak) gorignak
2025-02-03 23:42:54 +0100 <ncf> reader is a proper submonad of state
2025-02-03 23:42:30 +0100gorignak(~gorignak@user/gorignak) (Quit: quit)
2025-02-03 23:41:50 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn
2025-02-03 23:39:55 +0100 <tomsmeding> it really is more powerful
2025-02-03 23:39:50 +0100 <tomsmeding> a Reader traversal of a tree can be done in parallel; a Stateful traversal cannot
2025-02-03 23:39:20 +0100 <tomsmeding> if so, then yes
2025-02-03 23:39:07 +0100 <tomsmeding> does not reset the state, you mean?
2025-02-03 23:38:45 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) (Ping timeout: 244 seconds)
2025-02-03 23:35:55 +0100ljdarj1ljdarj
2025-02-03 23:35:54 +0100ljdarj(~Thunderbi@user/ljdarj) (Ping timeout: 265 seconds)
2025-02-03 23:35:10 +0100 <dminuoso> "backwards" in the sense that backtracking does not reset
2025-02-03 23:35:01 +0100 <dminuoso> oh right
2025-02-03 23:34:48 +0100 <tomsmeding> or use State
2025-02-03 23:34:46 +0100 <tomsmeding> if you want to do something with the leaves of a tree dependent on the how many'th leaf that is, you'll have to manually thread through a counter
2025-02-03 23:34:19 +0100tnt2tnt1
2025-02-03 23:34:19 +0100tnt1(~Thunderbi@user/tnt1) (Ping timeout: 252 seconds)
2025-02-03 23:34:10 +0100 <tomsmeding> Reader's `local` modifies the "state" when going downwards
2025-02-03 23:34:09 +0100merijn(~merijn@host-vr.cgnat-g.v4.dfn.nl) merijn
2025-02-03 23:33:53 +0100 <tomsmeding> (speaking about a normal recursive function over a (possibly virtual) tree data structure here, but the same applies to a cata)
2025-02-03 23:33:27 +0100 <tomsmeding> towards the root of the recursion tree
2025-02-03 23:33:16 +0100 <dminuoso> upwards in what sense?
2025-02-03 23:33:06 +0100 <tomsmeding> State allows you to propagate state _upwards_ too
2025-02-03 23:32:56 +0100tnt2(~Thunderbi@user/tnt1) tnt1
2025-02-03 23:32:52 +0100ljdarj1(~Thunderbi@user/ljdarj) ljdarj
2025-02-03 23:32:50 +0100gorignak(~gorignak@user/gorignak) gorignak
2025-02-03 23:32:47 +0100 <dminuoso> It seems almost as if state is just slightly more convenient in that you dont need to indent subsequent expressions into local, and that difference largely disappears in recursion schemes
2025-02-03 23:32:33 +0100 <geekosaur> just because it was in the original MTL paper, I think
2025-02-03 23:32:19 +0100gorignak(~gorignak@user/gorignak) (Quit: quit)
2025-02-03 23:31:18 +0100 <dminuoso> Well, it made me ponder about why we have State in the first place.