[GHC] #4815: Instance constraints should be used when deriving on associated data types

GHC ghc-devs at haskell.org
Tue Oct 25 13:10:11 UTC 2016


#4815: Instance constraints should be used when deriving on associated data types
-------------------------------------+-------------------------------------
        Reporter:  batterseapower    |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  low               |            Milestone:
       Component:  Compiler          |              Version:  6.12.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):

 Replying to [comment:17 simonpj]:
 > So I'm unconvinced that this is worth the bother.

 I completely agree, not only because it might be over-constraining, but in
 some cases it might even yield redundant constraints, as in this example:

 {{{#!hs
 {-# LANGUAGE TypeFamilies #-}

 class C a where
   data D a
   c :: a -> a -> Bool

 instance Eq a => C [a] where
   newtype D [a] = DList [a] deriving Show
   c = (==)
 }}}

 This would, under the proposal in this ticket, yield:

 {{{#!hs
 instance (Eq a, Show a) => Show (D [a])
 }}}

 which isn't what we want at all.

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


More information about the ghc-tickets mailing list