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

Add Task.seq and Task.forEach #19

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lukewilliamboswell
Copy link
Collaborator

This was recently added to basic-cli in roc-lang/basic-cli#156

@lukewilliamboswell lukewilliamboswell marked this pull request as ready for review January 18, 2024 23:59
@lukewilliamboswell
Copy link
Collaborator Author

Posted in zulip

There is an issue in CI I haven't seen before -- it should be totally unrelated to the changes in that PR. The surgical linker is unhappy with __umodti3. I've had a quick look and haven't resolved yet, posting here in case anyone else is able to look at this further. I'll circle back later, but want to progress some other things rn.

thread 'main' panicked at 'Undefined Symbol in relocation, (+4ef2, Relocation { kind: PltRelative, encoding: Generic, size: +20, target: Symbol(SymbolIndex(+88)), addend: +fffffffffffffffc, implicit_addend: false }): Ok(Symbol { name: "__umodti3", address: +0, size: +0, kind: Unknown, section: Undefined, scope: Unknown, weak: false, flags: Elf { st_info: +10, st_other: +0 } })', crates/linker/src/elf.rs:1486:25

Copy link
Contributor

@RMailaender RMailaender left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the description for seq doesn't fit.

Comment on lines +223 to +264
## Apply a task repeatedly to a list of items, and return a list of the resulting values
##
## ```
## authors : List ID
## getAuthor : ID -> Task Author [DbError]
##
## getAuthors : Task (List Author) [DbError]
## getAuthors = Task.list authors getAuthor
## ```
##
seq : List (Task ok err) -> Task (List ok) err
seq = \tasks ->
List.walk tasks (Task.ok []) \state, task ->
value <- task |> Task.await

state |> Task.map \values -> List.append values value
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the comment doesn't fit the implementation. It seems to me, Task.seq actually converts a List (Task ok err) to a Task (List ok) err.

Or is there a Task.list function missing here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @RMailaender

This implementation is copied from basic-cli. https://github.com/roc-lang/basic-cli/blob/307f1f91d984ac966cca75a40d403bdced1f05a6/platform/Task.roc#L227

I think if we are going to change this, we should discuss this further on zulip, and try to keep the API for basic-cli and basic-web server aligned.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants