[GHC] #11509: Incorrect error message in StandaloneDeriving: "The data constructors of <typeclass> are not all in scope"
GHC
ghc-devs at haskell.org
Tue Feb 2 07:51:51 UTC 2016
#11509: Incorrect error message in StandaloneDeriving: "The data constructors of
<typeclass> are not all in scope"
-------------------------------------+-------------------------------------
Reporter: edsko | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1-rc1
Resolution: | Keywords:
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 edsko):
Incidentally, when `Serializable` has a nominal role, that call to
`coerce` is rejected by ghc 8.0 with
{{{
Bug.hs:70:10: error:
• Couldn't match type ‘[a]’ with ‘MyList a’
arising from a use of ‘coerce’
• In the expression:
coerce (dict :: Static (Dict (Serializable [a])))
In an equation for ‘dict’:
dict = coerce (dict :: Static (Dict (Serializable [a])))
In the instance declaration for ‘SC (Serializable (MyList a))’
• Relevant bindings include
dict :: Static (Dict (Serializable (MyList a)))
(bound at Bug.hs:70:3)
}}}
which I found somewhat confusing; "Couldn't match type `[a]` with `MyList
a` arising from a use of `coerce`" isn't very obvious; ghc 7.10.3 here is
much much clearer:
{{{
Bug.hs:70:10:
Couldn't match type ‘MyList a’ with ‘[a]’
arising from trying to show that the representations of
‘Static (Dict (Serializable [a]))’ and
‘Static (Dict (Serializable (MyList a)))’ are the same
Relevant role signatures:
type role [] representational
type role MyList representational
type role Dict representational
type role Static representational
type role Serializable nominal
Relevant bindings include
dict :: Static (Dict (Serializable (MyList a)))
(bound at Bug.hs:70:3)
In the expression:
coerce (dict :: Static (Dict (Serializable [a])))
In an equation for ‘dict’:
dict = coerce (dict :: Static (Dict (Serializable [a])))
In the instance declaration for ‘SC (Serializable (MyList a))’
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11509#comment:3>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list