GHC 9.10 introduces the ability to use invisible type patterns. As such, examples like this can now be written:
id :: a -> a
id @t x = x :: t
As a preliminary, we'd need a th-desugar counterpart to InvisP, which was introduced in template-haskell-2.22.0.0 (shipped with GHC 9.10.1):
data Pat
= ...
| InvisP Type -- ^ @{ @p }@
Note that @-binders can also be used in lambda expressions and \cases expressions, which means that it is possible to write things like the following:
aux :: (forall a. a -> a) -> ()
aux z = z ()
f :: ()
f = aux (\ @a (x :: a) -> x :: a)
g :: forall a -> Maybe a -> a -> a
g = aux (\cases @a (x :: a) -> x :: a)
This means that @-binders are susceptible to challenges (1) and (2) from #204. (Thankfully, it's not susceptible to challenge (3), since invisible type patterns are always clearly marked with @.)
211 implemented partial support for invisible type patterns. You can now desugar invisible type patterns in function clauses, but not in lambda expressions or \cases expressions. I've retitled this issue to track the remaining task of supporting invisible type patterns in lambda and \cases expressions.
GHC 9.10 introduces the ability to use invisible type patterns. As such, examples like this can now be written:
As a preliminary, we'd need a
th-desugar
counterpart toInvisP
, which was introduced intemplate-haskell-2.22.0.0
(shipped with GHC 9.10.1):Note that
@
-binders can also be used in lambda expressions and\cases
expressions, which means that it is possible to write things like the following:This means that
@
-binders are susceptible to challenges (1) and (2) from #204. (Thankfully, it's not susceptible to challenge (3), since invisible type patterns are always clearly marked with@
.)