26 lines
504 B
Text
26 lines
504 B
Text
data Maybe () where {
|
|
Nothing : Maybe ()
|
|
Just : Int -> Maybe ()
|
|
};
|
|
|
|
-- fmap : (Int -> Int) -> Maybe () -> Maybe () ;
|
|
-- fmap f ma = case ma of {
|
|
-- Nothing => Nothing ;
|
|
-- Just a => Just (f a) ;
|
|
-- };
|
|
|
|
main = case (Just 10) of {
|
|
Just a => a ;
|
|
Nothing => 1 ;
|
|
};
|
|
|
|
-- pure : Int -> Maybe () ;
|
|
-- pure x = Just x ;
|
|
--
|
|
-- return = pure;
|
|
--
|
|
-- bind : Maybe () -> (Int -> Maybe ()) -> Maybe () ;
|
|
-- bind ma f = case ma of {
|
|
-- Nothing => Nothing ;
|
|
-- Just a => f a ;
|
|
-- };
|