[Haskell-cafe] Rose Tree

Yitzchak Gale gale at sefer.org
Sun Nov 4 05:14:34 EST 2007

Hi Ryan,

>  I need help... I am having trouble with rose trees.

You've come to the right place! If this is homework,
please look at:


(But have patience. haskell.org seems to be bogged down
at the moment, probably because of the release within
the past few hours of a new version of the GHC compiler.)

>  Data Tree a = Empty | Leaf a | Node a [(Tree a)]
>  example :: Tree (String, String)
>  What I want to do is create two functions that return either the children
> or parents of a given input, here a String.
>   String -> Tree -> [String]         I think

Good idea to start with a type signature. Sounds like
you want something more general than just String,

Try to write out the exact type signature you want.
When you've got that, give a try at writing the functions
If you get stuck at any point, send us what you've
got so far.

Good luck,

More information about the Haskell-Cafe mailing list