Skip to content

Type variable in pattern binds invisible forall variable

Summary

Given A :: forall {k :: Type} (a :: k). A, f (A @x) = ... binds k as x, even though A @x in an expression binds a as x.

Steps to reproduce

import Data.Proxy (Proxy (Proxy))

f :: Read a => Proxy a -> ()
f _ = ()

g :: Read a => Proxy a -> ()
g (Proxy @_ @a) = f (Proxy @a)

Expected behavior

This should err, and instead, g (Proxy @a) = f (Proxy @a) should be correct.

Environment

  • GHC version used: 9.2.4
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information