You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This is a problem with identifiers scope definition when parsing a comprehension. All identifiers are declared on a global scope and therefore there is a strict mode enabled after the first generator is parsed to enforce that every identifier must be first declared and than used. However, the second example shows that this causes an issue.
Also because of all the identifiers are declared within a global scope, the following comprehensions are valid and work, but don't make much sense:
$ bin/comp '[ b | b <- [ c | c <- [2,3]], c == 3 ]'
[ 2, 3 ]
$
$ bin/comp '[ b | b <- [ c | c <- [2,3], c == 2], b == c ]'
$
The following expressions works fine:
[ {b, a} | b <- [0,1], a <- [2,3] ]
but this one fails with a compilation error:
[ {b, a} | b <- [0,1], a <- [ c | c <- [2,3]] ]
The text was updated successfully, but these errors were encountered: