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

GHC ghc-devs at haskell.org
Wed May 24 16:00:50 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):

 Ah what confused me was that they both (''seemingly'') allow extracting a
 polymorphic function

 {{{#!hs
 type Id = forall xx. xx -> xx

 one :: A -> Id
 one (A f) = f

 two :: B -> Id
 two (B (Endo f)) = f
 }}}

 But this doesn't work: (like your `f2 (L (Lam x)) = (x 'c', x True)`
 example demonstrates)

 {{{#!hs
 -- works
 einn :: A -> (Int -> Int, () -> ())
 einn (A f) = (f, f)

 -- fails
 tveir :: B -> (Int -> Int, () -> ())
 tveir (B (Endo f)) = (f, f)
 }}}

 With your desugaring and #11350

 {{{#!hs
 A (\@x -> id @x)
 B (\@x -> Endo @x (id @x))
 }}}

 it becomes clearer to me. Thanks!

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


More information about the ghc-tickets mailing list