Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type synonym impossible to fully apply in type application #4531

Open
LiamGoodacre opened this issue Feb 2, 2024 · 2 comments
Open

Type synonym impossible to fully apply in type application #4531

LiamGoodacre opened this issue Feb 2, 2024 · 2 comments

Comments

@LiamGoodacre
Copy link
Member

Description

Possible kind inference funkiness going on with synonyms in type applications.

Using the same type expression in an annotation vs a type application works differently.

To Reproduce

try purescript

module Main where
import Prelude
import Type.Proxy (Proxy(..))

-- `i` will be determined when `x` is concrete
type F :: forall i . Row i -> Row i
type F x = ()

-- type checks; `i ~ Type`
y :: Proxy (F (() :: Row Type))
y = Proxy

-- fails:
--   Type synonym Main.F is partially applied.
--   Type synonyms must be applied to all of their type arguments.
z :: Proxy (F (() :: Row Type))
z = Proxy @(F (() :: Row Type))

type G = F (() :: Row Type)
-- also works
g :: Proxy G
g = Proxy @G

Expected behavior

z would also pass type checking.

PureScript version

0.15.13

@rhendric
Copy link
Member

rhendric commented Feb 2, 2024

Interestingly, this works:

z :: Proxy (F (() :: Row Type))
z = Proxy @(() :: Row Type)

Definitely a bug somewhere.

@natefaubion
Copy link
Contributor

-- `i` will be determined when `x` is concrete
type F :: forall i . Row i -> Row i
type F x = ()

type Z :: forall i . Row i -> Row i
type Z x = ()

-- fails:
--   Type synonym Main.Z is partially applied.
--   Type synonyms must be applied to all of their type arguments.
z :: Proxy (F (() :: Row Type))
z = Proxy @(Z (() :: Row Type))

Since the failure is in the type-application, my guess is that there is a kind-checker elaboration rule missing for type applications.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants