[GHC] #8165: Use GeneralizedNewtypeDeriving to automatically create associated type families

GHC ghc-devs at haskell.org
Mon Oct 24 23:13:28 UTC 2016


#8165: Use GeneralizedNewtypeDeriving to automatically create associated type
families
-------------------------------------+-------------------------------------
        Reporter:  MikeIzbicki       |                Owner:  goldfire
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:  8.2.1
       Component:  Compiler (Type    |              Version:  7.6.3
  checker)                           |
      Resolution:                    |             Keywords:  TypeFamilies
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #2721             |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by RyanGlScott):

 Why should `C` be illegal? The type parameters of `T` are a permutation of
 a proper subset of the class parameters (`a` and `k`), so it
 [https://wiki.haskell.org/GHC/Type_families#Associated_family_declarations_2
 should be legal].

 But moreover, I think the answer to my question in comment:14 is: you
 can't newtype-derive `C` for `MyInt`, as there's an associated type that
 //doesn't mention the last type parameter of `C`//. This is crucial,
 because if this doesn't hold, then we won't have a `T` instance to fall
 back on, making the whole derivation crumble. We'd just need to check for
 this condition beforehand.

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


More information about the ghc-tickets mailing list