IntersectMBO / IntersectMBO/plutus

`deriveEq` and `makeLift` don't work with a phantom type parameter of a user-defined kind

Open
#4,537 3 comments 0 reactions 0 assignees View on GitHub
Low priority status: triaged
Dominant language
Haskell
Stars
1.6k
Forks
508
Avg merge
3d 10h
Merged PRs (30d)
22

Description

### Describe the feature you'd like

Here's an example I'd like to work:

```
data TokenType = SaleToken
| PaymentToken
| ...
deriving (Eq, Show)

newtype TokenAC (t :: TokenType) = TokenAC { getTokenAC :: Ledger.AssetClass } deriving (...)

PlutusTx.Deriving.deriveEq ''TokenAC
PlutusTx.makeLift ''TokenAC
```
Unfortunately the last two lines of code don't work.

### Describe alternatives you've considered

The issue with `deriveEq` it that it doesn't like any phantom type parameter, but that's easy to work around with an explicit `instance PlutusTx.Eq.Eq` declaration. The `makeLift` is not so easily replaced, and the only workaround I currently have is to drop the use of `DataKinds` and use empty `data` declarations instead:

```
data PaymentToken
data SaleToken
...
newtype TokenAC (t :: Type) = TokenAC { getTokenAC :: Ledger.AssetClass } deriving (...)
```

This works but it's less type-safe, so this constraint should be lifted if possible.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.