[GHC] #14442: InstanceSigs fails

GHC ghc-devs at haskell.org
Thu Nov 9 14:11:17 UTC 2017


#14442: InstanceSigs fails
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.3
      Resolution:                    |             Keywords:  InstanceSigs
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 Suppose you'd written the instance decl like this
 {{{
 instance EQ Bool where
   eq = my_eq

 my_eq :: Sing (x :: Bool) -> Sing (y :: Bool) -> Maybe (x :~~: y)
 my_eq SFalse SFalse = Just HRefl
 }}}
 That works.  Now remove the kind signature on `x :: Bool`.  Fails.  And
 indeed it should, because `my_eq`'s signature means
 {{{
 my_eq :: forall k (x::k) (y::Bool). Sing x -> Sing (y :: Bool) -> Maybe (x
 :~~: y)
 }}}
 and indeed the code does not have this type.

 So I think it's behaving right.

 Can you suggest a concrete improvement to the user manual that would make
 that clearer?

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


More information about the ghc-tickets mailing list