28 lines
639 B
Text
28 lines
639 B
Text
main = head (Cons (sum (repeat 5 9223372036854775807)) Nil); --9223372036854775807
|
|
|
|
-- main = case (bind (fmap (\s . s + 1) (Just 5)) (\s . pure (s + 10))) of {
|
|
-- Just a => a ;
|
|
-- Nothing => minusOne ;
|
|
-- };
|
|
|
|
---- MAYBE MONAD ----
|
|
data Maybe () where {
|
|
Just : Int -> Maybe ()
|
|
Nothing : Maybe ()
|
|
};
|
|
|
|
fmap : (Int -> Int) -> Maybe () -> Maybe () ;
|
|
fmap f m = case m of {
|
|
Just a => pure (f a) ;
|
|
Nothing => Nothing ;
|
|
};
|
|
|
|
pure : Int -> Maybe () ;
|
|
pure x = Just x;
|
|
|
|
-- scombinator not working yet :)
|
|
|
|
bind : Maybe () -> (Int -> Maybe ()) -> Maybe () ;
|
|
bind x f = case x of {
|
|
Just x => f x ;
|
|
Nothing => Nothing ;
|