-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

m...@justinbogner.com wrote:
| Jake McArthur <j...@pikewerks.com> writes:
|> The problem with your description is that you said "and then." The
|> result will be generated lazily. There is no sequencing here. Consider:
|>
|> ~    do x <- [0..]
|> ~       y <- [0..9]
|> ~       return (x, y)
|>
|> Which list is generated first?
|>
|
| This is an implementation detail, since y has no dependency on x the
| compiler's free to reorder instructions, as it would be an imperative
| language. Semantically this means do x and then y

That the order does not matter is definitely not an implementation
detail. Order not mattering is exactly what declarative programming is
about. The semantics of the above expression are the same as this:

~    (<$> [0..9]) . (,) =<< [0..]

There is no "do X and then do Y," only "this is what I want."
Declarative semantics. As I said, just because do notation makes it look
imperative doesn't mean it actually is.

| Just because the compiler is allowed (and even encouraged) to change the
| sequence where that won't change the results, considering this a
| sequence is still valid and meaningful.

It can be helpful sometimes, but I don't think it should be the standard
way to think of bind. There are too many cases when it makes little
sense as a sequencing operator.

- - Jake
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iEYEARECAAYFAkmLTPEACgkQye5hVyvIUKkoCACgz/IYvxa6PoEvuqgxljGAwZ8+
TXQAn30MyLDwhLyZV3+dRuJvttx93ZNh
=P9em
-----END PGP SIGNATURE-----
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to