[Haskell-cafe] Monad for binary tree data structure
Maciej Marcin Piechotka
uzytkownik2 at gmail.com
Sat Jul 23 18:57:14 CEST 2011
> 2) One possibility is just have it being (Node x _ _) >>= f = f x
>
It does not follow monad laws (right identity to be more precise):
(Node 1 (Node 2 Empty Empty) Empty) >>= return ≡
return 1 ≡
Node 1 Empty Empty
≠
(Node 1 (Node 2 Empty Empty) Empty)
Regards
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110723/7fc72c1e/attachment.pgp>
More information about the Haskell-Cafe
mailing list