> Rather than using fmap, why not use gmap in GHC. > Using an appropriate generic traversal scheme, > say listify, all the code you write is the > following expression: > > listify (const True) mytree :: [Int] > > if you are looking for all the Ints in > mytree = Fork (Leaf 42) (Fork (Leaf 88) (Leaf 37)) > So this would give you [42,88,37].
What happens if the tree contains additional integers to record, say, balancing information. The information a functor provides is vital here. Take as the simplest example newtype Weighted a = WithWeight (Int, a) Without the functor definition there is no way to distinguish the two Ints in Weighted Int. Cheers, Ralf _______________________________________________ Haskell mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell