1{-# OPTIONS_GHC -Wall #-}
2{-# LANGUAGE OverloadedStrings #-}
4 ( Header(..), HeaderDecl(..), defaultHeaderDecl
7 , Source, SourceInfo(..), SourceTag(..), SourceSettings, emptySettings
9 , Canonical, Optimized, Info(..)
11 , UserImport, DefaultImport, ImportMethod(..)
15 , Unions, UnionInfo, CanonicalUnion
17 , Interfaces, Interface(..), toInterface, privatize
22import qualified Data.Map as Map
23import Data.Text (Text)
25import qualified AST.Declaration as Decl
26import qualified AST.Effects as Effects
27import qualified AST.Exposing as Exposing
28import qualified AST.Expression.Canonical as Canonical
29import qualified AST.Expression.Optimized as Optimized
30import qualified AST.Module.Name as Name
31import qualified AST.Type as Type
32import qualified AST.Variable as Var
33import qualified Docs.AST as Docs
34import qualified Reporting.Annotation as A
35import qualified Reporting.Region as R
42{-| Basic info needed to identify modules and determine dependencies. -}
45 { _decl :: Maybe HeaderDecl
54 , _exports :: Exposing.Raw
55 , _settings :: SourceSettings
56 , _docs :: A.Located (Maybe Text)
60defaultHeaderDecl :: HeaderDecl
64 noDocs = A.at zero zero Nothing
66 HeaderDecl Normal "Main" Exposing.Open emptySettings noDocs
75 { name :: Name.Canonical
87 , srcSettings :: SourceSettings
88 , srcDocs :: A.Located (Maybe Text)
89 , srcExports :: Exposing.Raw
90 , srcImports :: [UserImport]
91 , srcDecls :: [Decl.Source]
102 A.Located [(A.Located Text, A.Located Text)]
105emptySettings :: SourceSettings
107 A.A (error "region of empty settings should not be needed") []
116 { validDocs :: A.Located (Maybe Text)
117 , validExports :: Exposing.Raw
118 , validImports :: ([DefaultImport], [UserImport])
119 , validDecls :: Decl.Valid
120 , validEffects :: Effects.Raw
125 Module (Info Canonical.Expr)
129 Module (Info [(Text, Optimized.Decl)])
136type UserImport = A.Located (A.Located Name.Raw, ImportMethod)
139type DefaultImport = (Name.Raw, ImportMethod)
144 { alias :: Maybe Text
145 , exposedVars :: !Exposing.Raw
150-- LATE PHASE MODULE INFORMATION
155 { docs :: A.Located (Maybe Docs.Centralized)
156 , exports :: Exposing.Canonical
157 , imports :: [Name.Raw]
160 , fixities :: [Decl.Infix]
163 , effects :: Effects.Canonical
168 Map.Map Text Type.Canonical
172 Map.Map Text ([Text], Type.Canonical)
176 Map.Map Text (UnionInfo Text)
180 ( [Text], [(v, [Type.Canonical])] )
184 ( Var.Canonical, UnionInfo Var.Canonical )
192 Map.Map Name.Canonical Interface
195{-| Key facts about a module, used when reading info from .elmi files. -}
198 { iExports :: Exposing.Canonical
199 , iImports :: [Name.Raw] -- TODO perhaps use this to crawl faster
202 , iAliases :: Aliases
203 , iFixities :: [Decl.Infix]
207toInterface :: Optimized -> Interface
208toInterface (Module _ myInfo) =
210 { iExports = exports myInfo
211 , iImports = imports myInfo
212 , iTypes = types myInfo
213 , iUnions = unions myInfo
214 , iAliases = aliases myInfo
215 , iFixities = fixities myInfo
219privatize :: Interface -> Maybe Interface
220privatize (Interface _ _ _ myUnions myAliases _) =
221 if Map.null myUnions && Map.null myAliases then
226 { iExports = Exposing.nothing
230 , iAliases = myAliases
235instance Binary Interface where
237 Interface <$> get <*> get <*> get <*> get <*> get <*> get
240 do put (iExports modul)
245 put (iFixities modul)
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list