2 % (c) The GRASP/AQUA Project, Glasgow University, 1992-1995
4 \section[TcConDecls]{Typechecking @ConDecls@}
7 #include "HsVersions.h"
9 module TcConDecls ( tcConDecls ) where
11 import TcMonad -- typechecking monadic machinery
15 import E ( GVE(..), nullGVE, plusGVE )
16 import Errors ( confusedNameErr )
17 import Id ( mkDataCon, SpecEnv )
18 import TCE ( TCE(..), UniqFM )
19 import TVE ( TVE(..) )
20 import TcMonoType ( tcMonoType )
25 tcConDecls :: TCE -> TVE -> TyCon -> [TyVarTemplate] -> SpecEnv
26 -> [RenamedConDecl] -> Baby_TcM GVE
28 tcConDecls tce tve tycon tyvars specenv [] = returnB_Tc nullGVE
30 tcConDecls tce tve tycon tyvars specenv (cd:cds)
31 = tc_decl cd `thenB_Tc` \ gve_fst ->
32 tcConDecls tce tve tycon tyvars specenv cds `thenB_Tc` \ gve_rest ->
33 returnB_Tc (plusGVE gve_fst gve_rest)
35 tc_decl (ConDecl name@(OtherTopId uniq full_name) tys src_loc)
36 = addSrcLocB_Tc src_loc (
37 mapB_Tc (tcMonoType fake_CE tce tve) tys `thenB_Tc` \ arg_tys ->
38 returnB_Tc [(name, data_con arg_tys)]
41 fake_CE = panic "tcConDecls:CE"
52 tc_decl (ConDecl odd_name _ src_loc)
53 = failB_Tc (confusedNameErr "Bad name for a data constructor (a Prelude name?)"