import TcMonoType ( tcHsType, tcHsSigType, tcHsBoxedSigType, tcHsTyVars, tcClassContext,
kcHsContext, kcHsSigType
)
-import TcEnv ( tcExtendTyVarEnv, tcLookupTy, tcLookupValueByKey, TyThing(..), TyThingDetails(..) )
+import TcEnv ( tcExtendTyVarEnv,
+ tcLookupTyCon, tcLookupClass, tcLookupGlobalId,
+ TyThingDetails(..)
+ )
import TcMonad
import Class ( ClassContext )
)
import TysWiredIn ( unitTy )
import VarSet ( intersectVarSet, isEmptyVarSet )
-import PrelNames ( unpackCStringIdKey, unpackCStringUtf8IdKey )
+import PrelNames ( unpackCStringName, unpackCStringUtf8Name )
import ListSetOps ( equivClasses )
\end{code}
%************************************************************************
\begin{code}
-tcTyDecl1 :: RenamedTyClDecl -> TcM s (Name, TyThingDetails)
+tcTyDecl1 :: RenamedTyClDecl -> TcM (Name, TyThingDetails)
tcTyDecl1 (TySynonym tycon_name tyvar_names rhs src_loc)
- = tcLookupTy tycon_name `thenNF_Tc` \ (ATyCon tycon) ->
+ = tcLookupTyCon tycon_name `thenNF_Tc` \ tycon ->
tcExtendTyVarEnv (tyConTyVars tycon) $
tcHsType rhs `thenTc` \ rhs_ty ->
-- Note tcHsType not tcHsSigType; we allow type synonyms
returnTc (tycon_name, SynTyDetails rhs_ty)
-tcTyDecl1 (TyData new_or_data context tycon_name _ con_decls _ derivings _ src_loc name1 name2)
- = tcLookupTy tycon_name `thenNF_Tc` \ (ATyCon tycon) ->
+tcTyDecl1 (TyData new_or_data context tycon_name _ con_decls _ derivings src_loc name1 name2)
+ = tcLookupTyCon tycon_name `thenNF_Tc` \ tycon ->
let
tyvars = tyConTyVars tycon
in
returnTc (tycon_name, DataTyDetails ctxt data_cons derived_classes)
where
tc_derivs Nothing = returnTc []
- tc_derivs (Just ds) = mapTc tc_deriv ds
-
- tc_deriv name = tcLookupTy name `thenTc` \ (AClass clas) ->
- returnTc clas
+ tc_derivs (Just ds) = mapTc tcLookupClass ds
\end{code}
\begin{code}
%************************************************************************
\begin{code}
-kcConDetails :: RenamedContext -> ConDetails Name -> TcM s ()
+kcConDetails :: RenamedContext -> ConDetails Name -> TcM ()
kcConDetails ex_ctxt details
= kcHsContext ex_ctxt `thenTc_`
kc_con_details details
kc_bty bty = kcHsSigType (getBangType bty)
-tcConDecl :: NewOrData -> TyCon -> [TyVar] -> ClassContext -> RenamedConDecl -> TcM s DataCon
+tcConDecl :: NewOrData -> TyCon -> [TyVar] -> ClassContext -> RenamedConDecl -> TcM DataCon
tcConDecl new_or_data tycon tyvars ctxt (ConDecl name wkr_name ex_tvs ex_ctxt details src_loc)
= tcAddSrcLoc src_loc $
%************************************************************************
\begin{code}
-mkImplicitDataBinds :: [TyCon] -> TcM s ([Id], TcMonoBinds)
+mkImplicitDataBinds :: [TyCon] -> TcM ([Id], TcMonoBinds)
mkImplicitDataBinds [] = returnTc ([], EmptyMonoBinds)
mkImplicitDataBinds (tycon : tycons)
| isSynTyCon tycon = mkImplicitDataBinds tycons
-- data type use the same type variables
= checkTc (all (== field_ty) other_tys)
(fieldTypeMisMatch field_name) `thenTc_`
- tcLookupValueByKey unpackCStringIdKey `thenTc` \ unpack_id ->
- tcLookupValueByKey unpackCStringUtf8IdKey `thenTc` \ unpackUtf8_id ->
+ tcLookupGlobalId unpackCStringName `thenTc` \ unpack_id ->
+ tcLookupGlobalId unpackCStringUtf8Name `thenTc` \ unpackUtf8_id ->
returnTc (mkRecordSelId tycon first_field_label unpack_id unpackUtf8_id)
where
field_ty = fieldLabelType first_field_label