[Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

Bjorn Buckwalter bjorn.buckwalter at gmail.com
Thu Jan 31 13:49:38 EST 2008

Alfonso Acosta <alfonso.acosta <at> gmail.com> writes:

> 2) An implementation of type-level Naturals would really help. What
> has already been done?

I see you have received many suggestions already and personally I don't think
you can go wrong with Oleg (et al)'s implementations. For a decimal
representation you probably don't have much choice anyway!

For completeness let me mention that an unadvertised part of the Dimensional[1]
library is an implementation of type-level unary Integers[2] (as opposed to
Naturals). Addition, subtraction, multiplication and division is supported.

As I side note I've spent quite some time experimenting with fixed-size vectors
and matrices with heterogeneous elements. For this I've been using Oleg, Ralf
and Keean's HList[3] library which also has type-level unary Naturals.


[1] http://dimensional.googlecode.com
[2] http://www.buckwalter.se/~bjorn/darcs/dimensional/Numeric/NumType.lhs
[3] http://homepages.cwi.nl/~ralf/HList/

More information about the Haskell-Cafe mailing list