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

Witherable instances #24

Open
Benjamin-McRae-Tracsis opened this issue Sep 9, 2024 · 1 comment
Open

Witherable instances #24

Benjamin-McRae-Tracsis opened this issue Sep 9, 2024 · 1 comment

Comments

@Benjamin-McRae-Tracsis
Copy link

I think it would be good to add an efficient Filterable and Witherable instance for vectors.

@konsumlamm
Copy link
Owner

Originally, the reason I didn't include filter/mapMaybe was that I thought the best implementation would depend on the predicate. However, upon benchmarking, it seems that using Data.List.filter, i.e.

filter f = fromList . Data.List.filter f . toList

is the fastest implementation overall (at least the fastest I can think of). I'm not sure about adding functions that just use list functions, since users can easily do that themselves and even combine multiple transformations without converting to vectors in between (though tbf, zip and zipWith are also implemented this way).

I'd also like to avoid a dependency on witherable, to keep the dependency footprint low.

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