import Class ( classTyVars, classBigSig, classSelIds, classTyCon, Class, ClassOpItem,
DefMeth (..) )
import Bag ( bagToList )
-import CmdLineOpts ( opt_GlasgowExts, opt_WarnMissingMethods, opt_PprStyle_Debug )
import MkId ( mkDictSelId, mkDataConId, mkDataConWrapId, mkDefaultMethodId )
import DataCon ( mkDataCon, notMarkedStrict )
import Id ( Id, idType, idName )
)
import Var ( TyVar )
import VarSet ( mkVarSet, emptyVarSet )
+import CmdLineOpts
import ErrUtils ( dumpIfSet )
import Util ( count )
import Maybes ( seqMaybe, maybeToBool, orElse )
tyvar_names fundeps class_sigs def_methods pragmas
sys_names src_loc)
= -- CHECK ARITY 1 FOR HASKELL 1.4
- checkTc (opt_GlasgowExts || length tyvar_names == 1)
+ doptsTc Opt_GlasgowExts `thenTc` \ glaExts ->
+ checkTc (glaExts || length tyvar_names == 1)
(classArityErr class_name) `thenTc_`
-- LOOK THINGS UP IN THE ENVIRONMENT
-- only the type variable of the class decl.
-- For std Haskell check that the context constrains only tyvars
- (if opt_GlasgowExts then
+ doptsTc Opt_GlasgowExts `thenTc` \ glaExts ->
+ (if glaExts then
returnTc ()
else
mapTc_ check_constraint context
- ) `thenTc_`
+ ) `thenTc_`
-- Context is already kind-checked
tcClassContext context `thenTc` \ sc_theta ->
mkDefMethRhs is_inst_decl clas inst_tys sel_id loc NoDefMeth
= -- No default method
-- Warn only if -fwarn-missing-methods
- warnTc (is_inst_decl && opt_WarnMissingMethods)
+ doptsTc Opt_WarnMissingMethods `thenNF_Tc` \ warn ->
+ warnTc (is_inst_decl && warn)
(omittedMethodWarn sel_id clas) `thenNF_Tc_`
returnTc error_rhs
where
-- (checkTc, so False provokes the error)
checkTc (not is_inst_decl || simple_inst)
(badGenericInstance sel_id clas) `thenTc_`
-
+
ioToTc (dumpIfSet opt_PprStyle_Debug "Generic RHS" stuff) `thenNF_Tc_`
returnTc rhs
where