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

PLift bidirectionality #130

Merged
merged 4 commits into from
Jan 18, 2022
Merged

PLift bidirectionality #130

merged 4 commits into from
Jan 18, 2022

Conversation

L-as
Copy link
Member

@L-as L-as commented Jan 18, 2022

L-as added 4 commits January 14, 2022 23:21
This makes `pconstant True` be inferred to be of type `Term s PBool`.

There is however an issue: deriving via seems to work quite suboptimally.

We need two derives because there are two type classes now:
```haskell
data PBool (s :: S) = PTrue | PFalse
  deriving (PUnsafeLiftDecl) via (DerivePLiftViaCoercible Bool PBool Bool)

deriving via (DerivePConstant Bool) PBool instance (PConstant Bool)
```

The issue then is that the instance is:
```haskell
instance (PConstant h, PConstanted h ~ DerivePLiftViaCoercible h p r, Coercible h r, PLC.DefaultUni `PLC.Includes` r) => PUnsafeLiftDecl (DerivePLiftViaCoercible h p r) where
```
`PConstanted h ~ DerivePLiftViaCoercible h p r` fails to hold, because `PConstanted h` is set by another
derive. I'm not sure whether this is easy to fix.

The reason I switched away from functional dependencies is ironically that it seemed
easier to make newtype derives work.

Is there any solution that doesn't involve TH?
@L-as
Copy link
Member Author

L-as commented Jan 18, 2022

@t1lde I fixed the issues, and I catched some unsoundness thanks to you!

@L-as L-as merged commit 56e6c6b into staging Jan 18, 2022
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 this pull request may close these issues.

1 participant