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

Result.sequence #519

Closed
berdario opened this Issue Mar 6, 2016 · 1 comment

Comments

Projects
None yet
2 participants
@berdario

berdario commented Mar 6, 2016

I couldn't find this when I needed, and I implemented it myself

resultSequence : List (Result x a) -> Result x (List a)
resultSequence xs = case xs of
    [] -> Ok []
    result :: rest -> Result.map2 (::) result (resultSequence rest)

I would expect this to be available, by simmetry with Task.

I haven't found anyone asking for this earlier in this bug tracker, but maybe it might still be of interest?

PS:

I just realized that there's a elm-result-extra... due to the policy of keeping elm-core lean, maybe this should be proposed to be included there, at first?

@jvoigtlaender

This comment has been minimized.

Show comment
Hide comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment