import TcMonoType ( tcHsType, tcHsSigType, tcHsBoxedSigType, tcHsTyVars, tcClassContext,
kcHsContext, kcHsSigType
)
-import TcEnv ( tcExtendTyVarEnv, tcLookupTy, tcLookupGlobalId, 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 (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}
-- data type use the same type variables
= checkTc (all (== field_ty) other_tys)
(fieldTypeMisMatch field_name) `thenTc_`
- tcLookupGlobalId unpackCStringIdName `thenTc` \ unpack_id ->
- tcLookupGlobalId unpackCStringUtf8IdName `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