[Haskell-cafe] List comprehension order of evaluation

Maurí­cio briqueabraque at yahoo.com
Thu Oct 25 17:59:41 EDT 2007


Hi,

Today, if I write:

[a:[b] | a<-"ab" , b<-"12"]

I get:

["a1","a2","b1","b2"]

Are there any guarantees that I'll never
get ["a1","b1","a2","b2"] instead, i.e.,
that the first list will always be the
last one to be fully transversed? Even
if I use a different compiler or a
future version of Haskell?

Reading how list comprehensions are
translated in the Haskell report it
seems the answer is yes. Is that
written in stone? Can compilers do
it in their own different way?

Thanks,
Maurício



More information about the Haskell-Cafe mailing list