Grzegorz Chrupała
Grzegorz Chrupała

Reputation: 3083

Efficient conversion between boxed and unboxed vectors

What is the recommended way of converting between Data.Vector.Unboxed and Data.Vector. Specifically, I need to map a function over a vector which converts an unboxable element type such as Int to a non-unboxable one such as Text. I assume going through an intermediate list is not going to be very efficient.

Upvotes: 7

Views: 689

Answers (1)

Anthony
Anthony

Reputation: 3791

You can use the convert function from Data.Vector.Generic to change vector types, followed by a map to do the per-element conversion.

Upvotes: 12

Related Questions