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

Deriving HNodes (and friends) fails in the presence of PolyKinds #23

Open
expipiplus1 opened this issue Sep 19, 2024 · 0 comments · May be fixed by #24
Open

Deriving HNodes (and friends) fails in the presence of PolyKinds #23

expipiplus1 opened this issue Sep 19, 2024 · 0 comments · May be fixed by #24

Comments

@expipiplus1
Copy link

data Foo x h = Foo (h :# Foo x)
makeHNodes ''Foo
error: [GHC-83865]
    • Couldn't match kind ‘*’ with ‘AHyperType -> *’
      Expected kind ‘HyperType’, but ‘Foo k_a33nj x_a338w’ has kind ‘*’
    • In the first argument of ‘HNodes’, namely ‘(Foo k_a33nj x_a338w)’
      In the instance declaration for ‘HNodes (Foo k_a33nj x_a338w)’
   |
73 | makeHNodes ''Foo
   | ^^^^^^^^^^^^^^^^

the expansion:

instance HNodes (Foo k_a35oD x_a35ah) where
  type
    forall constraint.
      HNodesConstraint (Foo k_a35oD x_a35ah) constraint =
        Solo
          constraint
          (Foo x_a35ah)
  type HWitnessType (Foo k_a35oD x_a35ah) = W_Foo k_a35oD x_a35ah
  {-# INLINE hLiftConstraint #-}
  hLiftConstraint (HWitness W_Foo_Foo_x) = \_ r_a3727 -> r_a3727

data W_Foo (k_a35oD :: Kind.Type) (x_a35ah :: k_a35oD) node where
  W_Foo_Foo_x :: W_Foo k_a35oD x_a35ah (Foo x_a35ah)
)

the corrected expansion (the kind signatures and kind variables removed)

instance HNodes (Foo x_a35ah) where
  type
    forall constraint.
      HNodesConstraint (Foo x_a35ah) constraint =
          constraint
          (Foo x_a35ah)
  type HWitnessType (Foo x_a35ah) = W_Foo x_a35ah
  {-# INLINE hLiftConstraint #-}
  hLiftConstraint (HWitness W_Foo_Foo_x) = \_ r_a3727 -> r_a3727

data W_Foo  x_a35ah node where
  W_Foo_Foo_x :: W_Foo x_a35ah (Foo x_a35ah)
expipiplus1 added a commit to expipiplus1/hypertypes that referenced this issue Sep 19, 2024
expipiplus1 added a commit to expipiplus1/hypertypes that referenced this issue Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant