[Haskell-cafe] Re: Leaves of a Tree

Neil Mitchell ndmitchell at gmail.com
Thu Feb 22 06:02:35 EST 2007

Hi Chad,

> I think this idea is better than what I had suggested, but as it
> stands it doesn't typecheck. Did you mean something like this?

Yep, just the type signature was wrong :)

> leaves :: Tree -> [Int]
> leaves = f []
>   where
>       f rest (Leaf n) = n : rest
>       f rest (Branch l r) = f (f rest r) l



More information about the Haskell-Cafe mailing list