Fix lambda lifter
This commit is contained in:
parent
df1a5de04a
commit
619242ccaf
6 changed files with 280 additions and 182 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 ;
|
||||
};
|
||||
|
|
@ -40,4 +40,4 @@ repeatHelp acc x n = case n of {
|
|||
|
||||
-- represents minus one :)
|
||||
minusOne : Int ;
|
||||
minusOne = 9223372036854775807 + 9223372036854775807 + 1;
|
||||
minusOne = 9223372036854775807 + 9223372036854775807 + 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue