Skip to content

allow canceling semantics? #6

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
jdegoes opened this issue Mar 13, 2015 · 0 comments
Closed

allow canceling semantics? #6

jdegoes opened this issue Mar 13, 2015 · 0 comments
Labels
type: enhancement A new feature or addition.
Milestone

Comments

@jdegoes
Copy link
Contributor

jdegoes commented Mar 13, 2015

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.

@jdegoes jdegoes added the type: enhancement A new feature or addition. label Mar 13, 2015
@jdegoes jdegoes added this to the 1.0 milestone Mar 13, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement A new feature or addition.
Development

No branches or pull requests

1 participant