append :: List a -> List a -> List a append Nil xs = xs append (Cons x xs) xss = Cons x (append xs xss) concat :: List (List a) -> List a concat Nil = Nil concat (Cons x xs) = append x (Main.concat xs) eta :: a -> List a eta x = Cons x Nil mu :: List (List a) -> List a mu = Main.concat instance Monad List where return x = eta x li >>= f = mu (fmap f li)