error on "--++ bla bla bla"

Hi, I got an error if one of lines reads "--++ bla bla bla" where I tried to comment, but "-- ++ bla bla bla" (notice the space after "--") is OK. Do you think this revealed a tiny bug in the GHC compiler (I am using Windows Haskell Platform 2009.2.0.2)? Thanks, Hong

I don't think it's a bug. --++ is a valid operator, whereas --
introduces a comment.
In GHCI:
Prelude> let (--++) = (+) in 5 --++ 6
11
Hope this helps,
Dan
On Wed, Sep 30, 2009 at 7:52 PM, Hong Yang
Hi,
I got an error if one of lines reads "--++ bla bla bla" where I tried to comment, but "-- ++ bla bla bla" (notice the space after "--") is OK.
Do you think this revealed a tiny bug in the GHC compiler (I am using Windows Haskell Platform 2009.2.0.2)?
Thanks,
Hong
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

But in my program, I did not define "--++".
Also in GHCI,
Prelude> :t (--++)
No in scope: '--++'
Prelude> :t (+)
(+) :: (Num a) => a -> a -> a
Thanks,
Hong
On Wed, Sep 30, 2009 at 7:05 PM, Daniel Peebles
I don't think it's a bug. --++ is a valid operator, whereas -- introduces a comment.
In GHCI:
Prelude> let (--++) = (+) in 5 --++ 6 11
Hope this helps, Dan
On Wed, Sep 30, 2009 at 7:52 PM, Hong Yang
wrote: Hi,
I got an error if one of lines reads "--++ bla bla bla" where I tried to comment, but "-- ++ bla bla bla" (notice the space after "--") is OK.
Do you think this revealed a tiny bug in the GHC compiler (I am using Windows Haskell Platform 2009.2.0.2)?
Thanks,
Hong
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Hong Yang
But in my program, I did not define "--++".
And that's what the error tells you, no? Defining operators (or not) doesn't change the syntax. Since the lexeme --++ is syntactially a valid operator, it will be parsed as such, regardless of whether it is defined or not. -k -- If I haven't seen further, it is by standing in the footprints of giants

On Thu, Oct 1, 2009 at 12:52 AM, Hong Yang
Hi,
I got an error if one of lines reads "--++ bla bla bla" where I tried to comment, but "-- ++ bla bla bla" (notice the space after "--") is OK.
Do you think this revealed a tiny bug in the GHC compiler (I am using Windows Haskell Platform 2009.2.0.2)?
Line comments start with "-- ", not just "--". -- Sebastian Sylvan

Nowhere any Haskell book mentioned "line comments start with "-- ", not just "--"." It is just people usually put "-- " ahead of comments. I can successfully compile "--print bla bla bla." On Wed, Sep 30, 2009 at 7:36 PM, Sebastian Sylvan < sebastian.sylvan@gmail.com> wrote:
On Thu, Oct 1, 2009 at 12:52 AM, Hong Yang
wrote: Hi,
I got an error if one of lines reads "--++ bla bla bla" where I tried to comment, but "-- ++ bla bla bla" (notice the space after "--") is OK.
Do you think this revealed a tiny bug in the GHC compiler (I am using Windows Haskell Platform 2009.2.0.2)?
Line comments start with "-- ", not just "--".
-- Sebastian Sylvan

Comments are started with "--" followed by a character that is not a
symbol character. If it is followed by a symbol character (e.g. "*")
then the "--" plus the symbol (e.g. "--*") parses as an operator
rather than a comment. "p" is not a symbol, so the "--" starts a
comment.
For a precise description of Haskell syntax, see the Haskell98
Report[1]. It's quite readable, at least in comparison to other
"precise" documents I've attempted to read.
Hope that helps.
Alex
On Wed, Sep 30, 2009 at 7:48 PM, Hong Yang
Nowhere any Haskell book mentioned "line comments start with "-- ", not just "--"." It is just people usually put "-- " ahead of comments.
I can successfully compile "--print bla bla bla." On Wed, Sep 30, 2009 at 7:36 PM, Sebastian Sylvan
wrote: On Thu, Oct 1, 2009 at 12:52 AM, Hong Yang
wrote: Hi,
I got an error if one of lines reads "--++ bla bla bla" where I tried to comment, but "-- ++ bla bla bla" (notice the space after "--") is OK.
Do you think this revealed a tiny bug in the GHC compiler (I am using Windows Haskell Platform 2009.2.0.2)?
Line comments start with "-- ", not just "--". -- Sebastian Sylvan
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Oops...forgot the footnote. The lexical syntax part of the report is
at http://haskell.org/onlinereport/lexemes.html.
Alex
On Wed, Sep 30, 2009 at 7:56 PM, Alexander Dunlap
Comments are started with "--" followed by a character that is not a symbol character. If it is followed by a symbol character (e.g. "*") then the "--" plus the symbol (e.g. "--*") parses as an operator rather than a comment. "p" is not a symbol, so the "--" starts a comment.
For a precise description of Haskell syntax, see the Haskell98 Report[1]. It's quite readable, at least in comparison to other "precise" documents I've attempted to read.
Hope that helps.
Alex
On Wed, Sep 30, 2009 at 7:48 PM, Hong Yang
wrote: Nowhere any Haskell book mentioned "line comments start with "-- ", not just "--"." It is just people usually put "-- " ahead of comments.
I can successfully compile "--print bla bla bla." On Wed, Sep 30, 2009 at 7:36 PM, Sebastian Sylvan
wrote: On Thu, Oct 1, 2009 at 12:52 AM, Hong Yang
wrote: Hi,
I got an error if one of lines reads "--++ bla bla bla" where I tried to comment, but "-- ++ bla bla bla" (notice the space after "--") is OK.
Do you think this revealed a tiny bug in the GHC compiler (I am using Windows Haskell Platform 2009.2.0.2)?
Line comments start with "-- ", not just "--". -- Sebastian Sylvan
_______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
participants (5)
-
Alexander Dunlap
-
Daniel Peebles
-
Hong Yang
-
Ketil Malde
-
Sebastian Sylvan