Skip to content

Better error message when UnboxedTuples isn't enabled

Motivation

Suppose we have the following program:

main = case (# 10, 11 #) of
   (#     foo, bar #) -> print (foo,bar)

GHC will fail to compile with:

Test.hs:2:5: error: Parse error in pattern: #foo
  |
2 |    (#     foo, bar #) -> print (foo,bar)
  |     ^^^^^^^^^

Notice that GHC removes the spaces between "#" and "foo", which can be misleading.

Proposal

If the pattern starts with "#", maybe suggest to enable UnboxedTuples.

Don't remove the spaces between "#" and "foo" in the parse error.

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