Add signature of inferred bind to allow some mutually defined definitions

This commit is contained in:
Martin Fredin 2023-03-30 12:35:47 +02:00
parent a37a52d9f8
commit bbe0d77a19
4 changed files with 111 additions and 28 deletions

View file

@ -1,15 +1,20 @@
data forall a. List (a) where {
Nil : List (a)
Cons : a -> List (a) -> List (a)
data Bool () where {
True : Bool ()
False : Bool ()
};
length : forall c. List (List (c)) -> Int;
length = \list. case list of {
Cons x xs => 1 + length xs;
-- Nil => 0;
-- Cons x (Cons y Nil) => 2;
even : Int -> Bool ();
even x = not (odd x) ;
odd x = not (even x) ;
not x = case x of {
True => False;
False => True;
};
f = g;
g = f;

View file

@ -1,9 +1,9 @@
data True() where {
True: True()
data Bool () where {
True : Bool ()
False : Bool ()
};
toBool = case 0 of {
0 => False;
_ => True;
};
main: Int;
main =
case True of {
True => 1;
_ => 0;
};