[project @ 1996-04-05 08:26:04 by partain]
[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 Pretty
23 import RnUtils          ( GlobalNameMappers(..), GlobalNameMapper(..) )
24 import Maybes           ( MaybeErr(..) )
25 \end{code}
26
27 The typechecker stuff lives inside a complicated world of @TcM@
28 monadery. 
29
30 ToDo: Interfaces for interpreter ...
31         Typecheck an expression
32         Typecheck an interface
33
34 \begin{code}
35 typecheckModule
36     :: UniqSupply               -- name supply in
37     -> GlobalNameMappers        -- renamer info (for doing derivings)
38     -> RenamedHsModule          -- input module
39
40     -> -- OUTPUTS ...
41     MaybeErr
42        -- SUCCESS ...
43       (((TypecheckedHsBinds,       -- record selector definitions
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}