[GHC] #11450: Associated types at wrong type in instance
GHC
ghc-devs at haskell.org
Tue Apr 19 07:39:20 UTC 2016
#11450: Associated types at wrong type in instance
-------------------------------------+-------------------------------------
Reporter: simonpj | Owner:
Type: bug | Status: new
Priority: high | Milestone: 8.0.2
Component: Compiler | Version: 7.10.3
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC accepts | Unknown/Multiple
invalid program | Test Case:
Blocked By: | Blocking:
Related Tickets: #11449, #11451 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Simon Peyton Jones <simonpj@…>):
In [changeset:"8136a5cbfcd24647f897a2fae9fcbda0b1624035/ghc" 8136a5c/ghc]:
{{{
#!CommitTicketReference repository="ghc"
revision="8136a5cbfcd24647f897a2fae9fcbda0b1624035"
Tighten checking for associated type instances
This patch finishes off Trac #11450. Following debate on that ticket,
the patch tightens up the rules for what the instances of an
associated type can look like. Now they must match the instance
header exactly. Eg
class C a b where
type T a x b
With this class decl, if we have an instance decl
instance C ty1 ty2 where ...
then the type instance must look like
type T ty1 v ty2 = ...
with exactly
- 'ty1' for 'a'
- 'ty2' for 'b', and
- a variable for 'x'
For example:
instance C [p] Int
type T [p] y Int = (p,y,y)
Previously we allowed multiple instance equations and now, in effect,
we don't since they would all overlap. If you want multiple cases,
use an auxiliary type family.
This is consistent with the treatment of generic-default instances,
and the user manual always said "WARNING: this facility (multiple
instance equations may be withdrawn in the future".
I also improved error messages, and did other minor refactoring.
}}}
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11450#comment:23>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list