
Hi, I'm sorry to bother everyone again with this simple append' stuff -- below is my revised append' function 1) append' :: [[a]] -> a -> [[a]] 2) append' [] y = [[y]] 3) append' (x:xs) y = 4) case xs of [] -> foldr (:) [y] x 5) (z:zs) -> (init (x:xs)) ++ [(last xs)++[y]] -- to achieve append' [] 1 = [[1]] append' [[1]] 2 = [[1, 2]] append' [[1], [2]] 3 = [[1], [2, 3]] -- and ghc gives the following compile error: p3a.hs:4: Cannot unify the type-signature variable `a' with the type `[a]' Expected type: [a] Inferred type: a In the list element: y In the second argument of `foldr', namely `([y])' make: *** [p3a] Error 1 -- now this is something I _really_ don't understand: -- x is of type [a], [y] is of type [a], and isn't foldr (:) [a] [a] -- perfectly valid?! Much thanx in advance -- Regards, Jerry