d1893e3c54ce186db294f53a58a62e5222d11bb5
[ghc-hetmet.git] / ghc / compiler / typecheck / Typecheck.lhs
1 %
2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1996
3 %
4 \section[Typecheck]{Outside-world interfaces to the typechecker}
5
6 \begin{code}
7 #include "HsVersions.h"
8
9 module Typecheck (
10         typecheckModule, InstInfo
11     ) where
12
13 import Ubiq
14 import TcMonad
15 import TcModule         ( tcModule )
16 import TcInstUtil       ( InstInfo )
17
18 import HsSyn
19 import RnHsSyn
20 import TcHsSyn
21
22 import ErrUtils         ( TcWarning(..), TcError(..) )
23 import Pretty
24 import RnUtils          ( GlobalNameMappers(..), GlobalNameMapper(..) )
25 import Maybes           ( MaybeErr(..) )
26 \end{code}
27
28 The typechecker stuff lives inside a complicated world of @TcM@
29 monadery. 
30
31 ToDo: Interfaces for interpreter ...
32         Typecheck an expression
33         Typecheck an interface
34
35 \begin{code}
36 typecheckModule
37     :: UniqSupply               -- name supply in
38     -> GlobalNameMappers        -- renamer info (for doing derivings)
39     -> RenamedHsModule          -- input module
40
41     -> -- OUTPUTS ...
42     MaybeErr
43        -- SUCCESS ...
44       (((TypecheckedHsBinds,       -- binds from class decls; does NOT
45                                    --    include default-methods bindings
46          TypecheckedHsBinds,       -- binds from instance decls; INCLUDES
47                                    --    class default-methods binds
48          TypecheckedHsBinds,       -- binds from value decls
49
50          [(Id, TypecheckedHsExpr)] -- constant instance binds
51         ),
52
53         ([RenamedFixityDecl], [Id], [TyCon], [Class], Bag InstInfo),
54                                 -- things for the interface generator
55
56         ([TyCon], [Class]),
57                                 -- environments of info from this module only
58
59         FiniteMap TyCon [(Bool, [Maybe Type])],
60                                 -- source tycon specialisation requests
61
62         PprStyle->Pretty),      -- stuff to print for -ddump-deriving
63
64        Bag TcWarning)           -- pretty-print this to get warnings
65
66        -- FAILURE ...
67       (Bag TcError,             -- pretty-print this to get errors
68        Bag TcWarning)           -- pretty-print this to get warnings
69
70 typecheckModule us renamer_name_funs mod
71   = initTc us (tcModule renamer_name_funs mod)
72 \end{code}