Provide expression to wrap and unwrap sum types in Indigo
Clarification and motivation
While sum types with empty constructors can be used in Indigo, because are constants, like this:
data T = A | B | C
deriving stock (Generic)
deriving anyclass (IsoValue)
exampleContract :: IndigoContract Bool T
exampleContract _ = defContract do
storageVar @T =: A
There is no way to create sum types from constructors with a single field, like:
data T = A Bool | B | C
because there is a lack of an Indigo equivalent for Lorentz's wrap_
.
Moreover, it's also lacking the expression for unwrapping.
Acceptance criteria
Provide Indigo expressions for wrapping/unwrapping data to/from constructors of sum types that have a single field.
Edited by Pinto Pasquale