[GHC] #9858: Typeable instances should be kind-aware

GHC ghc-devs at haskell.org
Thu Apr 16 21:15:27 UTC 2015


#9858: Typeable instances should be kind-aware
-------------------------------------+-------------------------------------
        Reporter:  dreixel           |                   Owner:
            Type:  bug               |                  Status:  merge
        Priority:  highest           |               Milestone:  7.10.2
       Component:  Compiler          |                 Version:  7.9
      Resolution:                    |                Keywords:
Operating System:  Unknown/Multiple  |            Architecture:
 Type of failure:  None/Unknown      |  Unknown/Multiple
      Blocked By:                    |               Test Case:
 Related Tickets:                    |  typecheck/should_fail/T9858a,
                                     |  should_run/T9858b
                                     |                Blocking:
                                     |  Differential Revisions:  Phab:D652
-------------------------------------+-------------------------------------

Comment (by simonpj):

 In conversation we had the staggeringly lovely idea of writing a bunch of
 classes thus:
 {{{
 class (c1,c2) => (,) c1 c2
 class (c1,c2,c3) => (,,) c1 c2 c3
 }}}
 etc.  I have written the class constructors prefix to stress that we are
 defining a ''class'' `(,)` etc, but we could equally well say
 {{{
 class (c1,c2) => (c1,c2)   -- Ha ha ha
 }}}
 Now the point is this:

  * `c1` and `c2` are simply superclasses of the class `(c1,c2)`.

  * The defined class `(,)`, of course, has kind `Constraint -> Constraint
 -> Constraint`.

  * This class is distinct from the data type `(,)`.  It is just spelled
 the same way (confusingly perhaps, but that ship has sailed).

  * All the usual rules for superclasses apply. If you have the class
 `(c1,c2)` then you can extract the superclasses `(c1,c2)`.

  * If you grep for `TuplePred` in GHC you'll find quite a bit of code.
 All of this can be deleted; the existing superclass machinery will do the
 job just fine.

 I like this.

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


More information about the ghc-tickets mailing list