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

haskell's sequence #200

Open
dustingetz opened this issue May 2, 2017 · 2 comments
Open

haskell's sequence #200

dustingetz opened this issue May 2, 2017 · 2 comments

Comments

@dustingetz
Copy link

What's the idiomatic way to turn list-of-maybe into maybe-list? I believe promesa calls this p/all (but defers to native implementation), how do I do this on Maybe or Exception?

@dustingetz
Copy link
Author

dustingetz commented May 2, 2017

Here is an answer with concrete types for the next guy:

(->> [(exception/success 1) #_(exception/failure 42) (exception/success 2)]
     (reduce #(mlet [acc %1 v %2] (cats/return (conj acc v))) (exception/success [])))
=> #<Success [1 2]>
(->> [(exception/success 1) (exception/failure 42) (exception/success 2)]
     (reduce #(mlet [acc %1 v %2] (cats/return (conj acc v))) (exception/success [])))
=> #<Failure #error {:message "", :data 42}>

Shouldn't this be provided by the library?

@yurrriq
Copy link
Collaborator

yurrriq commented May 2, 2017

👍 for generic sequence and traverse for all functorial types f t where (satisfies? Seqable t).

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

No branches or pull requests

2 participants