defaultGamma = extend "print" (Forall ["a"] ((IdType "a") ->> VoidType))
$ extend "isEmpty" (Forall ["a"] ((ListType (IdType "a")) ->> BoolType))
$ extend "read" (Forall [] (FuncType CharType))
+ $ extend "1printchar" (Forall [] (CharType ->> VoidType))
+ $ extend "1printint" (Forall [] (IntType ->> VoidType))
+ $ extend "1printbool" (Forall [] (BoolType ->> VoidType))
zero
sem :: AST -> Either [SemError] AST
infer e2 >>= \(s2, t2, e2_) ->
pure (compose s2 s1, TupleType (t1,t2), TupleExpr p (e1_,e2_))
- FunExpr p f args fs = //todo: fix print
+ FunExpr p f args fs =
lookup f >>= \expected ->
let accST = (\(s,ts,es) e->infer e >>= \(s_,et,e_)-> pure (compose s_ s,ts++[et],es++[e_])) in
foldM accST (zero,[],[]) args >>= \(s1, argTs, args_)->