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

GHC ghc-devs at haskell.org
Sat May 7 01:52:56 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 Iceland_jack):

 Another place I've discovered this is in type classes (I want to hear
 about other cases), let's say that for what ever reason want to supply the
 type `a` first but we can't (by design)

 {{{#!hs
 class P p where
   q_ :: forall a. p a -> Int

 instance P Maybe where
   q_ :: forall a. Maybe a -> Int
   q_ = length
 }}}

 Unlike the pattern synonym case this can be remedied by new function

 {{{#!hs
 q :: forall a p. P p => p a -> Int
 q = q_
 }}}

 Users will have to define a different method than they use, it's inelegant
 but it works. This isn't a problem if we allow signatures with explicit
 quantification for type classes #11620

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


More information about the ghc-tickets mailing list