[Haskell-cafe] Re: List comprehension desugaring
apfelmus at quantentunnel.de
Sun Aug 19 08:38:13 EDT 2007
Neil Mitchell wrote:
> The Haskell desugaring for list comprehensions is given in:
> All the rules seem to be left to right rewrites, apart from the second
> one, which seems to be right to left. Is there some deep reason for
> this, or is this accidental.
Isn't the second rule left to right, too? The translation assumes that Q
is non-empty, so the three last rules don't match [e | q] but they match
[e | q, True]. The non-emptiness is probably for ruling out the invalid
list comprehension [e | ] which would otherwise appear as an
intermediate result in the translation for empty Q.
More information about the Haskell-Cafe