Fixed small bug in monomorphizer
This commit is contained in:
parent
c2bf6312f6
commit
a23269f907
2 changed files with 6 additions and 5 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
const x y = x;
|
const x y = x
|
||||||
|
|
||||||
f x = (const x 'c');
|
f x = (const x 'c')
|
||||||
|
|
||||||
|
main = f 5
|
||||||
|
|
||||||
main = f 5;
|
|
||||||
|
|
|
||||||
|
|
@ -120,7 +120,7 @@ getMonoFromPoly t = do env <- ask
|
||||||
-- Returns the annotated bind name.
|
-- Returns the annotated bind name.
|
||||||
-- TODO: Redundancy? btype and t should always be the same.
|
-- TODO: Redundancy? btype and t should always be the same.
|
||||||
morphBind :: M.Type -> T.Bind -> EnvM Ident
|
morphBind :: M.Type -> T.Bind -> EnvM Ident
|
||||||
morphBind expectedType b@(T.Bind (Ident _, btype) args (exp, expt)) =
|
morphBind expectedType b@(T.Bind (Ident str, btype) args (exp, expt)) =
|
||||||
local (\env -> env { locals = Set.fromList (map fst args),
|
local (\env -> env { locals = Set.fromList (map fst args),
|
||||||
polys = Map.fromList (mapTypes btype expectedType)
|
polys = Map.fromList (mapTypes btype expectedType)
|
||||||
}) $ do
|
}) $ do
|
||||||
|
|
@ -137,7 +137,7 @@ morphBind expectedType b@(T.Bind (Ident _, btype) args (exp, expt)) =
|
||||||
-- Get monomorphic type sof args
|
-- Get monomorphic type sof args
|
||||||
args' <- mapM convertArg args
|
args' <- mapM convertArg args
|
||||||
addOutputBind $ M.Bind (coerce name', expectedType)
|
addOutputBind $ M.Bind (coerce name', expectedType)
|
||||||
args' (exp', expectedType)
|
args' (exp', expt')
|
||||||
return name'
|
return name'
|
||||||
|
|
||||||
convertArg :: (Ident, T.Type) -> EnvM (Ident, M.Type)
|
convertArg :: (Ident, T.Type) -> EnvM (Ident, M.Type)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue