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 asum #582

Open
masaeedu opened this issue Nov 27, 2018 · 1 comment
Open

Add asum #582

masaeedu opened this issue Nov 27, 2018 · 1 comment

Comments

@masaeedu
Copy link
Member

// :: (Foldable f, Plus g) => TypeRep g -> f (g a) -> g a
const asum = A => S.reduce(S.alt)(S.zero(A))
@masaeedu
Copy link
Member Author

I should note here that Flutures might be one common Alt that we wish to use this function with, however after some discussion in the Fluture chatroom it was concluded that it doesn't make much sense for the non-concurrent Fluture to implement the full Plus; instead it's only going to implement Alt.

To work with such instances, it might be better for asum to explicitly accept a zero case and weaken the constraint to:

// :: (Foldable f, Alt g) => f (g a) -> g a -> g a

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

1 participant