* Move auth checks up to the top-level for sharing with enlil
* Change handlers to use Backend monad rather than Handler
* Add some helpful Show/Eq instances
* Clarify runtime types
* Fix up Backend error outputs
There was a huge list of all the ops associated with numbers used to
serialize them, but there was no way to check that every POp was in the
list (and some were actually missing). Instead, use a function from POp
to number so that the coverage checker can complain if a new op is
added. Then the list is generated from the Enum/Bounded instances.
When a binding like:
let v = u
arose during the translation, the ANF could would simply rename v to
u. However, it was only doing it in the 'body' portion of the code,
not an associated context.
Previously in cases like:
let
f x = ...
g y = ... f ...
...
we would not save decompilation information for `g`, because it wouldn't
be possible to guarantee that the output of decompilation actually made
sense (for instance, if `g` is decompiled, it will not mention `f`.
However, this seems to block some useful documentation, even in cases
where it doesn't seem like such intermediate definitions would need to
be decompiled. So, it seems like a better trade-off to just allow
decompilation, and accept that some output might be difficult to
understand. Such output can be avoided when writing documentation.
1. Allow for serializing `Code` with builtin foreign references to
binary, using a mapping to the builtin name used. This is useful for
parsing the binary and emitting scheme within unison.
2. Fixed an encoding error where variable indexing was wrong. The
context maintained for serialization is stored backwards, but
simultaneous bindings of multiple variables were being pushed on in
order, which resulted in reversing the order of variables in some
cases.
Due to a missing case in the floating logic, definitions like:
f : ...
f x y z = ...
were being turned into:
f : ...
f =
g x y z = ...
g
Because the compiler thought the lambda needed to be floated out of the
signature ascription, as the original `f` is the same as:
f = (x y z -> ...) : ...
This is obviously not necessary, as the signature will be erased anyway,
and just results in extra indirection.