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

GHC ghc-devs at haskell.org
Mon Oct 24 17:38:09 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):

 I would also be inclined to say "use the standalone route", for the reason
 that I don't see any reason why the `deriving` clause would infer `Eq
 (Associated a)` given the current state of things. I was merely imagining
 a hypothetical scenario in which data family instances //would//
 reasonable infer such a constraint when deriving instances. If data family
 instances were more tightly intermingled with their parent instances in
 terms of instance contexts, I could envision this being the case.

 P.S. Do you know why GHC decides `DList [] :: D [a]` instead of `DList []
 :: Eq a => D [a]`? That is, why GHC chose to make associated data family
 instance contexts separate from their parent instances' contexts?

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


More information about the ghc-tickets mailing list