Generic library for vectors with statically known size. It's able to work with product types where types of all elements are same. For example following type could be used:
data Vec3 a = Vec3 a a a
Tuples of same types work as well:
>>> sum (1,2,3)
6
Library provides set of vector parametrized by length. Boxed, unboxed and storable vectors are all supported.
Basic idea is to establish isomorphism between N-element vector and its Church
encoding (∀r. (a → a → r) → r
for 2-element vector) and all functions work on
Church-encoded vectors. This allows to decouple functions from representation of
vectors and allows to implement deforestation.
Downside of this approach is inability to work with vectors larger than tens of elements. If you need larger vectors vector-sized could provide similar functionality.
Please report bugs via github issue tracker
Library is written and maintained by Aleksey Khudyakov alexey.skladnoy@gmail.com