[Haskell-cafe] Suggestion for implementation of vector library

Don Stewart dons at galois.com
Tue Jun 17 11:40:32 EDT 2008

>    Hi guys,
>    Sorry for a silly questions but I didn't find a proper answer in Google.
>    I've started to learn Haskell and would like to implement a library for
>    work with vectors. I found different implementations of this stuff but all
>    of them made just for fun in a short as possible terms using lists or

The main serious implementation is probably hmatrix, blas or


>    tuples. I suppose there should be a better way to go. First idea came to
>    my mind was using of classes. Something like this:
>    data Vector3 = Vector3 (Float, Float, Float)

data Vector3 =
        Vector3 {-# UNPACK #-} !Double
                {-# UNPACK #-} !Double
                {-# UNPACK #-} !Double

Compile with -O2 -fvia-C -optc-O2 and keep them in registers.

-- Don

More information about the Haskell-Cafe mailing list