[GHC] #11977: ghc doesn't agree with its own inferred pattern type

GHC ghc-devs at haskell.org
Wed May 18 07:19:48 UTC 2016


#11977: ghc doesn't agree with its own inferred pattern type
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.1
      Resolution:                    |             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):

 Here's is an odd thing, it works if you quantify it!

 {{{#!hs
 --   Doesn't work!
 -- pattern F :: b -> forall x. Char -> b
 -- pattern F a <- (($ 'a') -> a)

 --   Does work for some reason
 pattern F1 :: b -> forall x. Char -> b
 pattern F1 a <- (($ 'a') -> a)

 --   Wait what?
 pattern F2 :: b -> forall b. Char -> b
 pattern F2 a <- (($ 'a') -> a)
 }}}

 How does this play out

 {{{#!hs
 --   Inferred type
 f1 :: (forall (x :: k). Char -> b) -> b
 f1 (F1 x) = x

 --   Works exactly like:
 --
 --     f1 (($ 'a') -> x) = x
 --
 f1 :: (Char -> b) -> b
 f1 (F1 x) = x
 }}}

 with `F2`:

 {{{#!hs
 f2 :: (forall b. Char -> b) -> b1
 f2 (F2 x) = ...
 }}}

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


More information about the ghc-tickets mailing list