Add support for `MAP` over `option a`
Clarification and motivation
Quoting from the official docs, starting with the ithaca
protocol:
The
MAP
instruction can now also be applied to values of typeoption a
. In this case the block of code given is executed if and only if the value at the top of the stack isSome a
. It should map the value at the top of the stack into a value of any typeb
. The block has access to the remainder of the stack also, but its type should remain unchanged. The result of the instruction is the stack returned by the applied block of code, where the value at the top is wrapped inSome
again. If the value at the top of input stack isNone
, the instruction does nothing. (MR !3574)
IOW, the MAP
instruction now works on option a
similarly to how the fmap
function works on Maybe a
Since ithaca
is supposed to be activated on mainnet
, we need to reflect these changes in morley
and lorentz
.
Note: this is tagged as breaking because the changes needed (or the lack thereof) will clearly change the behavior in a way that will cause failures on mainnet
. Any MR related to this issue should target the ithaca
branch instead of master
, before this new protocol is activated.
Acceptance criteria
The new behavior of the MAP
instruction mentioned above is supported in our libraries.