Skip to content

UX: Weird error message for enumeration [A..B]

data D = A | B deriving (Eq, Enum)
test = (`elem` [A..B])

gives weird error messages:

    Not in scope: ‘A..’
    No module named ‘A’ is imported.
  |
2 | test = (`elem` [A..B])
  |                 ^^^

    A section must be enclosed in parentheses thus: (A.. B)
  |
2 | test = (`elem` [A..B])
  |                 ^^^^

The first error is somewhat excused from a developer perspective: we all know our parsers are not perfect. Still, might confuse beginners. The second error is clearly a WAT.

(Workaround: [A ..B] space after A) I experience these errors with GHC 8.6.4, but also back till 7.6.3.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information