Skip to content

Semantics of Writer #16

@coclique

Description

@coclique

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions