Skip to content

Type synonym impossible to fully apply in type application #4531

Open

Description

@LiamGoodacre

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

Activity

  1. rhendric commented on Feb 2, 2024

    @rhendric
    Member

    Interestingly, this works:

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

    Definitely a bug somewhere.

  2. natefaubion commented on Feb 2, 2024

    @natefaubion
    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions