Plutonomicon / plutarch-plutus

Typed eDSL for writing UPLC /ˈpluː.tɑːk/
MIT License
123 stars 63 forks source link

LambdaBuffers Plutarch Runtime cleanup #643

Open bladyjoker opened 7 months ago

bladyjoker commented 7 months ago

Some items for Plutarch if someone can take a look at that (NOTE: I don't use Data anywhere in naming because everything is Data, and on that note, imo Scott should have been explicitly named not Data which is much more prevalent)

  1. Missing PAssetClass

https://github.com/mlabs-haskell/lambda-buffers/blob/2181c9493ef7a15ca396f4a8bb9ed03dbf7c4c5d/runtimes/haskell/lbr-plutarch/src/LambdaBuffers/Runtime/Plutarch.hs#L60

  1. Missing PEither

https://github.com/mlabs-haskell/lambda-buffers/blob/2181c9493ef7a15ca396f4a8bb9ed03dbf7c4c5d/runtimes/haskell/lbr-plutarch/src/LambdaBuffers/Runtime/Plutarch.hs#L75

  1. Messed up PMaybe

https://github.com/mlabs-haskell/lambda-buffers/blob/2181c9493ef7a15ca396f4a8bb9ed03dbf7c4c5d/runtimes/haskell/lbr-plutarch/src/LambdaBuffers/Runtime/Plutarch.hs#L82

  1. Had to redefined PList as well

https://github.com/mlabs-haskell/lambda-buffers/blob/2181c9493ef7a15ca396f4a8bb9ed03dbf7c4c5d/runtimes/haskell/lbr-plutarch/src/LambdaBuffers/Runtime/Plutarch.hs#L668

  1. A bunch of missing instances throughout this module
SeungheonOh commented 7 months ago

I don't think we'll add PList here since it is a bit too specific in LB. Other things we will try to add in new, cleaned up prelude/ledger api

bladyjoker commented 7 months ago

I don't think we'll add PList here since it is a bit too specific in LB. Other things we will try to add in new, cleaned up prelude/ledger api

{- | PList because PBuiltinList misses `PAsData` on its constituents which causes type errors when used.
TODO(bladyjoker): Upstream these changes or fix PBuiltinList.
-}

How's that specific to LB? There's a bunch of types that appear to escape the mold for some reason that other types use. For example, some stuff requires PLift which is out of place. We should do a pass on all the types in the refactor and make sure they are aligned properly, and devoid of non-core classes.

SeungheonOh commented 7 months ago

What LB uses is Data-only list, PBuiltinList can contain things beyond just Data. Ideally we give AsData instance to PBuiltinList instead of adding new list type

bladyjoker commented 7 months ago

What LB uses is Data-only list, PBuiltinList can contain things beyond just Data. Ideally we give AsData instance to PBuiltinList instead of adding new list type

If that works, that would be great! Thank you