-data OutPat flexi id
- = WildPat (GenType flexi) -- wild card
-
- | VarPat id -- variable (type is in the Id)
-
- | LazyPat (OutPat flexi id) -- lazy pattern
-
- | AsPat id -- as pattern
- (OutPat flexi id)
-
- | ConPat Id -- Constructor is always an Id
- (GenType flexi) -- the type of the pattern
- [OutPat flexi id]
-
- | ConOpPat (OutPat flexi id) -- just a special case...
- Id
- (OutPat flexi id)
- (GenType flexi)
- | ListPat -- syntactic list
- (GenType flexi) -- the type of the elements
- [OutPat flexi id]
-
- | TuplePat [OutPat flexi id] -- tuple
- -- UnitPat is TuplePat []
-
- | RecPat Id -- record constructor
- (GenType flexi) -- the type of the pattern
- [(Id, OutPat flexi id, Bool)] -- True <=> source used punning
+-- Generics
+ | TypePatIn (HsType name) -- Type pattern for generic definitions
+ -- e.g f{| a+b |} = ...
+ -- These show up only in class
+ -- declarations,
+ -- and should be a top-level pattern
+
+-- /Generics
+
+data OutPat id
+ = WildPat Type -- wild card
+ | VarPat id -- variable (type is in the Id)
+ | LazyPat (OutPat id) -- lazy pattern
+ | AsPat id -- as pattern
+ (OutPat id)
+
+ | SigPat (OutPat id) -- Pattern p
+ Type -- Type, t, of the whole pattern
+ (HsExpr id (OutPat id))
+ -- Coercion function,
+ -- of type t -> typeof(p)
+
+ | ListPat -- Syntactic list
+ Type -- The type of the elements
+ [OutPat id]
+
+ | TuplePat [OutPat id] -- Tuple
+ Boxity
+ -- UnitPat is TuplePat []
+
+ | ConPat DataCon
+ Type -- the type of the pattern
+ [TyVar] -- Existentially bound type variables
+ [id] -- Ditto dictionaries
+ [OutPat id]
+
+ -- ConOpPats are only used on the input side
+
+ | RecPat DataCon -- Record constructor
+ Type -- The type of the pattern
+ [TyVar] -- Existentially bound type variables
+ [id] -- Ditto dictionaries
+ [(Id, OutPat id, Bool)] -- True <=> source used punning