Add signature of inferred bind to allow some mutually defined definitions
This commit is contained in:
parent
a37a52d9f8
commit
bbe0d77a19
4 changed files with 111 additions and 28 deletions
|
|
@ -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;
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue