Fix lambda lifter

This commit is contained in:
Martin Fredin 2023-04-29 15:52:37 +02:00
parent df1a5de04a
commit 619242ccaf
6 changed files with 280 additions and 182 deletions

View file

@ -1,11 +1,9 @@
data Maybe () where {
data Maybe () where
Just : Int -> Maybe ()
Nothing : Maybe ()
};
demoFunc x = case x of {
Just x => x + 24;
Nothing => 0;
};
demoFunc x = case x of
Just x => x + 24
Nothing => 0
main = demoFunc Nothing ;
main = demoFunc Nothing

View file

@ -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 ;
};

View file

@ -40,4 +40,4 @@ repeatHelp acc x n = case n of {
-- represents minus one :)
minusOne : Int ;
minusOne = 9223372036854775807 + 9223372036854775807 + 1;
minusOne = 9223372036854775807 + 9223372036854775807 + 1;