Opened 11 years ago

Closed 9 months ago

#1318 closed feature request (wontfix)

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 (6)

comment:1 Changed 11 years ago by Isaac Dupree

Milestone: 6.8_|_
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 9 years ago by simonmar

Architecture: UnknownUnknown/Multiple

comment:3 Changed 9 years ago by simonmar

Operating System: UnknownUnknown/Multiple

comment:4 Changed 5 years ago by morabbin

Type of failure: None/Unknown

Bump; still of interest?

comment:5 Changed 2 years ago by thomie

Type of failure: None/UnknownIncorrect warning at compile-time

comment:6 Changed 9 months ago by bgamari

Resolution: wontfix
Status: newclosed

We have -XNegativeLiterals now but I don't think that removing the - operator is going to happen at this point.

Note: See TracTickets for help on using tickets.