Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Efficient conversion between boxed and unboxed vectors

Tags:

haskell

vector

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.

like image 590
Grzegorz Chrupała Avatar asked Feb 24 '12 18:02

Grzegorz Chrupała


1 Answers

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

like image 196
Anthony Avatar answered Oct 24 '22 10:10

Anthony