[GHC] #12025: Order of constraints forced (in pattern synonyms, type classes in comments)

GHC ghc-devs at haskell.org
Mon May 9 07:45:42 UTC 2016


#12025: Order of constraints forced (in pattern synonyms, type classes in comments)
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:
            Type:  feature request   |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.1
  checker)                           |             Keywords:
      Resolution:                    |  TypeApplications PatternSynonyms
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  11513, 10928      |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 One possibility would be to use the same rules for pattern synonyms as for
 GADTs.  When you write a GADT
 {{{
 data A a where
   X :: A [xxx]
 }}}
 you mean
 {{{
 X :: forall t. forall xxx. (t~[xxx]) => A t
 }}}
 so that it matches against a value of type `A ty` for any `ty`.

 We could do the same for pattern synonyms, so that
 {{{
 pattern X' :: () => forall xxx.  A [xxx]
 }}}
 means precisely
 {{{
 pattern X' :: forall t. () => forall xxx. (t ~ [xxx]) => A t
 }}}
 Perhaps we could do without the leading `() =>`; I'm not sure.

 This doesn't deal with the whole issue (as Richard points out, GADTs
 themselves have a smaller problem), but it ameliorates it and makes it the
 same as GADTs.

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


More information about the ghc-tickets mailing list