Skip to content
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

Task and Coeval need foreach and foreachL #236

Closed
alexandru opened this issue Oct 9, 2016 · 0 comments
Closed

Task and Coeval need foreach and foreachL #236

alexandru opened this issue Oct 9, 2016 · 0 comments
Assignees
Milestone

Comments

@alexandru
Copy link
Member

Task and Coeval need foreach and foreachL methods.

The foreachL operator behaves like map, except that it yields a Task[Unit] and a Coeval[Unit]. And foreach will trigger the evaluation. In case of Task it has to take a Scheduler as an implicit parameter and return a CancelableFuture[Unit], since it cannot be blocking.

Task example:

val task = Task(1 + 1)

// Lazy foreachL
val unit: Task[Unit] = task.foreachL(x => println(x))

// Strict foreach
for (r <- task) println(r)

Coeval example:

val coeval = Coeval(1 + 1)

// Lazy foreachL
val unit: Coeval[Unit] = coeval.foreachL(x => println(x))

// Strict foreach
for (r <- coeval) println(r)
@alexandru alexandru added this to the 2.1.0 milestone Oct 9, 2016
@alexandru alexandru self-assigned this Oct 9, 2016
alexandru added a commit that referenced this issue Oct 29, 2016
Issues included:

- #239: `Task.flatMap` loops should not be auto-cancelable by default
- #226: Add Task.Options with an `autoCancelableRunLoops property`
- #227: Add executeWithFork, executeWithModel and asyncBoundary operators on Task
- #232: Task should use TrampolinedRunnables everywhere it can
- #236: Task and Coeval need `foreach` and `foreachL`
- #238: Add `Coeval.Attempt.get`
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant