Unsatisfiable default signature
I discovered the -XDefaultSignatures extension and promptly wrote a default method that I feel should be rejected by the compiler:
{-# LANGUAGE DefaultSignatures #-}
module Foo where
class Foo a where
foo :: proxy a -> b -> Int
default foo :: (Integral b) => proxy a -> b -> Int
foo _ b = fromIntegral b
GHC accepts this code, but rejects the instance instance Foo Bool because No instance for (Integral b) arising from a use of ‘Foo.$gdmfoo’. It seems to me that the class should have never compiled in the first place.
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.8.3 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |