2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1996
4 \section[TcIfaceSig]{Type checking of type signatures in interface files}
7 #include "HsVersions.h"
9 module TcIfaceSig ( tcInterfaceSigs ) where
14 import TcMonoType ( tcPolyType )
16 import HsSyn ( Sig(..), PolyType )
17 import RnHsSyn ( RenamedSig(..), RnName(..) )
19 import CmdLineOpts ( opt_CompilingPrelude )
20 import Id ( mkImported )
21 --import Name ( Name(..) )
26 --import TcPragmas ( tcGenPragmas )
27 import IdInfo ( noIdInfo )
28 tcGenPragmas ty id ps = returnNF_Tc noIdInfo
32 Ultimately, type signatures in interfaces will have pragmatic
33 information attached, so it is a good idea to have separate code to
36 As always, we do not have to worry about user-pragmas in interface
40 tcInterfaceSigs :: [RenamedSig] -> TcM s [Id]
42 tcInterfaceSigs [] = returnTc []
44 tcInterfaceSigs (Sig name@(RnName full_name) ty pragmas src_loc : sigs)
45 = tcAddSrcLoc src_loc (
46 tcPolyType ty `thenTc` \ sigma_ty ->
48 tcGenPragmas (Just sigma_ty) rec_id pragmas
49 `thenNF_Tc` \ id_info ->
50 returnTc (mkImported full_name sigma_ty id_info)
52 tcInterfaceSigs sigs `thenTc` \ sigs' ->
56 tcInterfaceSigs (Sig odd_name _ _ src_loc : sigs)
58 WiredInId _ | opt_CompilingPrelude
59 -> tcInterfaceSigs sigs
60 _ -> tcAddSrcLoc src_loc $
61 failTc (ifaceSigNameErr odd_name)
63 ifaceSigNameErr name sty
64 = ppHang (ppStr "Bad name in an interface type signature (a Prelude name?)")