[GHC] #10990: Checking whether a default declaration is an instance of a defaultable typeclass is broken

GHC ghc-devs at haskell.org
Tue Oct 20 07:56:24 UTC 2015


#10990: Checking whether a default declaration is an instance of a defaultable
typeclass is broken
-------------------------------------+-------------------------------------
           Reporter:  kanetw         |             Owner:
               Type:  bug            |            Status:  new
           Priority:  low            |         Milestone:
          Component:  Compiler       |           Version:  7.10.2
  (Type checker)                     |
           Keywords:                 |  Operating System:  Unknown/Multiple
       Architecture:                 |   Type of failure:  None/Unknown
  Unknown/Multiple                   |
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 In TcDefaults.hs, `tcDefaults` is supposed to check whether the supplied
 default type is an instance o `Num` or `IsString` (note the lack of
 extended defaults here, so this has been broken for quite some time).

 Following the code we can see that `simplifyDefault` in TcSimplify.hs
 calls `reportAllUnsolved` and it does report the error -- with typechecker
 tracing on we see
 {{{
 Adding error:
   <interactive>:19:1: error:
       No instance for (Num []) arising from a 'default' declaration
       When checking the types in a default declaration
 }}}

 But typechecking never actually fails, so it returns `Just ()` regardless
 and the error gets swallowed.

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/10990>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list