[GHC] #13735: RankNTypes don't work with PatternSynonyms

GHC ghc-devs at haskell.org
Wed May 24 13:34:37 UTC 2017


#13735: RankNTypes don't work with PatternSynonyms
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  closed
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.0.1
      Resolution:  invalid           |             Keywords:
                                     |  PatternSynonyms
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 Iceland_jack):

 There is where my intuition breaks down. Writing this works, so higher-
 rank types + pattern synonyms are fine

 {{{#!hs
 newtype A = A (forall xx. xx -> xx)

 pattern PatA :: (forall xx. xx -> xx) -> A
 pattern PatA a = A a

 a :: A -> A
 a (PatA f) = A f
 }}}

 but I don't understand why this is different

 {{{#!hs
 newtype Endo a = Endo (a -> a)

 newtype B = B (forall xx. Endo xx)

 pattern PatB :: (a -> a) -> PatB
 pattern PatB f <- B (Endo f)

 b :: B -> forall xx. xx -> xx
 b (B (Endo f)) = f
 }}}

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


More information about the ghc-tickets mailing list