Open jaccokrijnen opened 1 year ago
Why are annotations on Error
necessary in the first place? According to Manuel they are needed for having the principal type property while retaining a simple inference algorithm (reference: Practical Foundations Programming Languages (Harper))
The
Error t
term is annotated with its typet
. Therefore, typing could simply beHowever, this does not suffice for type preservation, Joris' thesis section 4.2.7, "Error": in the
eval
big-step relation, the annotation is supposedly not enough to determine the annotation on the result error where errors are propagated (e.g.Apply (Error T1) (Error T2) ==> Error ??
. Effectively, the big-step semantics need to be aware of the type of the expression it is evaluating.I think this could be solved by
eval
only evaluating well-typed terms, so there is no question about the resulting annotation on Error.So instead, the typing rule is currently:
which ignores the annotation. And the big-step rules then trivially preserve typing (with a non-sensical annotation)