category-theory-presentation/categories/30_How/200_Monads/140_Example_List.md
2013-02-28 16:49:12 +01:00

388 B
Raw Blame History

Example: List

  • [] :: * -> * an Endofunctor
  • \(⊙:M×M→M\) a nat. trans. (join :: M (M a) -> M a)
  • \(η:I→M\) a nat. trans.
-- In Haskell ⊙ is "join" in "Control.Monad"
join :: [[a]] -> [a]
join = concat

-- In Haskell the "return" function (unfortunate name)
η :: a -> [a]
η x = [x]