リストを定義してmap append concatを実装
data List a = Nil | Cons a (List a) deriving Show
wrap :: a -> List a
wrap x = Cons x Nil
nil :: List a -> Bool
nil Nil = True
nil (Cons x xs) = False
foldL :: (a -> b -> b) -> b -> List a -> b
foldL f e Nil = e
foldL f e (Cons x xs) = f x (foldL f e xs)
mapL :: (a -> b) -> List a -> List b
mapL f Nil = Nil
mapL f (Cons x xs) = Cons (f x) (mapL f xs)
appendL :: List a -> List a -> List a
appendL Nil ys = ys
appendL (Cons x xs) ys = Cons x (appendL xs ys)
concatL :: List (List a) -> List a
concatL Nil = Nil
concatL (Cons (Cons x xs) xss) = appendL (Cons x xs) (concatL xss)
追記 091025
foldLを使って書きなおすという問題だったので
mapL :: (a -> b) -> List a -> List b
mapL f = foldL (Cons . f) Nil
appendL :: List a -> List a -> List a
appendL xs ys = foldL Cons ys xs
concatL :: List (List a) -> List a
concatL xs = foldL appendL Nil