Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upUse List.foldr in Task.sequence #521
Conversation
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jvoigtlaender
Mar 14, 2016
Contributor
But you are returning the results in the wrong order. That is, the result list will be reversed in comparison to the current implementation.
|
But you are returning the results in the wrong order. That is, the result list will be reversed in comparison to the current implementation. |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
jvoigtlaender
Mar 14, 2016
Contributor
Use List.foldr instead, and you will also get a non-recursive implementation (using JavaScript looping), but retain correct semantics.
|
Use |
jvoigtlaender
changed the title from
Use List.foldl in Task.sequence
to
Use List.foldr in Task.sequence
Mar 14, 2016
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
turboMaCk
Dec 4, 2016
Contributor
This seems like iprovement to me. Original implementation does not use tail call. What is state of this?
|
This seems like iprovement to me. Original implementation does not use tail call. What is state of this? |
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
evancz
Jul 8, 2017
Member
I ended up merging #881 because that's the one I saw first after List.foldr was reimplemented in Elm.
|
I ended up merging #881 because that's the one I saw first after |
sgillis commentedMar 14, 2016
Using foldl instead of a recursive function prevents that we reach the maximum call stack size when sequencing a lot of tasks.