@@ -13,7 +13,7 @@ module AST.Module
14 , Unions, UnionInfo, CanonicalUnion
14 , Unions, UnionInfo, CanonicalUnion
16− , Interfaces, Interface(..), toInterface
16+ , Interfaces, Interface(..), toInterface, privatize
@@ -29,8 +29,6 @@ import qualified AST.Module.Name as Name
29import qualified AST.Type as Type
29import qualified AST.Type as Type
30import qualified AST.Variable as Var
30import qualified AST.Variable as Var
31import qualified Docs.AST as Docs
31import qualified Docs.AST as Docs
32−import qualified Elm.Package as Package
33−import qualified Elm.Compiler.Version as Compiler
34import qualified Reporting.Annotation as A
32import qualified Reporting.Annotation as A
35import qualified Reporting.Region as R
33import qualified Reporting.Region as R
@@ -191,10 +189,8 @@ type Interfaces =
191{-| Key facts about a module, used when reading info from .elmi files. -}
189{-| Key facts about a module, used when reading info from .elmi files. -}
192data Interface =
190data Interface =
193 Interface
191 Interface
194− { iVersion :: Package.Version
195− , iPackage :: Package.Name
196− , iExports :: [Var.Value]
192+ { iExports :: [Var.Value]
197− , iImports :: [Name.Raw]
193+ , iImports :: [Name.Raw] -- TODO perhaps use this to crawl faster
198 , iTypes :: Types
194 , iTypes :: Types
199 , iUnions :: Unions
195 , iUnions :: Unions
200 , iAliases :: Aliases
196 , iAliases :: Aliases
@@ -202,16 +198,14 @@ data Interface =
205−toInterface :: Package.Name -> Optimized -> Interface
201+toInterface :: Optimized -> Interface
206−toInterface pkgName modul =
202+toInterface modul =
209 info modul
205 info modul
211 Interface
207 Interface
212− { iVersion = Compiler.version
213− , iPackage = pkgName
214− , iExports = exports myInfo
208+ { iExports = exports myInfo
215 , iImports = imports myInfo
209 , iImports = imports myInfo
216 , iTypes = types myInfo
210 , iTypes = types myInfo
217 , iUnions = unions myInfo
211 , iUnions = unions myInfo
@@ -220,14 +214,28 @@ toInterface pkgName modul =
217+privatize :: Interface -> Maybe Interface
218+privatize (Interface _ _ _ myUnions myAliases _) =
219+ if Map.null myUnions && Map.null myAliases then
226+ , iTypes = Map.empty
227+ , iUnions = myUnions
228+ , iAliases = myAliases
223instance Binary Interface where
233instance Binary Interface where
225− Interface <$> get <*> get <*> get <*> get <*> get <*> get <*> get <*> get
235+ Interface <$> get <*> get <*> get <*> get <*> get <*> get
227 put modul =
237 put modul =
228− do put (iVersion modul)
229− put (iPackage modul)
230− put (iExports modul)
238+ do put (iExports modul)
231 put (iImports modul)
239 put (iImports modul)
232 put (iTypes modul)
240 put (iTypes modul)
233 put (iUnions modul)
241 put (iUnions modul)