[GHC] #13430: Can't scope type variables when pattern matching on GADTs
GHC
ghc-devs at haskell.org
Thu Mar 16 14:28:13 UTC 2017
#13430: Can't scope type variables when pattern matching on GADTs
-------------------------------------+-------------------------------------
Reporter: crockeea | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.2
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
BTW here is a workaround:
{{{
bar :: Bar x -> String
bar x@(MkBar _)
= case x of
(x :: Bar (a, b)) -> show (typeRep (Proxy :: Proxy b))
}}}
Here, ''inside'' the pattern match for `MkBar` we make a new pattern-match
on `x`, and give it a scoped type signature.
Not beautiful but it works.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13430#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list