_ = Left $ SanityError p "main has to return Void")
isNiceMain _ = pure ()
+unfoldLambda :: [FunDecl] -> Typing [FunDecl]
+unfoldLambda [fd:fds] = unf_ fd >>= \fds1->
+ unfoldLambda fds2 >>= \fds2->
+ pure $ fds1 ++ fds2
+where
+ unf_ fd=:(FunDecl _ _ _ _ vds stmts) =
+ mapM_ unfv_ vds >>= \fds1->
+ mapM_ unfs_ stmts >>= \fds2->
+ pure [fd:fds] ++ fds2
+ unfv_ :: Typing [FunDecl]
+ unfv_ (VarDecl _ _ _ e) = abort ""
+ unfs_ _ = abort ""
+
class Typeable a where
ftv :: a -> [TVar]
subst :: Substitution a -> a
infer e2 >>= \(s2, t2, e2_) ->
pure (compose s2 s1, TupleType (t1,t2), TupleExpr p (e1_,e2_))
- LambdaExpr _ _ _ = liftT $ Left $ Error "PANIC: lambdas should be tasnformed"
+ LambdaExpr _ _ _ = liftT $ Left $ Error "PANIC: lambdas should be Unfolded"
FunExpr p f args fs =
lookup f >>= \expected ->