[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:07:33 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: |
-------------------------------------+-------------------------------------
Comment (by ocharles):
I actually believe the correct type of this pattern is
{{{#!hs
pattern Cast :: () => Typeable a => a -> T
pattern Cast a <- MkT (cast -> Just a)
}}}
But this is also rejected:
{{{
• Could not deduce (Typeable a0) arising from a use of ‘cast’
from the context: Typeable a
bound by a pattern with constructor:
MkT :: forall a. Typeable a => a -> T,
in a pattern synonym declaration
at ../foo.hs:9:19-38
The type variable ‘a0’ is ambiguous
• In the pattern: cast -> Just a
In the pattern: MkT (cast -> Just a)
In the declaration for pattern synonym ‘Cast’
}}}
I may be wrong with that type though.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12975#comment:1>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list