-tycl_decl :: { LTyClDecl RdrName }
- : 'type' type '=' ctype
- -- Note type on the left of the '='; this allows
- -- infix type constructors to be declared
+-- Type classes
+--
+cl_decl :: { LTyClDecl RdrName }
+ : 'class' tycl_hdr fds where
+ {% do { let { (binds, sigs, ats) =
+ cvBindsAndSigs (unLoc $4)
+ ; (ctxt, tc, tvs, tparms) = unLoc $2}
+ ; checkTyVars tparms False -- only type vars allowed
+ ; return $ L (comb4 $1 $2 $3 $4)
+ (mkClassDecl (ctxt, tc, tvs)
+ (unLoc $3) sigs binds ats) } }
+
+-- Type declarations
+--
+ty_decl :: { LTyClDecl RdrName }
+ -- type function signature and equations (w/ type synonyms as special
+ -- case); we need to handle all this in one rule to avoid a large
+ -- number of shift/reduce conflicts (due to the generality of `type')
+ : 'type' opt_iso type kind_or_ctype
+ --
+ -- Note the use of type for the head; this allows
+ -- infix type constructors to be declared and type
+ -- patterns for type function equations