@@ -13,7 +13,7 @@ module AST.Module
1313 , Aliases
1414 , Unions, UnionInfo, CanonicalUnion
1515
16− , Interfaces, Interface(..), toInterface
16+ , Interfaces, Interface(..), toInterface, privatize
1717 )
1818 where
1919
@@ -29,8 +29,6 @@ import qualified AST.Module.Name as Name
2929import qualified AST.Type as Type
3030import qualified AST.Variable as Var
3131import qualified Docs.AST as Docs
32−import qualified Elm.Package as Package
33−import qualified Elm.Compiler.Version as Compiler
3432import qualified Reporting.Annotation as A
3533import qualified Reporting.Region as R
3634
@@ -191,10 +189,8 @@ type Interfaces =
191189{-| Key facts about a module, used when reading info from .elmi files. -}
192190data Interface =
193191 Interface
194− { iVersion :: Package.Version
195− , iPackage :: Package.Name
196− , iExports :: [Var.Value]
197− , iImports :: [Name.Raw]
192+ { iExports :: [Var.Value]
193+ , iImports :: [Name.Raw] -- TODO perhaps use this to crawl faster
198194 , iTypes :: Types
199195 , iUnions :: Unions
200196 , iAliases :: Aliases
@@ -202,16 +198,14 @@ data Interface =
202198 }
203199
204200
205−toInterface :: Package.Name -> Optimized -> Interface
206−toInterface pkgName modul =
201+toInterface :: Optimized -> Interface
202+toInterface modul =
207203 let
208204 myInfo =
209205 info modul
210206 in
211207 Interface
212− { iVersion = Compiler.version
213− , iPackage = pkgName
214− , iExports = exports myInfo
208+ { iExports = exports myInfo
215209 , iImports = imports myInfo
216210 , iTypes = types myInfo
217211 , iUnions = unions myInfo
@@ -220,14 +214,28 @@ toInterface pkgName modul =
220214 }
221215
222216
217+privatize :: Interface -> Maybe Interface
218+privatize (Interface _ _ _ myUnions myAliases _) =
219+ if Map.null myUnions && Map.null myAliases then
220+ Nothing
221+
222+ else
223+ Just $ Interface
224+ { iExports = []
225+ , iImports = []
226+ , iTypes = Map.empty
227+ , iUnions = myUnions
228+ , iAliases = myAliases
229+ , iFixities = []
230+ }
231+
232+
223233instance Binary Interface where
224234 get =
225− Interface <$> get <*> get <*> get <*> get <*> get <*> get <*> get <*> get
235+ Interface <$> get <*> get <*> get <*> get <*> get <*> get
226236
227237 put modul =
228− do put (iVersion modul)
229− put (iPackage modul)
230− put (iExports modul)
238+ do put (iExports modul)
231239 put (iImports modul)
232240 put (iTypes modul)
233241 put (iUnions modul)