
Hi, David wrote:
How about this?
hd (OneStep x xs) = x
instance Monad OneStep where OneStep x xs >>= f = OneStep y (map (hd . f) xs ++ ys) where OneStep y ys = f x
Not sure if it’s good for anything, but it seems valid and consistent based on a preliminary investigation.
Yes, this looks reasonable. Did you happen to already work through the monad laws? Am Mittwoch, den 01.02.2017, 09:34 +0200 schrieb Oleg Grenrus:
These instances are quite similar to
https://github.com/ambiata/disorder.hs/blob/ce9ffc1139e32eaa9b82a1a6e 2cfeb914d3f705c/disorder-jack/src/Disorder/Jack/Tree.hs#L62-L82
well spotted. It is indeed the same idea, with my Succs (or OneStep or whatever name is most appropriate) modeling only one step, and the tree modeling, well, a whole tree. Also thanks for pointing out disorder-jack, that looks like a nice approach! Greetings, Joachim -- Joachim “nomeata” Breitner mail@joachim-breitner.de • https://www.joachim-breitner.de/ XMPP: nomeata@joachim-breitner.de • OpenPGP-Key: 0xF0FBF51F Debian Developer: nomeata@debian.org