From: pimjager Date: Fri, 22 Apr 2016 11:21:05 +0000 (+0200) Subject: Added op1Type function X-Git-Url: https://git.martlubbers.net/?a=commitdiff_plain;h=89c18a3f0b801db7b10039bc8b9fea7b21ff1d71;p=cc1516.git Added op1Type function --- diff --git a/sem.icl b/sem.icl index 77e6554..024d7fe 100644 --- a/sem.icl +++ b/sem.icl @@ -76,6 +76,10 @@ op2Type op | elem op [BiPlus, BiMinus, BiTimes, BiDivide, BiMod] | op == BiCons = fresh >>= \t1-> pure (t1 ->> ListType t1 ->> ListType t1) +op1Type :: Op1 -> Infer Type +op1Type UnNegation = pure $ (BoolType ->> BoolType) +op1Type UnMinus = pure $ (IntType ->> IntType) + instance infer Expr where infer (VarExpr _ vd) = undef infer (Op2Expr _ e1 op e2) = case op of