+semVarDecl v = pure $ Right v
+//Right v
+//semVarDecl vd=:(VarDecl pos type ident expr) = case unify type expr of // Left e = Left e
+// //TODO ident in de environment
+// Right e = Right $ pure vd
+
+typeOp1 :: Pos Expr Type -> Env Type
+typeOp1 p expr rtype = typeExpr expr >>= \exprtype->case exprtype of
+ Left e = pure $ Left e
+ Right rtype = pure $ Right rtype
+ Right (IdType ident) = putIdent ident rtype >>| pure (Right rtype)
+ Right t = pure $ Left $ UnifyError p rtype t
+
+typeExpr :: Expr -> Env Type
+typeExpr (IntExpr _ _) = pure $ Right IntType
+typeExpr (CharExpr _ _) = pure $ Right CharType
+typeExpr (BoolExpr _ _) = pure $ Right BoolType
+typeExpr (Op1Expr p UnNegation expr) = typeOp1 p expr BoolType
+typeExpr (Op1Expr p UnMinus expr) = typeOp1 p expr IntType
+typeExpr (TupleExpr p (e1, e2)) = typeExpr e1
+ >>= \ete1->typeExpr e2 >>= \ete2->pure (
+ ete1 >>= \te1->ete2 >>= \te2->Right $ TupleType (te1, te2))
+//typeExpr (Op1Expr p UnMinus expr) = typeExpr expr
+// >>= \exprtype->case exprtype of
+// IntType = pure $ Right IntType
+// t = Left $ UnifyError p IntType exprtype
+//typeExpr (Op2Expr Pos Expr Op2 Expr) = undef
+//typeExpr (FunExpr Pos FunCall) = undef
+//typeExpr (EmptyListExpr Pos) = undef
+//typeExpr (VarExpr Pos VarDef) = undef