[Haskell-cafe] Re: Newbie question about tuples

Chung-chieh Shan ccshan at post.harvard.edu
Fri Jul 13 10:54:15 EDT 2007


peterv <bf3 at telenet.be> wrote in article <013301c7c54e$25232650$6f6972f0$@be> in gmane.comp.lang.haskell.cafe:
> I don't think Haskell has something like a "fixed-length array" or constant
> expressions that *must* be resolved at compile-time (like the N in the C++
> template)? Or like Digital Mars D's "static if" statement (which is a
> control-flow statement that *must* succeed at compile time)?

Actually, Haskell can do it one better: you can have fixed-length arrays
whose length is known only at run time.  That is, you can have the
compiler check that you will only be adding arrays with the same length,
but find out what that length is (and pass it around non-redundantly) at
run time.  (You can encode the same idea, more verbosely, using generics
in Java and C#.)

Please see (among other work):
http://ofb.net/~frederik/vectro/
http://www.cs.rutgers.edu/~ccshan/prepose/
http://www.eecs.usma.edu/webs/people/okasaki/icfp99.ps

-- 
Edit this signature at http://www.digitas.harvard.edu/cgi-bin/ken/sig
http://www.unaids.org/en/HIV_data/epi2006/
UNAIDS/WHO AIDS Epidemic Update: December 2006



More information about the Haskell-Cafe mailing list