Opened 10 years ago

Last modified 12 months ago

#1318 new feature request

add warning for prefix negate operator and flag to replace it with negative numeric literals

Reported by: Isaac Dupree Owned by:
Priority: normal Milestone:
Component: Compiler (Parser) Version: 6.6.1
Keywords: Cc:
Operating System: Unknown/Multiple Architecture: Unknown/Multiple
Type of failure: Incorrect warning at compile-time Test Case:
Blocked By: Blocking:
Related Tickets: Differential Rev(s):
Wiki Page:


This is tracking a few things relating to the notion that Haskell's single prefix operator, "-", should not exist and "-1" should parse as a single token anyway. See

If there is a LANGUAGE option for this, what should it be called; and what should the ghc flags be called? Should turning off prefix negation and turning on negative numeric literals be separately controllable? This sort of question (exactly what should be implemented) is probably half the difficulty here.

Change History (5)

comment:1 Changed 10 years ago by Isaac Dupree

  • Milestone changed from 6.8 to _|_
  • Owner Isaac Dupree deleted

Work here is pending a specific proposal of what to implement, that there is consensus on. I'm not sure exactly what I want, and (given how my summer is turning out) I'm not really feeling up to making proposals for that. Anyone who wants this pursued further should do so (at which point I might implement that).

Well, there is one thing -fwarn-all-unary-minus that seems straightforward enough, if anyone else hates their semantics as well as syntax that much?

comment:2 Changed 8 years ago by simonmar

  • Architecture changed from Unknown to Unknown/Multiple

comment:3 Changed 8 years ago by simonmar

  • Operating System changed from Unknown to Unknown/Multiple

comment:4 Changed 4 years ago by morabbin

  • Type of failure set to None/Unknown

Bump; still of interest?

comment:5 Changed 12 months ago by thomie

  • Type of failure changed from None/Unknown to Incorrect warning at compile-time
Note: See TracTickets for help on using tickets.