Skip to content

allow canceling semantics? #6

@jdegoes

Description

@jdegoes

The idea is something like this:

newtype Aff e a = Aff ((Error -> Eff e Unit) -> (a -> Eff e Unit) -> EffA e (Unit -> Aff e Unit)

So an Aff can decide to allow canceling. The semantics would be something along the lines of:

  1. Calling the cancel function does not guarantee canceling.
  2. If the cancel function succeeds, the Aff will error, not succeed.
  3. Cancelations in derived Aff would be propagated.

The main advantage is that IO can be aborted, e.g. the <|> combinator for Par can abort the other computation, which can lead to efficiency gains.

The public API would be something like:

killAff :: forall e a. Error -> Aff e a -> Aff e Boolean

Which returns a true if it's killed and a false otherwise. Or something like that.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions