#2641: Make -XExtendedDeafultRules a bit less liberal
---------------------------------+------------------------------------------
    Reporter:  simonpj           |       Owner:                  
        Type:  feature request   |      Status:  new             
    Priority:  normal            |   Milestone:                  
   Component:  Compiler          |     Version:  6.8.3           
    Severity:  normal            |    Keywords:                  
  Difficulty:  Unknown           |    Testcase:                  
Architecture:  Unknown/Multiple  |          Os:  Unknown/Multiple
---------------------------------+------------------------------------------
 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!

 [http://www.haskell.org/ghc/docs/latest/html/users_guide/interactive-
 evaluation.html#extended-default-rules 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.

-- 
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/2641>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to