Implement generic `update`-ing expressions in Indigo
Clarification and motivation
There are some oddities in the updating expressions/operators in Indigo:
-
Map
s only have one operator^~
, that acceptsMaybe
, and a correspondingExpr
constructor,MapUpdate
-
BigMap
s have multiple operators, to useMaybe
, to remove only, and to insert only. These are all based on the sameBigMapUpdate
Expr
constructor -
Set
s have an operator to insert only and one to remove only, each with its corresponding constructor
What's more is that all these Expr
constructors are compiled to the same update
Lorentz instruction, which is polymorphic.
It would be nice to have more consistency and simplify this approach.
Acceptance criteria
Instead of having the current structure-specific operator/expression and Expr
constructor, there should be:
- one generic
Expr
constructor that compiles to Lorentz'supdate
- one generic "updating" operator that simply uses that constructor
- one generic "inserting" operator based on that constructor (or even better on the previous operator)
- one generic "deletion" operator too, like the one above
Note that updating implementation for Map
is already based on the generic UpdOpHs
, so a good chuck of this may just require some refactoring.