
23 Jul
2011
23 Jul
'11
1:31 a.m.
Hello, I built binary tree with: data Tree a = Empty | Node a (Tree a) (Tree a) deriving (Eq, Ord, Read, Show) How can i make Monad type class instance for this tree? And can i make it on not? i try: instance Monad Tree where return x = Node x Empty Empty Empty >>= f = Empty (Node x Empty Empty) >>= f = f x But i can't make (>>=) for Node x left right. Thank you.