Plutonomicon / plutarch-plutus

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

The implications of scott encoded types in custom datums and redeemers #56

Closed TotallyNotChase closed 2 years ago

TotallyNotChase commented 2 years ago

Imagine PMaybe - it's represented with scott encoding. As in, it is not a BuiltinData. In due time, people are going to be implementing PIsDataRepr for their custom datums and redeemers - for easier and safer matching.

What happens when they try to use PMaybe in their custom datum/redeemer?

Do we implement PIsData for PMaybe? Doesn't that mean there are now 2 Plutus Core representations for PMaybe and room for ambiguity that cannot be caught in the type system?

Do we disallow usage of PMaybe in custom datum/redeemer by not implementing PIsData? Does that mean we need another PMaybe represented purely as builtin data? Won't it be a pain to work with both if certain APIs require one and not the other? Will that mean we'll need a way to convert between the two as well?

L-as commented 2 years ago

https://github.com/Plutonomicon/plutarch/pull/63#issuecomment-1006643987