@@ -56,10 +56,19 @@ metadataModule ifaces modul =
56 program' <- rename initialEnv (program modul)
56 program' <- rename initialEnv (program modul)
57 aliases' <- mapM (third renameType') (aliases modul)
57 aliases' <- mapM (third renameType') (aliases modul)
58 datatypes' <- mapM (third (mapM (second (mapM renameType')))) (datatypes modul)
58 datatypes' <- mapM (third (mapM (second (mapM renameType')))) (datatypes modul)
59+ exports' <- mapM (third renameType') (foreignExports modul)
60+ imports' <- mapM (twoAndFour (rename initialEnv) renameType') (foreignImports modul)
59− return $ modul { program = program', aliases = aliases', datatypes = datatypes' }
61+ return $ modul { program = program'
63+ , datatypes = datatypes'
64+ , foreignExports = exports'
65+ , foreignImports = imports' }
61 second f (a,b) = (,) a `fmap` f b
67 second f (a,b) = (,) a `fmap` f b
62 third f (a,b,c) = (,,) a b `fmap` f c
68 third f (a,b,c) = (,,) a b `fmap` f c
69+ twoAndFour f g (a,b,c,d) = do b' <- f b
63 renameType' =
72 renameType' =
64 Either.either (\err -> Left [P.text err]) return . renameType (replace "type" initialEnv)
73 Either.either (\err -> Left [P.text err]) return . renameType (replace "type" initialEnv)