@@ -24,20 +24,38 @@ import qualified Elm.Compiler.Version as Compiler
24import qualified Reporting.Annotation as A
24import qualified Reporting.Annotation as A
27-- HELPFUL TYPE ALIASES
28-- HELPFUL TYPE ALIASES
29−type Interfaces = Map.Map Name.Canonical Interface
32+ Map.Map Name.Canonical Interface
31−type Types = Map.Map String Type.Canonical
36+ Map.Map String Type.Canonical
32−type Aliases = Map.Map String ([String], Type.Canonical)
40+ Map.Map String ([String], Type.Canonical)
33−type ADTs = Map.Map String (AdtInfo String)
44+ Map.Map String (AdtInfo String)
48+ ( [String], [(v, [Type.Canonical])] )
52+ ( Var.Canonical, AdtInfo Var.Canonical )
35−type AdtInfo v = ( [String], [(v, [Type.Canonical])] )
36−type CanonicalAdt = (Var.Canonical, AdtInfo Var.Canonical)
41type SourceModule =
59type SourceModule =
@@ -62,7 +80,8 @@ type Optimized =
62 Module Docs.Centralized [Name.Raw] [Var.Value] (Body [Optimized.Def])
80 Module Docs.Centralized [Name.Raw] [Var.Value] (Body [Optimized.Def])
65−data Module docs imports exports body = Module
83+data Module docs imports exports body =
66 { name :: Name.Canonical
85 { name :: Name.Canonical
67 , path :: FilePath
86 , path :: FilePath
68 , docs :: A.Located (Maybe docs)
87 , docs :: A.Located (Maybe docs)
@@ -72,7 +91,8 @@ data Module docs imports exports body = Module
75−data Body expr = Body
94+data Body expr =
76 { program :: expr
96 { program :: expr
77 , types :: Types
97 , types :: Types
78 , fixities :: [(Decl.Assoc, Int, String)]
98 , fixities :: [(Decl.Assoc, Int, String)]
@@ -82,10 +102,13 @@ data Body expr = Body
85-- HEADERS
106-- HEADERS
87{-| Basic info needed to identify modules and determine dependencies. -}
109{-| Basic info needed to identify modules and determine dependencies. -}
88−data Header imports = Header
110+data Header imports =
89 { _name :: Name.Raw
112 { _name :: Name.Raw
90 , _docs :: A.Located (Maybe String)
113 , _docs :: A.Located (Maybe String)
91 , _exports :: Var.Listing (A.Located Var.Value)
114 , _exports :: Var.Listing (A.Located Var.Value)
@@ -93,24 +116,30 @@ data Header imports = Header
96-- IMPORTs
120-- IMPORTs
98type UserImport = A.Located (Name.Raw, ImportMethod)
123type UserImport = A.Located (Name.Raw, ImportMethod)
101type DefaultImport = (Name.Raw, ImportMethod)
126type DefaultImport = (Name.Raw, ImportMethod)
104−data ImportMethod = ImportMethod
129+data ImportMethod =
105 { alias :: Maybe String
131 { alias :: Maybe String
106 , exposedVars :: !(Var.Listing Var.Value)
132 , exposedVars :: !(Var.Listing Var.Value)
110-- INTERFACES
137-- INTERFACES
112{-| Key facts about a module, used when reading info from .elmi files. -}
140{-| Key facts about a module, used when reading info from .elmi files. -}
113−data Interface = Interface
141+data Interface =
114 { iVersion :: Package.Version
143 { iVersion :: Package.Version
115 , iPackage :: Package.Name
144 , iPackage :: Package.Name
116 , iExports :: [Var.Value]
145 , iExports :: [Var.Value]
@@ -125,29 +154,34 @@ data Interface = Interface
126toInterface :: Package.Name -> Optimized -> Interface
155toInterface :: Package.Name -> Optimized -> Interface
127toInterface pkgName modul =
156toInterface pkgName modul =
128− let body' = body modul in
159+ body modul
129 Interface
161 Interface
130− { iVersion = Compiler.version
162+ { iVersion = Compiler.version
131− , iPackage = pkgName
163+ , iPackage = pkgName
132− , iExports = exports modul
164+ , iExports = exports modul
133− , iTypes = types body'
165+ , iTypes = types body'
134− , iImports = imports modul
166+ , iImports = imports modul
135− , iAdts = datatypes body'
167+ , iAdts = datatypes body'
136− , iAliases = aliases body'
168+ , iAliases = aliases body'
137− , iFixities = fixities body'
169+ , iFixities = fixities body'
138− , iPorts = ports body'
170+ , iPorts = ports body'
142instance Binary Interface where
174instance Binary Interface where
143− get = Interface <$> get <*> get <*> get <*> get <*> get <*> get <*> get <*> get <*> get
176+ Interface <$> get <*> get <*> get <*> get <*> get <*> get <*> get <*> get <*> get
144− put modul = do
178+ put modul =
145− put (iVersion modul)
179+ do put (iVersion modul)
146− put (iPackage modul)
180+ put (iPackage modul)
147− put (iExports modul)
181+ put (iExports modul)
148− put (iTypes modul)
182+ put (iTypes modul)
149− put (iImports modul)
183+ put (iImports modul)
150− put (iAdts modul)
184+ put (iAdts modul)
151− put (iAliases modul)
185+ put (iAliases modul)
152− put (iFixities modul)
186+ put (iFixities modul)
153− put (iPorts modul)
187+ put (iPorts modul)