[GHC] #9650: Unsatisfiable default signature

GHC ghc-devs at haskell.org
Tue Sep 30 03:19:14 UTC 2014


#9650: Unsatisfiable default signature
-------------------------------------+-------------------------------------
       Reporter:  crockeea           |                   Owner:
           Type:  bug                |                  Status:  new
       Priority:  normal             |               Milestone:
      Component:  Compiler           |                 Version:  7.8.3
       Keywords:                     |        Operating System:
   Architecture:  Unknown/Multiple   |  Unknown/Multiple
     Difficulty:  Unknown            |         Type of failure:  GHC
     Blocked By:                     |  accepts invalid program
Related Tickets:                     |               Test Case:
                                     |                Blocking:
                                     |  Differential Revisions:
-------------------------------------+-------------------------------------
 I discovered the `-XDefaultSignatures` extension and promptly wrote a
 default method that I feel should be rejected by the compiler:

 {{{#!hs
 {-# 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.

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


More information about the ghc-tickets mailing list