[Haskell-cafe] Re: map (-2) [1..5]
John Meacham
john at repetae.net
Thu Aug 17 13:58:53 EDT 2006
On Thu, Aug 17, 2006 at 11:18:59AM -0400, Stefan Monnier wrote:
> > I'd have thought it would have been simpler to just make the rule that -2
> > (no spaces between '-' and '2') would be a single lexeme,
>
> But then x-2 won't mean "subtract 2 from x" but "call x with arg -2".
but now at least a highlighting editor can tell the difference and
highlight '-2' as a number and x as a variable. I mean,
0x22 does not mean the same thing as 0 x 32 or 0.32 or 0 . 32.
we already have special lexical rules for numbers and no one has
complained about any of them. but issues with the '-' handling come up
quite regularly.
John
--
John Meacham - ⑆repetae.net⑆john⑈
More information about the Haskell-Cafe
mailing list