Skip to content

Semantics of interpose #19

@coclique

Description

@coclique

interpose currrently has the "local" semantics of swapping handlers. That is, effects introduced outside of the scope of interpose will not have their dependency handlers swapped. This allows us to "overlay" behaviors on existing handlers.

However, it is also useful to have the "global" semantics of swapping handlers: all effects, in scope or out of scope, will have their dependency handlers swapped. This behavior is crucial in the implementation of scoped effects.

replace :: e :> es => Handler e es -> Eff es ~> Eff es
replace handle m = Eff \es@(Env _ re _) ->
  let ix = Rec.index re
  in unEff m $ updateEnv ix (mkInternalHandler ix es m)

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