[GHC] #8516: Add (->) representation and the Invariant class to GHC.Generics

GHC ghc-devs at haskell.org
Mon Aug 15 08:39:10 UTC 2016


#8516: Add (->) representation and the Invariant class to GHC.Generics
-------------------------------------+-------------------------------------
        Reporter:  nfrisby           |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  low               |            Milestone:
       Component:  Compiler (Type    |              Version:  7.7
  checker)                           |
      Resolution:                    |             Keywords:  Generics
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 simonpj):

 Crumbs... #9123 (about `Representational`) is a long thread!  I'm totally
 not up to speed with all that.

 However, part of the mix seems to be the feasibility (or otherwise) of
 allowing constraints like `(forall a. Eq a => Eq [a]` instance contexts;
 see #2893, #2456, and #5927, etc.   For example:
 {{{
 instance (Binary a, forall b. Binary b => Binary (f b))
        => Binary (GRowe f a) where ...
 }}}

 I've always said "I don't know how to implement that", but this morning it
 feels different.  Suppose that we only allowed those quantified
 constraints ''in the context of a top-level instance declaration''.

  * Solving "Wanted" constraints of this form is easy: it's just an
 implication constraint.
  * Allowing them as "Given" constraints would be a little awkward, because
 it'd need a new field in the "inert set" of the constraint solver.  But
 for instances it's all top-level-ish, so we could perhaps just extend the
 "local instance environment".

 But even in the more general form it would be quite do-able I think.  So,
 if allowing quantified constraints will help, perhaps it's time we bit
 that bullet.

 Simon

 Then it would only show up as a "Given" constraint when solving instance
 declarations, not in some arbitrary

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


More information about the ghc-tickets mailing list