aiken-lang / aiken

A modern smart contract platform for Cardano
https://aiken-lang.org
Apache License 2.0
454 stars 84 forks source link

block expects on opaque types #875

Closed rvcas closed 5 months ago

rvcas commented 5 months ago

CleanShot 2024-03-12 at 17 36 45@2x

I figured that opaque does not need to affect the type equality

Quantumplation commented 5 months ago

Perhaps the error message can briefly explain what an opaque type is, and why this isn't allowed? (for example, I don't know the answer to either of those questions heh)

KtorZ commented 5 months ago
image
Quantumplation commented 5 months ago

:+1: on the error message <3

t0anh commented 5 months ago

Seems this causes unexpected effects. How should I deal with datums consisting Rational or Dict?

KtorZ commented 5 months ago

@t0anh These aren't unexpected effects, these are precisely the expected effects!

For Dict, you should pass an ordered list of key/values as an ordered list, and then use dict.from_ascending_list to turn it into a list.

For Rational, you should pass the numerator and denominator and then use rational.new to convert it back into a rational.