[#793] Extend `Expression` type
Description
LIGO has learned how to add debug output to Michelson code. It does that via Micheline, so we need to extend our Expression
type to be able to accept the extra data.
This is the first part of #793 (closed) where I apply the Trees That Grow technique (or something similar to it) and split the current Expression
into extendable Exp
and a different Expression
type with the old behaviour but defined in terms of Exp
.
I also add a test matching my use case - a debug metadata attached to each node of Micheline expression.
Please see the commits' descriptions.
In the second part of #793 (closed) I'm planning to extend the untyped representation and typechecking so that I can pass the debug metadata through our dataflow right to Typed.Instr
.
Concerns
I'm still unsure regarding this fromExpression @_ @a
, the leading @_
is quite annoying. I see 3 ways to handle this:
- Avoid type annotations at all in most cases. Use
res :: type <- fromExpression ...
instead where it does not make the code more verbose. - Flip the order of type arguments in
FromExpression
typeclass. That seems counter-intuitive to me, I'd like to avoid that. - Treat it as fine.
Related issue(s)
Resolves (partially) #793 (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.