[TM-2] Make types more strict
Description
- Added type parameter to instruction datatype and related. Refactor code correspondingly
- Use SYB approach for flattening
- Rename Data datatype to Value (because Data was too general and conflicted with
Data.Data
typeclass frombase
, also Value is more precise) - Fix some errors caused not strict types
- Tested
flattenInstr
x = IF_NONE
[PRIM_EX DROP,
SEQ_EX [
PRIM_EX SWAP,
PRIM_EX SWAP],
SEQ_EX [
SEQ_EX [PRIM_EX SWAP, PRIM_EX SWAP],
PRIM_EX SWAP,
SEQ_EX [PRIM_EX UPDATE, PRIM_EX UPDATE]
]
]
[SEQ_EX [PRIM_EX NEG, PRIM_EX MOD]]
flattenInstr x gives
IF_NONE [Op {unPrim = DROP},Op {unPrim = SWAP},Op {unPrim = SWAP},Op {unPrim = SWAP},Op {unPrim = SWAP},Op {unPrim = SWAP},Op {unPrim = UPDATE},Op {unPrim = UPDATE}] [Op {unPrim = NEG},Op {unPrim = MOD}]
Related issue(s)
https://issues.serokell.io/issue/TM-2
✅ Checklist for your Merge Request
Stylistic guide (mandatory)
-
My commits comply with the following policy. -
My code complies with the style guide.
Edited by Ilya Peresadin