Mercurial > hg > Papers > 2015 > atton-thesis
view src/list_monad.hs @ 42:4cc65012412f
Add proofs of functor-laws on delta
author | Yasutaka Higa <e115763@ie.u-ryukyu.ac.jp> |
---|---|
date | Fri, 13 Feb 2015 17:13:23 +0900 |
parents | fc44782929a7 |
children |
line wrap: on
line source
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)