[GHC] #12240: Common Sense for Type Classes

GHC ghc-devs at haskell.org
Tue Jul 5 14:56:39 UTC 2016


#12240: Common Sense for Type Classes
-------------------------------------+-------------------------------------
        Reporter:  Mathnerd314       |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:                    |             Keywords:
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by goldfire):

 Two quite separate reactions to this:

 1. You can already do what you want, if you rephrase your instance. From
 the initial post:

 {{{#!hs
 instance (a ~ Int, b ~ Char) => C a b where ...
 }}}

    will have the behavior you want. The idea is that you're creating a
 universal instance (i.e., one that matches any pair of types) but then GHC
 must solve `a ~ Int` and `b ~ Char`, which will unify your type variables.

 2. As a "GHC Insider", I'm quite leery of blocking the door to "GHC
 Outsiders". See
 [https://www.reddit.com/r/haskell/comments/4isua9/ghc_development_outsidein/
 this provocation] and
 [https://ghc.haskell.org/trac/ghc/blog/ContributingToGhc Simon's
 response]. I am in full agreement with Simon that we must do better here.
 However, adding a new feature to GHC is very, very expensive. Phabricator
 has well-written reasons why; see "Rejecting patches" on
 [https://secure.phabricator.com/book/phabcontrib/article/contributing_code/
 this page]. (My reference to Phab here is technically unrelated to GHC's
 use of Phab. It's just that Phab is another open source project, and its
 articulation of barriers to entry is much more advanced than GHC's.) At
 the moment, the original poster has gotten other member of the community
 to say that they wouldn't actively block the implementation of your idea;
 I'm afraid this is hardly a ringing endorsement.

     You ask about another place to post. I see a bunch of proposals go
 through [https://mail.haskell.org/mailman/listinfo/haskell-cafe Haskell-
 cafe], where the level of discourse is quite high (as with all Haskell
 venues I've seen -- a wonderful aspect of our community!). But I don't
 want you to waste time posting in yet another place, because I tend to
 doubt that your patch will be accepted without the support of some more
 prominent, long-standing members of our community.

     A final point here is that the door from "GHC Outsider" to "GHC
 Insider" is surely open. The best way to nudge your way in, I think, is to
 find a feature request that is smallish and already has support. Implement
 that feature. You'll learn a whole lot about the compiler, and hopefully
 make a friend or two in the process. Repeat. After a few patches, you'll
 be well on your way to "GHC Insider".

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


More information about the ghc-tickets mailing list