Ticket #2641 (new feature request)
Revise the rules for -XExtendedDeafultRules
| Reported by: | simonpj | Owned by: | |
|---|---|---|---|
| Priority: | lowest | Milestone: | 7.6.2 |
| Component: | Compiler | Version: | 6.8.3 |
| Keywords: | Cc: | koen@…, lennart@… | |
| Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
| Type of failure: | Difficulty: | Unknown | |
| Test Case: | Blocked By: | ||
| Blocking: | Related Tickets: |
Description (last modified by simonpj) (diff)
The -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.
See also
Change History
Note: See
TracTickets for help on using
tickets.
