[GHC] #14288: ScopedTypeVariables with nested foralls broken since 8.0.2
GHC
ghc-devs at haskell.org
Mon Oct 2 12:43:38 UTC 2017
#14288: ScopedTypeVariables with nested foralls broken since 8.0.2
-------------------------------------+-------------------------------------
Reporter: MikolajKonarski | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler (Type | Version: 8.2.1
checker) |
Resolution: | Keywords:
Operating System: Linux | Architecture: x86_64
Type of failure: GHC rejects | (amd64)
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by RyanGlScott):
Actually, the issue I mentioned about pattern synonyms applies //today//.
That it, this typechecks:
{{{#!hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
data T a where
MkT :: forall a b. (Show b) => a -> b -> T a
pattern ExNumPat :: forall a. (Num a, Eq a) => forall b. (Show b) => b ->
T a
pattern ExNumPat x <- MkT 42 x where
ExNumPat x = MkT @a 42 x
}}}
But this (with `@b`) doesn't!
{{{#!hs
{-# LANGUAGE GADTs #-}
{-# LANGUAGE PatternSynonyms #-}
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE TypeApplications #-}
data T a where
MkT :: forall a b. (Show b) => a -> b -> T a
pattern ExNumPat :: forall a. (Num a, Eq a) => forall b. (Show b) => b ->
T a
pattern ExNumPat x <- MkT 42 x where
ExNumPat x = MkT @a @b 42 x
}}}
Moreover, there's no workaround for this, since one can't combine the two
`forall`s in the pattern signature for the reasons discussed in comment:6.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14288#comment:11>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list