mirror of
https://github.com/roc-lang/roc.git
synced 2025-08-04 12:18:19 +00:00
Rename Task.seq -> Task.sequence
This commit is contained in:
parent
bb9b7d22b5
commit
bdb50912b8
2 changed files with 6 additions and 6 deletions
|
@ -11,7 +11,7 @@ module [
|
|||
loop,
|
||||
fromResult,
|
||||
batch,
|
||||
seq,
|
||||
sequence,
|
||||
forEach,
|
||||
result,
|
||||
]
|
||||
|
@ -200,20 +200,20 @@ batch = \current -> \next ->
|
|||
## fetchAuthorTasks : List (Task Author [DbError])
|
||||
##
|
||||
## getAuthors : Task (List Author) [DbError]
|
||||
## getAuthors = Task.seq fetchAuthorTasks
|
||||
## getAuthors = Task.sequence fetchAuthorTasks
|
||||
## ```
|
||||
##
|
||||
seq : List (Task ok err) -> Task (List ok) err
|
||||
seq = \taskList ->
|
||||
sequence : List (Task ok err) -> Task (List ok) err
|
||||
sequence = \taskList ->
|
||||
Task.loop (taskList, List.withCapacity (List.len taskList)) \(tasks, values) ->
|
||||
when tasks is
|
||||
[task, .. as rest] ->
|
||||
value = task!
|
||||
Task.ok (Step (rest, List.append values value))
|
||||
|
||||
[] ->
|
||||
Task.ok (Done values)
|
||||
|
||||
|
||||
## Apply a task repeatedly for each item in a list
|
||||
##
|
||||
## ```
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue