
Hi, Am Mittwoch, den 01.02.2017, 10:33 -0500 schrieb Joachim Breitner:
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?
Just did, all looks fine: https://github.com/nomeata/haskell-successors/blob/c1fd614cb0fc3e3b5dbf0338f... Uploaded to http://hackage.haskell.org/package/successors in case someone wants to play with it. 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