Interesting. How is this hack implemented? I just checked the BNF grammar for the lexical syntax of Haskell in "The Haskell 98 Language Report" (see the BNF grammer given under "9.2 Lexical Syntax" under "9 Syntax Reference" at http://www.haskell.org/onlinereport/syntax-iso.html), but had difficulty in deriving a unary minus.
Could somebody please enlighten me on how to derive the expression "-1" (a unary minus followed the the ascDigit 1) from the above-mentioned BNF grammar? Or is a unary minus not part of this grammar? -- Benjamin L. Russell On Mon, 6 Apr 2009 11:14:52 +0200, Lennart Augustsson <lenn...@augustsson.net> wrote: >Unary minus is a hack in the syntax for allowing the function negate >to be written as prefix -. > >On Mon, Apr 6, 2009 at 10:36 AM, Martijn van Steenbergen ><mart...@van.steenbergen.nl> wrote: >> Paul Keir wrote: >>> >>> If I use :info (-) I get information on the binary minus. Is unary minus >>> also a function? >> >> No, as far as I know the unary minus is part of the number literals. You can >> use "negate" if you want it as a function. >> >> Hope this helps, >> >> Martijn. >> >> _______________________________________________ >> Haskell-Cafe mailing list >> Haskell-Cafe@haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> -- Benjamin L. Russell / DekuDekuplex at Yahoo dot com http://dekudekuplex.wordpress.com/ Translator/Interpreter / Mobile: +011 81 80-3603-6725 "Furuike ya, kawazu tobikomu mizu no oto." -- Matsuo Basho^ _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe