Maybe made lets work in monomorphizer 🙃
This commit is contained in:
parent
eba91ec646
commit
e70eae776a
1 changed files with 12 additions and 1 deletions
|
|
@ -253,7 +253,18 @@ morphExp expectedType exp = case exp of
|
|||
-- New bind to process
|
||||
newBindName <- morphBind expectedType bind'
|
||||
return $ M.EVar (coerce newBindName)
|
||||
T.ELet (T.Bind{}) _ -> error "lets not possible yet"
|
||||
T.ELet (T.Bind (identB, tB) args (expB, tExpB)) (exp, tExp) ->
|
||||
if length args > 0 then error "only constants in lets allowed"
|
||||
else do
|
||||
tB' <- getMonoFromPoly tB
|
||||
tExpB' <- getMonoFromPoly tExpB
|
||||
tExp' <- getMonoFromPoly tExp
|
||||
expB' <- morphExp tExpB' expB
|
||||
exp' <- morphExp tExp' exp
|
||||
return $ M.ELet (M.Bind (identB, tB') [] (expB', tExpB')) (exp', tExp')
|
||||
|
||||
-- ELet (Bind' t) (ExpT' t)
|
||||
-- Bind (Id' t) [Id' t] (ExpT' t)
|
||||
|
||||
-- | Monomorphizes case-of branches.
|
||||
morphBranch :: T.Branch -> EnvM (Maybe M.Branch)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue