2 % (c) The AQUA Project, Glasgow University, 1993-2000
4 \section[CmCompile]{Compiler for GHCI}
7 module CmCompile ( cmCompile,
8 ModDetails, -- abstract
11 HST, -- not abstract (CM needs to see it)
17 #include "HsVersions.h"
19 import CmLink ( Linkable )
20 import Outputable ( SDoc )
21 import CmFind ( Finder )
22 import CmSummarise ( ModSummary )
23 import CmStaticInfo ( SI )
24 import FiniteMap ( FiniteMap )
26 import Module ( Module )
27 import RnMonad ( Avails, GlobalRdrEnv, DeclsMap,
28 WhetherHasOrphans, ImportVersion,
29 IfaceInsts, IfaceRules, ExportItem )
30 import TcEnv ( TyThing, InstEnv )
31 import Name ( Name, OccName )
32 import BasicTypes ( Fixity, Version )
34 import CoreSyn ( CoreRule )
35 import RdrHsSyn ( RdrNameDeprecation, RdrNameRuleDecl, RdrNameFixitySig,
36 RdrNameHsDecl, RdrNameInstDecl )
41 cmCompile :: SI -- obvious
42 -> Finder -- to find modules
43 -> ModSummary -- summary, including source
44 -> Maybe ModIFace -- old interface, if available
45 -> HST -- for home module ModDetails
46 -> PCS -- IN: persistent compiler state
49 cmCompile flags finder summary old_iface hst pcs
50 = return (error "cmCompile:unimp")
54 = CompOK ModDetails -- new details (HST additions)
55 (Maybe (ModIFace, Linkable))
56 -- summary and code; Nothing => compilation not reqd
57 -- (old summary and code are still valid)
61 | CompErrs PCS -- updated PCS
62 [SDoc] -- warnings and errors
65 newPCS = return (error "newPCS:unimp")
67 -- These two are only here to avoid recursion between CmCompile and
68 -- CompManager. They really ought to be in the latter.
69 type HST = FiniteMap Module ModDetails
70 type HIT = FiniteMap Module ModIFace
73 data PCS = MkPCS PIT -- Package interface table
74 PST -- Package symbol table
75 HoldingPen -- pre slurped interface bits and pieces
77 type PIT = FiniteMap Module ModIFace
78 type PST = FiniteMap Module ModDetails
80 -- ModIFace is nearly the same as RnMonad.ParsedIface.
81 -- Right now it's identical :)
84 mi_mod :: Module, -- Complete with package info
85 mi_vers :: Version, -- Module version number
86 mi_orphan :: WhetherHasOrphans, -- Whether this module has orphans
87 mi_usages :: [ImportVersion OccName], -- Usages
88 mi_exports :: [ExportItem], -- Exports
89 mi_insts :: [RdrNameInstDecl], -- Local instance declarations
90 mi_decls :: [(Version, RdrNameHsDecl)], -- Local definitions
91 mi_fixity :: (Version, [RdrNameFixitySig]), -- Local fixity declarations,
93 mi_rules :: (Version, [RdrNameRuleDecl]), -- Rules, with their version
94 mi_deprecs :: [RdrNameDeprecation] -- Deprecations
99 moduleExports :: Avails,
100 moduleEnv :: GlobalRdrEnv, -- == FM RdrName [Name]
101 typeEnv :: FiniteMap Name TyThing, -- TyThing is in TcEnv.lhs
103 fixityEnv :: FiniteMap Name Fixity,
104 ruleEnv :: FiniteMap Id [CoreRule]
107 -- This should eventually replace RnMonad.Ifaces
110 iDecls :: DeclsMap, -- A single, global map of Names to decls
112 iInsts :: IfaceInsts,
113 -- The as-yet un-slurped instance decls; this bag is depleted when we
114 -- slurp an instance decl so that we don't slurp the same one twice.
115 -- Each is 'gated' by the names that must be available before
116 -- this instance decl is needed.
119 -- Similar to instance decls, only for rules