List comprehension blocks don't preserve the order of vars and guards
- Dominant language
- Haskell
- Stars
- 1.3k
- Forks
- 201
- PR merge metrics
- No merged PRs in 30d
Description
**Shared Program**:
https://code.world/blocks#PYNCRqCIpHdD-Jh0PQZKMxw
https://code.world/#PLG3J8mHD49-0P8xn8qIiYA
**Description**
In list comprehension blocks, there's an assumption that guards must appear after all variables are declared. As shown in the first shared program, when you add a guard before another local variable declaration, it puts the guard at the end in the code portion. Also, if you open the mutator afterwards, it switches the order of the inputs so the guards are after the variables.
This assumption doesn't work for shadowed variables in list comprehensions which are perfectly valid. An example of this is the second shared program. Note the difference in the left and right picture based on the positioning of the guard
Contributor guide
Assessment
This issue has not been assessed yet.