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

Wolfgang Jeltsch g9ks157k at acme.softbase.org
Fri Feb 1 16:05:16 EST 2008

Am Freitag, 1. Februar 2008 05:11 schrieben Sie:
> Wolfgang Jeltsch wrote:
> > Well, the representation (D1,D2,D9) might be considered more readable. 
> > It has the disadvantage of a fixed maximum size for the numbers.  Which
> > takes me to a point I had already considered some time ago: Wouldn’t it
> > be good if we had just a type
> >
> >     data Pair val1 val2 = Pair val1 val2
> >
> > and if then (val1,val2,…,valn) would just be syntactic sugar for this:
> >
> >     val1 `Pair` (val2 `Pair` (…(valn `Pair` ())…))
> I've thought of that too.. besides the asymmetry, the presence of
> _|_/seq makes them actually not equivalent though, unfortunately
> ~Isaac

With Ryan’s proposal (using strictness annotations) the new representation 
should be equivalent to the old one.  Or am I missing something?

Best wishes,

More information about the Haskell-Cafe mailing list