[GHC] #12466: Typechecker regression: Inaccessible code in a type expected by the context

GHC ghc-devs at haskell.org
Tue Aug 9 02:41:10 UTC 2016


#12466: Typechecker regression: Inaccessible code in a type expected by the context
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:
            Type:  bug               |               Status:  new
        Priority:  highest           |            Milestone:  8.2.1
       Component:  Compiler (Type    |              Version:  8.1
  checker)                           |
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by goldfire):

 As described in
 [https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/glasgow_exts.html
 #class-default-signatures the manual], a generic-default type signature
 (that is, one using the `default` keyword in a class definition) is ''more
 specific'' than the "normal" type signature for a class method. When no
 implementation is given for a method in an instance declaration, the
 default implementation is typechecked against the generic-default type
 signature.

 In the code in the Description, this typecheck fails.

 On the other hand, if we provide an implementation for `foo`, the generic-
 default signature is not consulted in the instance declaration, and so
 there is no problem.

 When you add an `InstanceSigs` signature, then you're just writing a fresh
 signature that fails to typecheck. Your new signature is utterly unrelated
 to the generic-default signature.

 Does this help to clarify?

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


More information about the ghc-tickets mailing list