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

Plutarch: Using s type variable conflicts with the Plutarch scope s variable printed by default #231

Open
bladyjoker opened this issue Jun 20, 2024 · 0 comments
Labels
bug Something isn't working codegen plutarch All things Plutarch

Comments

@bladyjoker
Copy link
Collaborator

bladyjoker commented Jun 20, 2024

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)
@bladyjoker bladyjoker added bug Something isn't working codegen plutarch All things Plutarch labels Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working codegen plutarch All things Plutarch
Projects
Status: Todo
Development

No branches or pull requests

1 participant