2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1995
4 \section[Typecheck]{Outside-world interfaces to the typechecker}
7 #include "HsVersions.h"
12 -- and to make the interface self-sufficient...
13 Module, Bag, CE(..), Binds, FixityDecl, E, Expr, InPat,
14 RenamedPat(..), TypecheckedPat, Id, Inst, Maybe, MaybeErr,
15 Name, PprStyle, PrettyRep, ProtoName, Error(..), Pretty(..),
16 InstInfo, SplitUniqSupply, GlobalSwitch, UniqFM
19 import TcMonad -- typechecking monad machinery
20 import AbsSyn -- the stuff being typechecked
23 import Maybes ( MaybeErr(..) )
24 import SrcLoc ( mkUnknownSrcLoc, SrcLoc )
25 import TcModule -- tcModule, and associated stuff
26 import Util -- for pragmas only
29 The typechecker stuff lives inside a complicated world of @TcM@
30 monadery. This module provides three interfaces into that world, one
31 for typechecking a module, another for typechecking an expression, and
32 one for typechecking an interface. This last one works as if
33 @typecheckModule@ was applied to the very simple module:
35 module EmptyModule where
37 import InterfaceOfInterest
39 This is used when we want to augment an @E@ with information from an
40 interface. (Used in the interpreter.)
44 (GlobalSwitch -> Bool) -- cmd-line switch checker
45 -> SplitUniqSupply -- name supply in
46 -> GlobalNameFuns -- renamer info (for doing derivings)
47 -> RenamedModule -- input module
49 -> ------- OUTPUTS -----------
50 -- depends v much on whether typechecking succeeds or not!
53 (((TypecheckedBinds, -- binds from class decls; does NOT
54 -- include default-methods bindings
55 TypecheckedBinds, -- binds from instance decls; INCLUDES
56 -- class default-methods binds
57 TypecheckedBinds, -- binds from value decls
58 [(Inst, TypecheckedExpr)]),
60 ([RenamedFixityDecl], -- things for the interface generator
61 [Id], -- to look at...
66 FiniteMap TyCon [[Maybe UniType]],
67 -- source tycon specialisation requests
69 --UNUSED: E, -- new cumulative E (with everything)
70 E, -- E just for stuff from THIS module
71 -- NB: if you want the diff between two prev Es: i.e.,
72 -- things in cumulative E that were added because of
73 -- this module's import-ery, just do:
74 -- bigE `minusE` thisModuleE
76 PprStyle->Pretty)) -- stuff to print for -ddump-deriving
79 (Bag Error) -- pretty-print this to find out what went wrong
81 typecheckModule sw_chkr us renamer_name_funs modyule
82 = initTc sw_chkr us (tcModule nullE renamer_name_funs modyule)