Haskell single line comments consist of "-- " sequence of characters and not "--". For example, in many cases GHC considers "--" commented lines as not actually commented. Everywhere in code you will see a space following "--". You can view, comment on, or merge this pull request online at:
https://github.com/geany/geany/pull/1026
-- Commit Summary --
* Fix Haskell single line comments by adding space
-- File Changes --
M data/filedefs/filetypes.haskell (2)
-- Patch Links --
https://github.com/geany/geany/pull/1026.patch https://github.com/geany/geany/pull/1026.diff
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1026
The [Haskell Report](https://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-170002.3) does not say space is required.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1026#issuecomment-217054704
@elextr no, but if you read the syntax in [2.2](https://www.haskell.org/onlinereport/haskell2010/haskellch2.html#x7-160002.2), you see that a comment is defined as
lexeme | definition ------ | ---------- *comment* | *dashes* [ *any*⟨*symbol*⟩ {*any*} ] *newline* *dashes* | `--` {`-`} *symbol* | *ascSymbol* | *uniSymbol*⟨*special* | `_` | `"` | `'`⟩ *ascSymbol* | `!` | `#` | `$` | `%` | `&` | `⋆` | `+` | `.` | `/` | `<` | `=` | `>` | `?` | `@` | `` | `^` | `|` | `-` | `~` | `:` … |
So a comment is *a sequence starting with 2 or more dashes (`-`) not followed by any of `!`, `#`, `$`, `%`, `&`, `⋆`, `+`, `.`, `/`, `<`, `=`, `>`, `?`, `@`, ``, `^`, `|`, `-`, `~` or `:`*.
Hence, not only simply inserting `--` might or might not make it a comment, but also our default toggle comment suffix (`~ `, leading to `--~ `) will not make it a comment at all.
So, in the end I think the solution proposed here by @AleXoundOS makes sense.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1026#issuecomment-217117057
@@ -51,7 +51,7 @@ mime_type=text/x-haskell #wordchars=_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789
# single comments, like # in this file -comment_single=-- +comment_single=--
I would rather see representing the space [as `\s`](https://developer.gnome.org/glib/unstable/glib-Key-value-file-parser.html#gl...) to make it explicit we do want the space here, and avoid any possible future accidental removal by e.g. "remove trailing spaces" feature.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1026/files/1529e3b327d71bf73e7517ae9c9ad...
@b4n good catch, yes space(or something) is needed to stop `--~` being not a comment.
But of course then uncomment lines won't uncomment any legal lines that don't have the space, hopefully all Haskell programmers follow the convention as @AleXoundOS says :)
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1026#issuecomment-217119525
Agree with @b4n, representing space in filetypes file that is parsed with glib key-value parser as `\s` is the right way. Also thank you for point out the right reference. Closing this pull request and opening new with `--\s`.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1026#issuecomment-217295824
Closed #1026.
--- You are receiving this because you are subscribed to this thread. Reply to this email directly or view it on GitHub: https://github.com/geany/geany/pull/1026#event-652039751
github-comments@lists.geany.org