@@ -42,19 +42,21 @@ type Interfaces = Map.Map String ModuleInterface
42type ADT = (String, [String], [(String,[Type])])
42type ADT = (String, [String], [(String,[Type])])
44data ModuleInterface = ModuleInterface {
44data ModuleInterface = ModuleInterface {
45− iTypes :: Map.Map String Type,
45+ iTypes :: Map.Map String Type,
46− iAdts :: [ADT]
46+ iAdts :: [ADT],
47+ iAliases :: [(String, [String], Type)]
47} deriving Show
48} deriving Show
49instance Binary ModuleInterface where
50instance Binary ModuleInterface where
50− put modul = put (iTypes modul) >> put (iAdts modul)
51+ put modul = put (iTypes modul) >> put (iAdts modul) >> put (iAliases modul)
51− get = ModuleInterface <$> get <*> get
52+ get = ModuleInterface <$> get <*> get <*> get
54canonicalize :: String -> [ImportMethod] -> ModuleInterface -> ModuleInterface
55canonicalize :: String -> [ImportMethod] -> ModuleInterface -> ModuleInterface
55canonicalize prefix importMethods interface =
56canonicalize prefix importMethods interface =
56 ModuleInterface { iTypes = Map.unions (map iTypes ifaces)
57 ModuleInterface { iTypes = Map.unions (map iTypes ifaces)
57− , iAdts = concatMap iAdts ifaces }
58+ , iAdts = concatMap iAdts ifaces
59+ , iAliases = concatMap iAliases ifaces }
59 ifaces = map (canonicalizeHelp prefix interface) importMethods
61 ifaces = map (canonicalizeHelp prefix interface) importMethods
@@ -63,7 +65,8 @@ canonicalizeHelp :: String -> ModuleInterface -> ImportMethod -> ModuleInterface
63canonicalizeHelp prefix interface importMethod =
65canonicalizeHelp prefix interface importMethod =
64 ModuleInterface {
66 ModuleInterface {
65 iTypes = renameNames $ Map.map (renameType rename) (iTypes interface),
67 iTypes = renameNames $ Map.map (renameType rename) (iTypes interface),
66− iAdts = map renameADT (iAdts interface)
68+ iAdts = map renameADT (iAdts interface),
69+ iAliases = iAliases interface
69 addPrefix name = prefix ++ "." ++ name
72 addPrefix name = prefix ++ "." ++ name