2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1994
4 \section[TcIfaceSig]{Type checking of type signatures in interface files}
7 #include "HsVersions.h"
9 module TcIfaceSig ( tcInterfaceSigs ) where
11 IMPORT_Trace -- ToDo: rm (debugging)
15 import TcMonad -- typechecking monadic machinery
16 import AbsSyn -- the stuff being typechecked
18 import AbsUniType ( splitType, splitTyArgs )
19 import CmdLineOpts ( GlobalSwitch(..) )
20 import E ( getE_CE, getE_TCE, nullGVE, unitGVE,
21 plusGVE, GVE(..), E, CE(..), TCE(..), UniqFM
23 import Errors ( confusedNameErr )
24 import Id -- mkImported
25 #if USE_ATTACK_PRAGMAS
26 import IdInfo ( workerExists )
28 import Maybes ( Maybe(..) )
29 import TcPragmas ( tcGenPragmas )
30 import TVE ( nullTVE, TVE(..) )
31 import TcPolyType ( tcPolyType )
32 import UniqFM ( emptyUFM ) -- profiling, pragmas only
36 Ultimately, type signatures in interfaces will have pragmatic
37 information attached, so it is a good idea to have separate code to
40 As always, we do not have to worry about user-pragmas in interface
44 tcInterfaceSigs :: E -> [RenamedSig] -> Baby_TcM GVE
46 tcInterfaceSigs e [] = returnB_Tc nullGVE
48 tcInterfaceSigs e (sig:sigs)
49 = tc_sig sig `thenB_Tc` \ gve1 ->
50 tcInterfaceSigs e sigs `thenB_Tc` \ gve2 ->
51 returnB_Tc (plusGVE gve1 gve2)
56 tc_sig (Sig name@(OtherTopId uniq full_name) ty pragmas src_loc)
57 = addSrcLocB_Tc src_loc (
58 tcPolyType ce tce nullTVE ty `thenB_Tc` \ sigma_ty ->
60 fixB_Tc ( \ rec_imported_id ->
61 tcGenPragmas e (Just sigma_ty) rec_imported_id pragmas
62 `thenB_Tc` \ id_info ->
64 returnB_Tc (mkImported uniq full_name sigma_ty id_info)
65 ) `thenB_Tc` \ final_id ->
67 returnB_Tc (unitGVE name final_id)
70 tc_sig (Sig odd_name _ _ src_loc)
71 = getSwitchCheckerB_Tc `thenB_Tc` \ sw_chkr ->
73 WiredInVal _ | sw_chkr CompilingPrelude -- OK, that's cool; ignore
75 _ -> failB_Tc (confusedNameErr "Bad name on a type signature (a Prelude name?)"