Provide a neat way to define IsoValue with a custom tree structure
Clarification and motivation
We generate IsoValue
instance for ADTs based on Generic
. Default Generic
instance uses right-balanced tree structure for ADTs and that's what we end up having. For example, for a tuple with five items (a, b, c, d, e)
we will have
pair
(pair a b)
(pair
c
(pair d e)
)
However, sometimes we need a different structure, for example it can be required by some interface that we should adhere to.
Some possible approaches:
- Define a custom
Generic
instance. AFAIK normally people don't do it, but we can try. If it appears to work well, I guess we can say that it's the standard way and document it. - Use TH and pass some kind of "strategy" to the TH generation function.
Acceptance criteria
There should be some convenient way to specify how exactly a complex ADT should map into Michelson types.
Edited by Ivan Gromakovskii