[GHC] #9833: GHCi suggestion for instance signature (InstanceSigs) is wrong

#9833: GHCi suggestion for instance signature (InstanceSigs) is wrong -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: Type: bug | Status: new Priority: normal | Milestone: Component: GHCi | Version: 7.8.2 Keywords: | Operating System: Linux Architecture: Unknown/Multiple | Type of failure: GHC Difficulty: Unknown | rejects valid program Blocked By: | Test Case: Related Tickets: | Blocking: | Differential Revisions: -------------------------------------+------------------------------------- With `InstanceSigs` and `PolyKinds` enabled and the following type with kind `ĸ -> *`: {{{#!hs data NullableInterp a = NullI Bool }}} I want to make it an instance of `Alternative` and I decide to supply a signature for `empty`: {{{#!hs instance Alternative NullableInterp where empty :: NullableInterp a empty = undefined (<|>) = undefined }}} but GHCi complains with the following error: {{{#!hs % ghci -ignore-dot-ghci error.hs GHCi, version 7.8.2: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer-gmp ... linking ... done. Loading package base ... linking ... done. [1 of 1] Compiling Main ( error.hs, interpreted ) error.hs:14:12: Method signature does not match class; it should be empty :: forall a. NullableInterp a In the instance declaration for ‘Alternative NullableInterp’ Failed, modules loaded: none. Prelude> }}} Trying GHCi's suggestion (with appropriate extensions) doesn't help and I have to write `empty :: NullableInterp (a :: *)` for it to work. I'm not sure which behaviour is the right one but either it should have compiled or GHCi's suggestion should be `empty :: forall a. NullableInterp (a :: *)`. -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9833 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9833: GHCi suggestion for instance signature (InstanceSigs) is wrong
-------------------------------------+-------------------------------------
Reporter: | Owner:
Iceland_jack | Status: new
Type: bug | Milestone:
Priority: normal | Version: 7.8.2
Component: GHCi | Keywords:
Resolution: | Architecture: Unknown/Multiple
Operating System: Linux | Difficulty: Unknown
Type of failure: GHC | Blocked By:
rejects valid program | Related Tickets:
Test Case: |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones

#9833: GHCi suggestion for instance signature (InstanceSigs) is wrong -------------------------------------+------------------------------------- Reporter: | Owner: Iceland_jack | Status: closed Type: bug | Milestone: Priority: normal | Version: 7.8.2 Component: GHCi | Keywords: Resolution: fixed | Architecture: Unknown/Multiple Operating System: Linux | Difficulty: Unknown Type of failure: GHC | Blocked By: rejects valid program | Related Tickets: Test Case: | polykinds/T9833 | Blocking: | Differential Revisions: | -------------------------------------+------------------------------------- Changes (by simonpj): * status: new => closed * testcase: => polykinds/T9833 * resolution: => fixed Comment: Thanks for pointing this out. The original issue was that the `empty` method was ''more'' polymorphic than required. That is now legal. Simon -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/9833#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler

#9833: GHCi suggestion for instance signature (InstanceSigs) is wrong
-------------------------------------+-------------------------------------
Reporter: | Owner:
Iceland_jack | Status: closed
Type: bug | Milestone:
Priority: normal | Version: 7.8.2
Component: GHCi | Keywords:
Resolution: fixed | Architecture: Unknown/Multiple
Operating System: Linux | Difficulty: Unknown
Type of failure: GHC | Blocked By:
rejects valid program | Related Tickets:
Test Case: |
polykinds/T9833 |
Blocking: |
Differential Revisions: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones
participants (1)
-
GHC