From 5f7fcaa92dc7412ff5bbca18749ffacd6be247ae Mon Sep 17 00:00:00 2001 From: Evan Czaplicki Date: Sun, 8 Sep 2013 12:26:07 -0700 Subject: [PATCH] Fix issue #241 --- compiler/Transform/Canonicalize.hs | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/compiler/Transform/Canonicalize.hs b/compiler/Transform/Canonicalize.hs index 5c8d0ad..a6c7e42 100644 --- a/compiler/Transform/Canonicalize.hs +++ b/compiler/Transform/Canonicalize.hs @@ -56,10 +56,19 @@ metadataModule ifaces modul = program' <- rename initialEnv (program modul) aliases' <- mapM (third renameType') (aliases modul) datatypes' <- mapM (third (mapM (second (mapM renameType')))) (datatypes modul) - return $ modul { program = program', aliases = aliases', datatypes = datatypes' } + exports' <- mapM (third renameType') (foreignExports modul) + imports' <- mapM (twoAndFour (rename initialEnv) renameType') (foreignImports modul) + return $ modul { program = program' + , aliases = aliases' + , datatypes = datatypes' + , foreignExports = exports' + , foreignImports = imports' } where second f (a,b) = (,) a `fmap` f b third f (a,b,c) = (,,) a b `fmap` f c + twoAndFour f g (a,b,c,d) = do b' <- f b + d' <- g d + return (a,b',c,d') renameType' = Either.either (\err -> Left [P.text err]) return . renameType (replace "type" initialEnv)