[GHC] #11450: Associated types at wrong type in instance

GHC ghc-devs at haskell.org
Thu Jan 21 14:27:48 UTC 2016


#11450: Associated types at wrong type in instance
-------------------------------------+-------------------------------------
        Reporter:  simonpj           |                Owner:
            Type:  bug               |               Status:  new
        Priority:  high              |            Milestone:  8.0.1
       Component:  Compiler          |              Version:  7.10.3
      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 RyanGlScott):

 I think being able to use different type variables in the instance makes
 sense for a couple of reasons:

 1. It's the way GHC has behaved for a while, so suddenly adding a new
 restriction feels questionable. I'm not sure if there's any code out there
 in the wild that relies on this behavior, but it wouldn't surprise me if
 there is.
 2. You can already do things like this:

    {{{#!hs
    class C v where
      instance T x v y

    instance C (Either a b) where
      instance T a (Either a b) b = b -> a
    }}}

    That is, you can have other type variables mentioned in an associated
 type family that aren't from the class declaration (as long as at least
 one of the type variables is from the class). In that type instance, I
 don't know if it really makes sense to talk about a canonical ordering for
 the type variables.

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


More information about the ghc-tickets mailing list