Friday, December 9, 2011

Monad examples

http://www.haskell.org/haskellwiki/Simple_monad_examples

Just 5 >>= (\ x -> if (x == 0) then fail "zero" else Just (x + 1) )
http://hackage.haskell.org/packages/archive/base/4.4.1.0/doc/html/Data-Maybe.html#t:Maybe
data Maybe a = Nothing | Just a
instance Monad Maybe

No comments:

Post a Comment