-pquals1 :: { Located [[LStmt RdrName]] }
- : pquals1 '|' squals { LL (unLoc $3 : unLoc $1) }
- | squals { L (getLoc $1) [unLoc $1] }
-
-squals :: { Located [LStmt RdrName] }
- : squals1 { L (getLoc $1) (reverse (unLoc $1)) }
-
-squals1 :: { Located [LStmt RdrName] }
- : transformquals1 { LL (unLoc $1) }
-
-transformquals1 :: { Located [LStmt RdrName] }
- : transformquals1 ',' transformqual { LL $ [LL ((unLoc $3) (unLoc $1))] }
- | transformquals1 ',' qual { LL ($3 : unLoc $1) }
--- | transformquals1 ',' '{|' pquals '|}' { LL ($4 : unLoc $1) }
- | transformqual { LL $ [LL ((unLoc $1) [])] }
- | qual { L1 [$1] }
--- | '{|' pquals '|}' { L1 [$2] }
+squals :: { Located [LStmt RdrName] } -- In reverse order, because the last
+ -- one can "grab" the earlier ones
+ : squals ',' transformqual { LL [L (getLoc $3) ((unLoc $3) (reverse (unLoc $1)))] }
+ | squals ',' qual { LL ($3 : unLoc $1) }
+ | transformqual { LL [L (getLoc $1) ((unLoc $1) [])] }
+ | qual { L1 [$1] }
+-- | transformquals1 ',' '{|' pquals '|}' { LL ($4 : unLoc $1) }
+-- | '{|' pquals '|}' { L1 [$2] }