[Haskell-cafe] Rose Tree

Kalman Noel kalman.noel at bluebottle.com
Sun Nov 4 06:06:53 EST 2007


Ryan Bloor:
> Data Tree a = Empty | Leaf a | Node a [(Tree a)]

The Leaf constructor seems superfluous to me.  Any (Leaf x) value is equivalent
to (Node x []).  So I rather just have

    data Tree a = Empty | Node a [Tree a]

which will mean less work for your task of writing processing functions, too.

Kalman

----------------------------------------------------------------------
Get a free email account with anti spam protection.
http://www.bluebottle.com/tag/2



More information about the Haskell-Cafe mailing list