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

GHC ghc-devs at haskell.org
Sat Dec 19 00:09:50 UTC 2015


#8165: Use GeneralizedNewtypeDeriving to automatically create associated type
families
-------------------------------------+-------------------------------------
        Reporter:  MikeIzbicki       |                Owner:  goldfire
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:  8.0.1
       Component:  Compiler (Type    |              Version:  7.6.3
  checker)                           |
      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):

 Would this approach be able to work for associated injective type
 families? If you had something like this:

 {{{#!hs
 class C a where
   type T a = r | r -> a

 instance C Int where
   type T Int = Char

 newtype WrappedInt = WrapInt Int deriving C
 }}}

 Then, if I understand the above proposal, the following code would be
 generated:

 {{{#!hs
 instance C WrappedInt where
   type T WrappedInt = T Int
 }}}

 which would violate injectivity.

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


More information about the ghc-tickets mailing list