Revise the rules for -XExtendedDefaultRules
-XExtendedDefaultRules flag is very liberal about type-class defaults. Perhaps too liberal:
> *Main> quickCheck (\xs -> reverse xs == xs) > +++ OK, passed 100 tests.
Not good (reverse on lists is not the identity function). I expect a type error! Reason: reverse on list of () is indeed the identity function!
The rules are currently these:
- All of the classes Ci are single-parameter type classes.
- At least one of the classes Ci is numeric, or is Show, Eq, or Ord.
Maybe we should tighten up the second rule to say:
- All of the classes Ci is numeric, or is Show, Eq, or Ord.
Then the Quickcheck example would not bogusly succeed in typechecking, because there's an
Arbitrary constraint involved.
This ticket is to record the idea and canvas opinion. Record thoughts below.