mono adapt
This commit is contained in:
parent
3e31fe0ea5
commit
2566c53f58
2 changed files with 9 additions and 46 deletions
|
|
@ -47,7 +47,7 @@ monoType (T.TAll _ t) = monoType t
|
||||||
monoType (T.TVar (T.MkTVar i)) = M.TLit "Int"
|
monoType (T.TVar (T.MkTVar i)) = M.TLit "Int"
|
||||||
monoType (T.TLit (T.Ident i)) = M.TLit (Ident i)
|
monoType (T.TLit (T.Ident i)) = M.TLit (Ident i)
|
||||||
monoType (T.TFun t1 t2) = M.TFun (monoType t1) (monoType t2)
|
monoType (T.TFun t1 t2) = M.TFun (monoType t1) (monoType t2)
|
||||||
monoType (T.TData _ _) = error "Not sure what this is"
|
monoType (T.TData (T.Ident n) t) = M.TLit (Ident (n ++ concatMap show t))
|
||||||
|
|
||||||
monoexpt :: T.ExpT -> M.ExpT
|
monoexpt :: T.ExpT -> M.ExpT
|
||||||
monoexpt (e, t) = (monoExpr e, monoType t)
|
monoexpt (e, t) = (monoExpr e, monoType t)
|
||||||
|
|
|
||||||
53
test_program
53
test_program
|
|
@ -1,46 +1,9 @@
|
||||||
data List (a) where {
|
data Bool () where {
|
||||||
Nil : List (a)
|
True : Bool ()
|
||||||
Cons : a -> List (a) -> List (a)
|
False : Bool ()
|
||||||
};
|
};
|
||||||
|
|
||||||
-- data Bool () where {
|
main = case True of {
|
||||||
-- True : Bool ()
|
True => 1;
|
||||||
-- False : Bool ()
|
False => 0;
|
||||||
-- };
|
};
|
||||||
|
|
||||||
-- 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;
|
|
||||||
-- };
|
|
||||||
|
|
||||||
-- 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);
|
|
||||||
|
|
||||||
-- test xs = case xs of {
|
|
||||||
-- 1 => 0;
|
|
||||||
-- lol => 1;
|
|
||||||
-- };
|
|
||||||
|
|
||||||
deepList xs = case xs of {
|
|
||||||
Cons Nil _ => 1 ;
|
|
||||||
_ => 0 ;
|
|
||||||
};
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue