[GHC] #12975: Suggested type signature for a pattern synonym causes program to fail to type check

GHC ghc-devs at haskell.org
Wed Dec 14 15:14:20 UTC 2016


#12975: Suggested type signature for a pattern synonym causes program to fail to
type check
-------------------------------------+-------------------------------------
        Reporter:  ocharles          |                Owner:
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.0.1
  checker)                           |             Keywords:
      Resolution:                    |  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:                    |
-------------------------------------+-------------------------------------
Changes (by mpickering):

 * keywords:  patternsynonyms => PatternSynonyms


Comment:

 The type signature you are looking for is...

 {{{#!hs
 pattern Cast :: Typeable b => b -> T
 pattern Cast a <- MkT (cast -> Just a)
 }}}

 `cast` has type `(Typeable a, Typeable b) => a -> Maybe b`, as `MkT`
 provides `Typeable a` for us, we require `Typeable b` in order
 to use the function.

 The inferred type is still wrong in HEAD. Thanks!

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


More information about the ghc-tickets mailing list