Greg Fitzgerald | 22 Nov 00:22 2012
Picon

fixed-length bit-vectors

Hi all,

My goal, eliminate the failure case in 'byte':

 https://gist.github.com/4128503

I don't want my 'byte' function to fail at runtime or return $ Left
"vector not 8 bits".  I want it to return a Word8 for an 8-bit
bit-vector or not compile.

Is there an existing library that offers fixed-length vectors as a
thin veneer over the 'vector' package?  I see 'vector-static', but it
is unmaintained and hasn't been touched in years.  Alternatively,
there's 'VecN', but having already learned 'vector', I'd like to know
if there is an existing solution that uses it.

Thanks,
Greg
Aleksey Khudyakov | 22 Nov 11:03 2012
Picon

Re: fixed-length bit-vectors

On 22 November 2012 03:22, Greg Fitzgerald <garious <at> gmail.com> wrote:
> Hi all,
>
> My goal, eliminate the failure case in 'byte':
>
>  https://gist.github.com/4128503
>
> I don't want my 'byte' function to fail at runtime or return $ Left
> "vector not 8 bits".  I want it to return a Word8 for an 8-bit
> bit-vector or not compile.
>
> Is there an existing library that offers fixed-length vectors as a
> thin veneer over the 'vector' package?  I see 'vector-static', but it
> is unmaintained and hasn't been touched in years.  Alternatively,
> there's 'VecN', but having already learned 'vector', I'd like to know
> if there is an existing solution that uses it.
>
I'm not aware about such package. But you may want to take a look
at fixed-vector[1]. It's not wrapper over vector but it have similar API.
It also quite young and  may lack features.

[1] http://hackage.haskell.org/package/fixed-vector

Gmane