[Haskell-cafe] Monad for binary tree data structure

David Barbour dmbarbour at gmail.com
Sat Jul 23 09:33:35 CEST 2011


2011/7/22 Александр <kommunist1917 at mail.ru>

> How can i make Monad type class instance for this tree? And can i make it
> on not?
>

You'll apply 'f' to every node in the tree. You'll need some sensible
mechanism to merge the resulting trees.

You might have an easier time for merging a slightly different tree type:
  Tree a = Leaf a | Node (Tree a) (Tree a)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110723/20b6f34a/attachment.htm>


More information about the Haskell-Cafe mailing list