===== Maybe ===== ==== Haskell type ==== data Maybe a = Nothing | Just a deriving (Eq, Ord) instance Monad Maybe where (Just x) >>= k = k x Nothing >>= _ = Nothing return = Just fail _ = Nothing -- utility (Just _) >> k = k Nothing >> _ = Nothing instance Functor Maybe where fmap _ Nothing = Nothing fmap f (Just a) = Just (f a) ==== Discussion ==== === Reference === hackage: [[https://hackage.haskell.org/package/base-4.6.0.1/docs/src/Data-Maybe.html#Maybe|Source]] ==== Parents ==== === Element of === [[Monad . Haskell]]