Fix lambda lifter
This commit is contained in:
parent
df1a5de04a
commit
619242ccaf
6 changed files with 280 additions and 182 deletions
|
|
@ -1,26 +0,0 @@
|
|||
main = case f (Just 10) of {
|
||||
Just a => a ;
|
||||
Nothing => 0 ;
|
||||
};
|
||||
|
||||
f x = bind (fmap (\s . s + 1) x) (\s . pure (s + 10)) ;
|
||||
|
||||
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;
|
||||
|
||||
bind : Maybe () -> (Int -> Maybe ()) -> Maybe () ;
|
||||
bind x f = case x of {
|
||||
Just x => f x ;
|
||||
Nothing => Nothing ;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue