[project @ 2000-10-11 16:15:32 by sewardj]
[ghc-hetmet.git] / ghc / compiler / ghci / CmCompile.lhs
1 %
2 % (c) The University of Glasgow, 2000
3 %
4 \section[CmCompile]{Compiler for GHCI}
5
6 \begin{code}
7 module CmCompile ( cmCompile,
8                    ModDetails,         -- abstract
9                    ModIFace,           -- abstract
10                    PersistentCompilerState, emptyPCS,    -- abstract
11                    HomeSymbolTable,    -- not abstract (CM needs to see it)
12                    HomeInterfaceTable, -- ditto
13                    CompResult(..)
14                  )
15 where
16
17 #include "HsVersions.h"
18
19 -- many of these need to be moved to HscTypes
20 --import CmLink         ( Linkable(..) )
21 --import Outputable     ( SDoc )
22 --import CmFind         ( Finder )
23 --import CmSummarise    ( ModSummary, name_of_summary )
24 --import FiniteMap      ( FiniteMap, emptyFM )
25
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 )
33 --import Id             ( Id )
34 --import CoreSyn                ( CoreRule )
35 --import RdrHsSyn               ( RdrNameDeprecation, RdrNameRuleDecl, RdrNameFixitySig,
36 --                          RdrNameHsDecl, RdrNameInstDecl )
37
38 import HscTypes         ( )
39
40 \end{code}
41
42
43 %************************************************************************
44 %*                                                                      *
45 \subsection{The main compiler interface}
46 %*                                                                      *
47 %************************************************************************
48
49
50 \begin{code}
51 cmCompile :: Finder                  -- to find modules
52           -> ModSummary              -- summary, including source
53           -> Maybe ModIFace          -- old interface, if available
54           -> HomeModMap              -- ModuleName -> Module
55           -> HomeSymbolTable         -- for home module ModDetails          
56           -> PersistentCompilerState -- IN: persistent compiler state
57           -> IO CompResult
58
59 cmCompile finder summary old_iface hst pcs
60    = do putStrLn ("cmCompile: compiling " ++ name_of_summary summary)
61         return (CompOK (error "cmCompile:modDetails")
62                        (Just (error "cmCompile:modIFace", 
63                               --error "cmCompile:Linkable"
64                               --LM (name_of_summary summary) [] 
65                               LM (name_of_summary summary) []
66                               ))
67                        pcs
68                        []
69                )
70
71 -- should be somewhere else?
72 emptyPCS :: IO PersistentCompilerState
73 emptyPCS = return (PersistentCompilerState 
74                       { pcs_modmap = emptyFM,
75                         pcs_pit    = emptyPIT,
76                         pcs_pst    = emptyPST,
77                         pcs_hp     = emptyHoldingPen })
78 \end{code}
79