mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 20:28:02 +00:00
fix order of Task.sequence
This commit is contained in:
parent
aabe75ff87
commit
78304a14c7
1 changed files with 5 additions and 3 deletions
|
@ -205,10 +205,12 @@ batch = \current -> \next ->
|
|||
##
|
||||
seq : List (Task ok err) -> Task (List ok) err
|
||||
seq = \tasks ->
|
||||
List.walkBackwards tasks (ok []) \state, task ->
|
||||
value <- task |> await
|
||||
|
||||
state |> map \values -> List.append values value
|
||||
init = ok (List.withCapacity (List.len tasks))
|
||||
|
||||
List.walkBackwards tasks init \state, task ->
|
||||
await task \value ->
|
||||
map state \values -> List.prepend values value
|
||||
|
||||
## Apply a task repeatedly for each item in a list
|
||||
##
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue