Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision Last revision Both sides next revision | ||
maybe [2014/09/15 20:14] nikolaj |
maybe [2014/09/15 20:18] nikolaj |
||
---|---|---|---|
Line 4: | Line 4: | ||
data Maybe a = Nothing | Just a | data Maybe a = Nothing | Just a | ||
deriving (Eq, Ord) | deriving (Eq, Ord) | ||
- | |||
- | instance Functor Maybe where | ||
- | fmap _ Nothing = Nothing | ||
- | fmap f (Just a) = Just (f a) | ||
instance Monad Maybe where | instance Monad Maybe where | ||
Line 18: | Line 14: | ||
return = Just | return = Just | ||
fail _ = Nothing | fail _ = Nothing | ||
+ | | ||
+ | -- instance Functor Maybe where | ||
+ | -- fmap _ Nothing = Nothing | ||
+ | -- fmap f (Just a) = Just (f a) | ||
</code> | </code> | ||