Writer is probably the strangest "classical" effect, in the sense that it is both mutable (tell) and scoped (listen and pass).
This means we have 3 distinct semantics for listen:
tell in listen appends to main accumulator immediately;
tell in listen appends to an alternative accumulator that is later "merged" into the main one. On error, the merge still happens.
- Same as above, but on error, the merge never happens.
And 2 distinct semantics for pass:
tell in pass appends to an alternative accumulator and later merged into the main one. On error, the merge still happens.
- Same as above, but on error, the merge never happens.
If we make censor a primitive operation on its own rights, then it has 2 semantics:
- Same with the
mtl definition, inheriting whatever the semantics pass has.
- Same with
eff, apply the transformation function on each individual output. Modulo errors, this coincides with the mtl definition only when the the transformation is a homomorphism.
Writeris probably the strangest "classical" effect, in the sense that it is both mutable (tell) and scoped (listenandpass).This means we have 3 distinct semantics for
listen:tellinlistenappends to main accumulator immediately;tellinlistenappends to an alternative accumulator that is later "merged" into the main one. On error, the merge still happens.And 2 distinct semantics for
pass:tellinpassappends to an alternative accumulator and later merged into the main one. On error, the merge still happens.If we make
censora primitive operation on its own rights, then it has 2 semantics:mtldefinition, inheriting whatever the semanticspasshas.eff, apply the transformation function on each individual output. Modulo errors, this coincides with themtldefinition only when the the transformation is a homomorphism.