Plutarch: Using `s` type variable conflicts with the Plutarch scope `s` variable printed by default
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 42/100
Research direction
Reproduce the issue with the ScriptDatum example and inspect the generator responsible for autogen/LambdaBuffers/Cardano/Extra/ScriptStorage/Validation/Plutarch.hs. Trace how the source type variable and Plutarch scope variable are named; done means generated Haskell uses distinct binders and compiles without the conflicting-definitions error.
Written by the indexing model from the issue text.
Description
Sample
record ScriptDatum s = {
scriptType : s,
-- ^ Protocol specific script type stored in this UTxO
redeemer : AssetClass
-- ^ Wallet containing `$redeemer` must sign the 'delete-script' transaction as an authorization method
}
derive Eq (ScriptDatum s)
derive PlutusData (ScriptDatum s)
derive Json (ScriptDatum s)
Error
> [1 of 2] Compiling LambdaBuffers.Cardano.Extra.OneShot.Validation.Plutarch ( autogen/LambdaBuffers/Cardano/Extra/OneShot/Validation/Plutarch.hs, dist/build/LambdaBuffers/Cardano/Extra/OneShot/Validation/Plutarch.o, dist/build/LambdaBuffers/Cardano/Extra/OneShot/Validation/Plutarch.dyn_o )
> [2 of 2] Compiling LambdaBuffers.Cardano.Extra.ScriptStorage.Validation.Plutarch ( autogen/LambdaBuffers/Cardano/Extra/ScriptStorage/Validation/Plutarch.hs, dist/build/LambdaBuffers/Cardano/Extra/ScriptStorage/Validation/Plutarch.o, dist/build/LambdaBuffers/Cardano/Extra/ScriptStorage/Validation/Plutarch.dyn_o )
>
> autogen/LambdaBuffers/Cardano/Extra/ScriptStorage/Validation/Plutarch.hs:31:18: error:
> Conflicting definitions for ‘s’
> Bound at: autogen/LambdaBuffers/Cardano/Extra/ScriptStorage/Validation/Plutarch.hs:31:18-38
> autogen/LambdaBuffers/Cardano/Extra/ScriptStorage/Validation/Plutarch.hs:31:40-56
> |
> 31 | data ScriptDatum (s :: Plutarch.PType) (s :: Plutarch.S) = ScriptDatum (Plutarch.Term s (Plutarch.Builtin.PAsData s))
> | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Workaround
Just use a different letter than s
record ScriptDatum a = {
scriptType : a,
-- ^ Protocol specific script type stored in this UTxO
redeemer : AssetClass
-- ^ Wallet containing `$redeemer` must sign the 'delete-script' transaction as an authorization method
}
derive Eq (ScriptDatum a)
derive PlutusData (ScriptDatum a)
derive Json (ScriptDatum a)
- Dominant language
- Haskell
- Stars
- 32
- Forks
- 1
- PR merge metrics
- No merged PRs in 30d
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.
More from mlabs-haskell/lambda-buffers
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
mlabs-haskell/lambda-buffers#296 ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
mlabs-haskell/lambda-buffers#295 ·
-
Difficulty 4/5 3-5 days Newbie friendliness 20/100
mlabs-haskell/lambda-buffers#294 ·
-
Dykstra HF Open
Difficulty 4/5 3-5 days Newbie friendliness 35/100
mlabs-haskell/lambda-buffers#293 ·
-
Nix-free path Opendevops
Difficulty 5/5 Over a week Newbie friendliness 25/100
mlabs-haskell/lambda-buffers#292 ·
All issues in mlabs-haskell/lambda-buffers
Similar issues
-
typst-0.12 Open
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
commercialhaskell/stackage#8127 ·
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
input-output-hk/haskell.nix#2573 ·
-
docs
Difficulty 1/5 Under an hour Newbie friendliness 85/100
-
needs triage type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100