
4 Jul
2004
4 Jul
'04
9 a.m.
I want to build a binary tree where each leaf is a string of "L" and "R" defining their position from the top This should be done without context isn't it? data Tree a = Fork (Tree a) (Tree a) | Leaf a deriving Show t =Leaf "" treeGrower :: Tree a -> Tree a treeGrower (Leaf a )= treeGrower (Fork (Leaf (a++"1")) (Leaf (a++"2"))) treeGrower (Fork l r) = Fork (treeGrower l) (treeGrower r) ghci says: Cannot unify the type-signature variable `a' with the type `[a1]' Expected type: [a1] Inferred type: a In the first argument of `(++)', namely `a' In the first argument of `Leaf', namely `(a ++ "1")' I don't get it.........