[#330] add wrap and unwrap expressions for sum types constructors
Description
Adds expression to Indigo to perform wrapping and unwrapping of values to/from single-field constructors of sum types.
For example:
data T = A Bool | B Natural
deriving stock Generic
deriving anyclass (IsoValue, HasAnnotation)
exampleContract :: IndigoContract Bool T
exampleContract param = defContract do
storageVar @T =: wrap #cA param
_boolean <- new$ unwrap #cA (storageVar @T)
return ()
Related issue(s)
Resolves #330 (closed)
✅ Checklist for your Merge Request
Related changes (conditional)
-
Tests (see short guidelines)
-
If I added new functionality, I added tests covering it. -
If I fixed a bug, I added a regression test to prevent the bug from silently reappearing again.
-
-
Documentation
Stylistic guide (mandatory)
-
My commits comply with the following policy. -
My code complies with the style guide.
Edited by Pinto Pasquale