-tcSuperClasses :: RecFlag -> Class
- -> RenamedContext -- class context
- -> [Name] -- Names for superclass selectors
- -> TcM (ClassContext, -- the superclass context
- [Id]) -- superclass selector Ids
-
-tcSuperClasses is_rec clas context sc_sel_names
- = -- Check the context.
- -- The renamer has already checked that the context mentions
- -- only the type variable of the class decl.
-
- -- For std Haskell check that the context constrains only tyvars
- doptsTc Opt_GlasgowExts `thenTc` \ glaExts ->
- (if glaExts then
- returnTc ()
- else
- mapTc_ check_constraint context
- ) `thenTc_`
-
- -- Context is already kind-checked
- tcRecClassContext is_rec context `thenTc` \ sc_theta ->
- let
- sc_sel_ids = [mkDictSelId sc_name clas | sc_name <- sc_sel_names]
- in
- -- Done
- returnTc (sc_theta, sc_sel_ids)
-
- where
- check_constraint sc@(HsPClass c tys)
- = checkTc (all is_tyvar tys) (superClassErr clas sc)
-
- is_tyvar (HsTyVar _) = True
- is_tyvar other = False
-
-
-tcClassSig :: RecFlag -> RecTcEnv -- Knot tying only!