mlabs-haskell / mlabs-haskell/lambda-buffers
PlutusData typeclass implementation should be unconditionally printed during TyDef
Nobody has claimed this yet.
- Dominant language
- Haskell
- Stars
- 32
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
Description
@t4ccer
Alright, I have first maybe bug. If I have
sum NftMarketplaceRedeemer = Buy | Cancel
and run it through lbf-plutus-to-plutarch and try to compile, I'll get a GHC error saying
• No instance for (Plutarch.Prelude.PlutusType
NftMarketplaceRedeemer)
arising from the 'deriving' clause of a data type declaration
Possible fix:
use a standalone 'deriving instance' declaration,
so you can specify the instance context yourself
• When deriving the instance for (Plutarch.Show.PShow
NftMarketplaceRedeemer)
|
40 | deriving anyclass Plutarch.Show.PShow
| ^^^^^^^^^^^^^^^^^^
Of course adding derive PlutusData NftMarketplaceRedeemer fixes the issue, but I have a feeling that it should be caught before going to ghc
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the lbf-plutus-to-plutarch path that handles TyDef and inspect how the example sum type is rendered. Compare its generated declarations with the manual derive PlutusData NftMarketplaceRedeemer workaround, then compile the generated output. Done means the needed PlutusData-related declaration is emitted before GHC reports the missing PlutusType instance.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- haskell
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 42/100