Skip to content

Checking whether a default declaration is an instance of a defaultable typeclass is broken

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.

Trac metadata
Trac field Value
Version 7.10.2
Type Bug
TypeOfFailure OtherFailure
Priority low
Resolution Unresolved
Component Compiler (Type checker)
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information