more error messages and better unification
This commit is contained in:
parent
867485be12
commit
56ccd793ac
6 changed files with 110 additions and 110 deletions
62
test_program
62
test_program
|
|
@ -3,41 +3,39 @@ data List (a) where {
|
|||
Cons : a -> List (a) -> List (a)
|
||||
};
|
||||
|
||||
data Bool () where {
|
||||
True : Bool ()
|
||||
False : Bool ()
|
||||
};
|
||||
-- data Bool () where {
|
||||
-- True : Bool ()
|
||||
-- False : Bool ()
|
||||
-- };
|
||||
|
||||
hello_world = Cons 'h' (Cons 'e' (Cons 'l' (Cons 'l' (Cons 'o' (Cons ' ' (Cons 'w' (Cons 'o' (Cons 'r' (Cons 'l' (Cons 'd' Nil)))))))))) ;
|
||||
-- hello_world = Cons 'h' (Cons 'e' (Cons 'l' (Cons 'l' (Cons 'o' (Cons ' ' (Cons 'w' (Cons 'o' (Cons 'r' (Cons 'l' (Cons 'd' Nil)))))))))) ;
|
||||
|
||||
length : List (a) -> Int ;
|
||||
length xs = case xs of {
|
||||
Nil => 0;
|
||||
Cons x xs => length xs;
|
||||
};
|
||||
-- length : List (a) -> Int ;
|
||||
-- length xs = case xs of {
|
||||
-- Nil => 0;
|
||||
-- Cons x xs => length xs;
|
||||
-- };
|
||||
|
||||
head : List (a) -> a ;
|
||||
head xs = case xs of {
|
||||
Cons x xs => x;
|
||||
};
|
||||
-- head : List (a) -> a ;
|
||||
-- head xs = case xs of {
|
||||
-- Cons x xs => x;
|
||||
-- };
|
||||
|
||||
firstIsOne : List (Int) -> Bool () ;
|
||||
firstIsOne xs = case xs of {
|
||||
Cons x xs => case x of {
|
||||
0 => True;
|
||||
_ => case xs of {
|
||||
Cons x xs => False;
|
||||
_ => False;
|
||||
};
|
||||
};
|
||||
_ => False;
|
||||
};
|
||||
|
||||
main = firstIsOne (Cons 1 Nil);
|
||||
|
||||
deepPat xs = case xs of {
|
||||
Cons (Nil) _ => True;
|
||||
_ => False;
|
||||
};
|
||||
-- firstIsOne : List (Int) -> Bool () ;
|
||||
-- firstIsOne xs = case xs of {
|
||||
-- Cons x xs => case x of {
|
||||
-- 0 => True;
|
||||
-- _ => case xs of {
|
||||
-- Cons x xs => False;
|
||||
-- _ => False;
|
||||
-- };
|
||||
-- };
|
||||
-- _ => False;
|
||||
-- };
|
||||
|
||||
-- main = firstIsOne (Cons 1 Nil);
|
||||
|
||||
test xs = case xs of {
|
||||
1 => 0;
|
||||
lol => 1;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue