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

Wolfgang Jeltsch g9ks157k at acme.softbase.org
Thu Feb 7 10:16:05 EST 2008

Am Donnerstag, 7. Februar 2008 15:56 schrieben Sie:
> Don't expect anything astonishing yet, but an initial version of the
> library can be found at
> http:/code.haskell.org/type-level
> To make reviewing easier I have put the haddock-generated documentation at
> http://code.haskell.org/~fons/type-level/doc/

Thanks for your effort.  From a quick look at the Haddock documentation, some 
questions/remarks arised.

Nat means “all natural numbers except zero” while Nat0 means “all natural 
numbers (including zero)”.  Since in computer science, natural numbers 
usually cover zero, we should use Pos instead of Nat and Nat instead of Nat0.

You seem to write 12 as 1 :+ 2 instead of () :+ 1 :+ 2.  But I think, the 
latter representation should probably be prefered.  With it, :+ always has a 
number as its left argument and a digit as its right.  Without the () :+ we 
get ugly exceptional cases.  You can see this, for example, in the instance 
declarations for Compare.  With the second representation, we could reduce 
the number of instances dramatically.  We would define a comparison of digits 
(verbose) and than a comparison of numbers based on the digit comparison (not 

:+ is already used as the constructor for complex numbers.  We should probably 
use some different operator.

Again, thanks for your work.

> […]

Best wishes,

More information about the Haskell-Cafe mailing list