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

GHC ghc-devs at haskell.org
Mon Oct 24 23:18:48 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):

 What I mean is: if you had this code (using the example in comment:10):

 {{{#!hs
 c' :: [a] -> [a] -> Bool
 c' = c
 }}}

 then it would fail to typecheck, as there's no `Eq a` constraint, as
 mandated by the context in `instance Eq a => C [a]`. What I am asking is
 simply: should this `Eq a` constraint also be required for the associated
 family instances as well? That is, should this typecheck, even though it
 has no `Eq a` constraint?

 {{{#!hs
 dlist :: D [a]
 dlist = DList []
 }}}

 (Currently, it //does// typecheck.)

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


More information about the ghc-tickets mailing list