rrb-vector icon indicating copy to clipboard operation
rrb-vector copied to clipboard

Witherable instances

Open Benjamin-McRae-Tracsis opened this issue 1 year ago • 1 comments

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

Benjamin-McRae-Tracsis avatar Sep 09 '24 09:09 Benjamin-McRae-Tracsis

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.

konsumlamm avatar Sep 11 '24 10:09 konsumlamm