added more manual tests

This commit is contained in:
sebastianselander 2023-03-22 10:32:22 +01:00
parent 24007313cb
commit 88a4a934b8
6 changed files with 67 additions and 19 deletions

View file

@ -1,8 +1,8 @@
-- double : _Int -> _Int ;
-- double n = n + n;
double : _Int -> _Int ;
double n = n + n;
id : 'a -> 'a ;
id x = x ;
main : ('a -> 'b -> 'c) ;
main = id ;
main : _Int ;
main = id double 5;

10
sample-programs/basic-6 Normal file
View file

@ -0,0 +1,10 @@
data Bool () where {
True : Bool ()
False : Bool ()
};
main : Bool () -> _Int ;
main b = case b of {
False => 0;
True => 0
}

10
sample-programs/basic-7 Normal file
View file

@ -0,0 +1,10 @@
data Bool () where {
True : Bool ()
False : Bool ()
};
ifThenElse : Bool () -> 'a -> 'a -> 'a;
ifThenElse b if else = case b of {
True => if;
False => else
}

24
sample-programs/basic-8 Normal file
View file

@ -0,0 +1,24 @@
data Maybe ('a) where {
Nothing : Maybe ('a)
Just : 'a -> Maybe ('a)
};
fromJust : Maybe ('a) -> 'a ;
fromJust a =
case a of {
Just a => a
};
fromMaybe : 'a -> Maybe ('a) -> 'a ;
fromMaybe a b =
case b of {
Just a => a;
Nothing => a
};
maybe : 'b -> ('a -> 'b) -> Maybe ('a) -> 'b;
maybe b f ma =
case ma of {
Just a => f a;
Nothing => b
}