fixed a substitution bug where ap was incorrectly inferred.
also added cleaner fresh variables
This commit is contained in:
parent
975dd34063
commit
ac43af8110
6 changed files with 287 additions and 194 deletions
35
test_program
35
test_program
|
|
@ -1,9 +1,28 @@
|
|||
data Bool () where {
|
||||
True : Bool ()
|
||||
False : Bool ()
|
||||
};
|
||||
data Maybe (a) where {
|
||||
Nothing : Maybe (a)
|
||||
Just : a -> Maybe (a)
|
||||
};
|
||||
|
||||
main = case True of {
|
||||
True => 1;
|
||||
False => 0;
|
||||
};
|
||||
fmap : (a -> b) -> Maybe (a) -> Maybe (b) ;
|
||||
fmap f ma = case ma of {
|
||||
Nothing => Nothing ;
|
||||
Just a => Just (f a) ;
|
||||
};
|
||||
|
||||
pure : a -> Maybe (a) ;
|
||||
pure x = Just x ;
|
||||
|
||||
ap mf ma = case mf of {
|
||||
Just f => case ma of {
|
||||
Nothing => Nothing;
|
||||
Just a => Just (f a);
|
||||
};
|
||||
Nothing => Nothing;
|
||||
};
|
||||
|
||||
return = pure;
|
||||
|
||||
bind ma f = case ma of {
|
||||
Nothing => Nothing ;
|
||||
Just a => f a ;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue