Ticket #2708 (new feature request)

Opened 5 years ago

Last modified 4 years ago

Error message should suggest UnboxedTuples language extension

Reported by: tim Owned by:
Priority: low Milestone: _|_
Component: Compiler (Parser) Version: 6.9
Keywords: Cc: pho@…
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Difficulty: Unknown
Test Case: Blocked By:
Blocking: Related Tickets:

Description

If I compile this code:

module Foo where
import GHC.Integer

foo x y =
   case x `quotRemInteger` y of
    (# y, z #) -> 42

I get:

foo.hs:7:5: Parse error in pattern

It would be better if the error message suggested using -XUnboxedTuples.

Change History

Changed 5 years ago by simonpj

  • priority changed from normal to low
  • difficulty set to Unknown
  • milestone set to _|_

It would be better, yes. And usually I'm very keen to improve error messages.

The reason we don't is that -XUnboxedTuples tells the lexical analyser to recognise the lexemes (# and #). The idea is not to interfere with Haskell 98 when the extension is switched off.

For example (# 3) is a section in H98. So just seeing (# isn't enough to say "I suggest you use -XUnboxedTuples".

So that's why it's tricky. I can't see an easy way to give you want you ask.

Simon

Changed 4 years ago by PHO

  • cc pho@… added
Note: See TracTickets for help on using tickets.