Cognitive dissonance in the Haskell Report
Section 2.4 of the Haskell report defines "identifier" as a lexeme that begins with a letter. A few paragraphs on it says An operator symbol starting with any other character [than :] is an ordinary identifier. In everyday usage, ordinary people are necessarily people, yet this kind of ordinary identifier falls outside the definition of identifier. Section 3.2 says An operator is either an operator symbol, such as + or $$, or is an ordinary identifier enclosed in grave accents. If "either" is taken in the exclusive sense, this implies that operator symbols are *not* ordinary identifiers, in contradiction to Section 2.4. But if either is taken inclusively, then the lexeme +, an ordinary identifier per Section 2.4, can optionally be enclosed in grave accents. The terminology needs some cleaning. Doug McIlroy
Hehe, that language has just been copied forward from the 1998 Report, (and nobody's demurred in a quarter of a century AFAIK), so I think that horse has bolted. Interestingly, the 1992 Report (search for Version 1.2) doesn't use that language. I think 2.4's "ordinary identifier" is talking about the lexeme's semantic role: it identifies a function. (As distinct from a constructor, that can appear in a pattern match.) Elsewhere "ordinary operator" denotes its syntactic role. 3.2 continues after the bit you quote: Dually, an operator symbol can be converted to an ordinary identifier by enclosing it in parentheses. But substituting (+) as an allegedly "ordinary identifier" into the para above would suggest (to those of an over-literal mind) that `(+)` should yield what is syntactically an operator again. Instead it gives syntax error. "ordinary" appears throughout the Report prefixed to all sorts of terms. I don't think you should take "ordinary identifier" as having a special technical sense. Note it doesn't appear anywhere in italics as a formal definiendum. And since taking the report over-literally will lead you quickly to a syntax error, I think GHC doesn't need engage a lawyer. AntC
"GHC doesn't need engage a lawyer" On the other hand, once upon a time Haskell did employ a Syntax Czar. anthony.d.clayden@gmail.com kirjoitti 8.11.2025 klo 4.11:
Hehe, that language has just been copied forward from the 1998 Report, (and nobody's demurred in a quarter of a century AFAIK), so I think that horse has bolted.
Interestingly, the 1992 Report (search for Version 1.2) doesn't use that language.
I think 2.4's "ordinary identifier" is talking about the lexeme's semantic role: it identifies a function. (As distinct from a constructor, that can appear in a pattern match.) Elsewhere "ordinary operator" denotes its syntactic role.
3.2 continues after the bit you quote:
Dually, an operator symbol can be converted to an ordinary identifier by enclosing it in parentheses.
But substituting (+) as an allegedly "ordinary identifier" into the para above would suggest (to those of an over-literal mind) that `(+)` should yield what is syntactically an operator again. Instead it gives syntax error.
"ordinary" appears throughout the Report prefixed to all sorts of terms. I don't think you should take "ordinary identifier" as having a special technical sense. Note it doesn't appear anywhere in italics as a formal definiendum.
And since taking the report over-literally will lead you quickly to a syntax error, I think GHC doesn't need engage a lawyer.
AntC _______________________________________________ Haskell-Cafe mailing list -- haskell-cafe@haskell.org To (un)subscribe, modify options or view archives go to: Only members subscribed via the mailman list are allowed to post.
-- Matti Nykänen
The correct spelling is Syntax Tsar. All the οἱ πο\\οί know that.[joke]
On Saturday, November 8, 2025 at 02:18:56 AM EST, Matti Nykänen
Hehe, that language has just been copied forward from the 1998 Report, (and nobody's demurred in a quarter of a century AFAIK), so I think that horse has bolted.
Interestingly, the 1992 Report (search for Version 1.2) doesn't use that language.
I think 2.4's "ordinary identifier" is talking about the lexeme's semantic role: it identifies a function. (As distinct from a constructor, that can appear in a pattern match.) Elsewhere "ordinary operator" denotes its syntactic role.
3.2 continues after the bit you quote:
Dually, an operator symbol can be converted to an ordinary identifier by enclosing it in parentheses.
But substituting (+) as an allegedly "ordinary identifier" into the para above would suggest (to those of an over-literal mind) that `(+)` should yield what is syntactically an operator again. Instead it gives syntax error.
"ordinary" appears throughout the Report prefixed to all sorts of terms. I don't think you should take "ordinary identifier" as having a special technical sense. Note it doesn't appear anywhere in italics as a formal definiendum.
And since taking the report over-literally will lead you quickly to a syntax error, I think GHC doesn't need engage a lawyer.
AntC _______________________________________________ Haskell-Cafe mailing list -- haskell-cafe@haskell.org To (un)subscribe, modify options or view archives go to: Only members subscribed via the mailman list are allowed to post.
-- Matti Nykänen _______________________________________________ Haskell-Cafe mailing list -- haskell-cafe@haskell.org To (un)subscribe, modify options or view archives go to: Only members subscribed via the mailman list are allowed to post.
And since taking the report over-literally will lead you quickly to a syntax error, I think GHC doesn't need engage a lawyer.
I believe that sarcasm is misplaced here, for two reasons: 1) It's unfriendly. 2) It's shooting down an argument without offering counter-arguments. I don't mean to imply that this was an intentional attack or anything, but I believe it should be acknowledged as a mistake. Back to lurking and kind regards, Jo P.S.: I do believe he does have a valid point here. Even if the Report is "eventually precise enough", ambiguities like this take time and mental effort to sort out that would be better spend on learning or tool implementing or whatever the person is trying to achieve by reading the Report.
Sadly, that means someone reading through the whole Report and fixing a lot
of things. I mean, it still doesn't even say how typeclasses work, it just
says "the obvious extension to H-M" or something like that.
On Sat, Nov 8, 2025 at 5:28 PM
And since taking the report over-literally will lead you quickly to a syntax error, I think GHC doesn't need engage a lawyer.
I believe that sarcasm is misplaced here, for two reasons:
1) It's unfriendly. 2) It's shooting down an argument without offering counter-arguments.
I don't mean to imply that this was an intentional attack or anything, but I believe it should be acknowledged as a mistake.
Back to lurking and kind regards, Jo
P.S.: I do believe he does have a valid point here. Even if the Report is "eventually precise enough", ambiguities like this take time and mental effort to sort out that would be better spend on learning or tool implementing or whatever the person is trying to achieve by reading the Report. _______________________________________________ Haskell-Cafe mailing list -- haskell-cafe@haskell.org To (un)subscribe, modify options or view archives go to: Only members subscribed via the mailman list are allowed to post.
-- brandon s allbery kf8nh allbery.b@gmail.com
participants (7)
-
anthony.d.clayden@gmail.com -
Brandon Allbery -
Douglas McIlroy -
jo@durchholz.org -
Mark McConnell -
Matti Nykänen -
Mig Mit