[GHC] #10905: Incorrect number of parameters in "role" errors

GHC ghc-devs at haskell.org
Tue Oct 6 15:44:30 UTC 2015


#10905: Incorrect number of parameters in "role" errors
-------------------------------------+-------------------------------------
        Reporter:  crockeea          |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  7.10.2
      Resolution:                    |             Keywords:  roles
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  Incorrect         |  Unknown/Multiple
  warning at compile-time            |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
-------------------------------------+-------------------------------------

Comment (by goldfire):

 If I say

 {{{
 import Data.Coerce

 data G a where
   MkG :: G Int

 newtype Age = MkAge Int

 go :: G Age -> G Int
 go = coerce
 }}}

 I get

 {{{
     Couldn't match type ‘Int’ with ‘Age’
     arising from trying to show that the representations of
       ‘G Age’ and
       ‘G Int’ are the same
     Relevant role signatures: type role G nominal
     In the expression: coerce
     In an equation for ‘go’: go = coerce
 }}}

 That role signature looks helpful. Perhaps !TcErrors could be more
 selective in deciding which signatures to include (though I'm not quite
 sure how to get this right), but I do think they're good to see.

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


More information about the ghc-tickets mailing list