
I am new to the language (coming from ML) and I am sorry if my first post turns out to be a flamebait, but I can't help it: Why in the world did the designers of Haskell permit the ' character to be both a prime (part of identifiers) and the single-character quote? Didn't they realize what they were doing to would-be intelligent editors? Or were they just a bunch of rabid ed users? Has anyone found a way to deal with this in Emacs, _correctly_? That is, among other things, '(' should be ignored for sexp parsing... -- Ian Zimmerman, Oakland, California, U.S.A. GPG: 433BA087 9C0F 194F 203A 63F7 B1B8 6E5A 8CA3 27DB 433B A087 The world has taken on a thickness of vulgarity that raises a spiritual man's contempt to the violence of a passion. Baudelaire

On Thu, Feb 07, 2002 at 08:00:36AM -0800, Ian Zimmerman wrote:
I am new to the language (coming from ML) and I am sorry if my first post turns out to be a flamebait, but I can't help it:
Why in the world did the designers of Haskell permit the ' character to be both a prime (part of identifiers) and the single-character quote? Didn't they realize what they were doing to would-be intelligent editors? Or were they just a bunch of rabid ed users?
In standard ML: - fun f' x = x + 1;
val f' = fn : int -> int
And as far as I see, vim handles that kind of syntax perfectly. I do not find the allowance disturbing, rather neat (I tend to augment helper functions with the '). -- Jesper

itz> Why in the world did the designers of Haskell permit the ' itz> character to be both a prime (part of identifiers) and the itz> single-character quote? Didn't they realize what they were doing itz> to would-be intelligent editors? Or were they just a bunch of itz> rabid ed users? Jesper> In standard ML: Jesper> - fun f' x = x + 1;
val f' = fn : int -> int
Jesper> And as far as I see, vim handles that kind of syntax Jesper> perfectly. I do not find the allowance disturbing, rather neat Jesper> (I tend to augment helper functions with the '). You miss my point: I agree that having a prime character for id's is neat. But in SML, that's the _only_ role it has, character literals are written like #"x". With Haskell's characters (and Ocaml's :-( ) there's no way to avoid confusion on part of the editor, as far as I can see. I actually plan to do something like this, let c s = head s let lparen = c"(" to avoid using character literals at all. I was just wondering if someone had a better idea. Please read my original post again if you don't understand what i mean (and aren't bored yet by this admittedly trivial topic). -- Ian Zimmerman, Oakland, California, U.S.A. GPG: 433BA087 9C0F 194F 203A 63F7 B1B8 6E5A 8CA3 27DB 433B A087 The world has taken on a thickness of vulgarity that raises a spiritual man's contempt to the violence of a passion. Baudelaire

On Thu, Feb 07, 2002 at 08:38:22AM -0800, Ian Zimmerman wrote:
You miss my point: I agree that having a prime character for id's is neat. But in SML, that's the _only_ role it has, character literals are written like #"x". With Haskell's characters (and Ocaml's :-( )
Ooops, yup... I forgot the syntax for ML in respect to single characters. I thought it was #'c'. Now I see your point... Still, vim seems to handle it... -- Jesper

Since we're on this topic, I'm constantly annoyed by the following (in addition to sexps with '(' and ')'): how to get emacs to realize that it should match the parens on: map (\(x,y) -> ... since \( isn't an escape character. i end up writing: map (\ (x,y) -> ... but i'd prefer the former also, to not thing -- in a string begins a comment: print "This is not -- I repeat, not -- a comment" There's one more case, but I'm going blank on it right now. Anyone have any fixes? - Hal -- Hal Daume III "Computer science is no more about computers | hdaume@isi.edu than astronomy is about telescopes." -Dijkstra | www.isi.edu/~hdaume On Thu, 7 Feb 2002, Jesper Louis Andersen wrote:
On Thu, Feb 07, 2002 at 08:38:22AM -0800, Ian Zimmerman wrote:
You miss my point: I agree that having a prime character for id's is neat. But in SML, that's the _only_ role it has, character literals are written like #"x". With Haskell's characters (and Ocaml's :-( )
Ooops, yup... I forgot the syntax for ML in respect to single characters. I thought it was #'c'. Now I see your point...
Still, vim seems to handle it...
-- Jesper _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Hal> Since we're on this topic, I'm constantly annoyed by the Hal> following (in addition to sexps with '(' and ')'): how to get Hal> emacs to realize that it should match the parens on: Hal> map (\(x,y) -> ... Hal> since \( isn't an escape character. i end up writing: Hal> map (\ (x,y) -> ... Hal> but i'd prefer the former Hal> also, to not thing -- in a string begins a comment: Hal> print "This is not -- I repeat, not -- a comment" Hal> There's one more case, but I'm going blank on it right now. Hal> Anyone have any fixes? Yes, I know about these as well. The first would normally be addressed by (add-hook 'haskell-mode-hook (lambda () (modify-syntax-entry ?\\ "'"))) but of course this screws up parsing of strings, which will now be terminated by \" :-( The second one is because the haskell mode tries to handle comments on its own (and fails), since once again Haskell comments can't be handled by the normal mechanism -- partly because of nested comments, but even the line tail comments are weird due to the single-token rule. All this taken together, I mean, _really_, is the lexical structure of Haskell a botch, or what? -- Ian Zimmerman, Oakland, California, U.S.A. GPG: 433BA087 9C0F 194F 203A 63F7 B1B8 6E5A 8CA3 27DB 433B A087 The world has taken on a thickness of vulgarity that raises a spiritual man's contempt to the violence of a passion. Baudelaire

All this taken together, I mean, _really_, is the lexical structure of Haskell a botch, or what?
No. Innovative. All the problems described in this thread reflect unwarranted assumptions inherited in emacs. It's plainly possible to parse Haskell, and not hard either. Jón -- Jón Fairbairn Jon.Fairbairn@cl.cam.ac.uk 31 Chalmers Road jf@cl.cam.ac.uk Cambridge CB1 3SZ +44 1223 570179 (after 14:00 only, please!)

itz> All this taken together, I mean, _really_, is the lexical itz> structure of Haskell a botch, or what? Jon> No. Innovative. All the problems described in this thread reflect Jon> unwarranted assumptions inherited in emacs. It's plainly possible Jon> to parse Haskell, and not hard either. First, parsing of a complete program (eg. by a compiler) is quite different from parsing a buffer that is being edited by a human. The latter is hard, even for fairly well-specified languages. Irregularities only make it harder. Second, this argument would be easier to accept if there in fact were an equally innovative tool capable of providing all the editing goodies Emacs normally does, for Haskell. But I don't know of one, even now, 10 years or so after Haskell's birth. -- Ian Zimmerman, Oakland, California, U.S.A. GPG: 433BA087 9C0F 194F 203A 63F7 B1B8 6E5A 8CA3 27DB 433B A087 The world has taken on a thickness of vulgarity that raises a spiritual man's contempt to the violence of a passion. Baudelaire

I would prefer that a language syntax is designed to be good for users, even if that means it presents problems for implementors. You have not argued that these issues indicate bad design from the point of view of an application programmer. If you think about languages that have been designed to be easy to parse, are these really languages that you would want to use? Ian Zimmerman wrote:
itz> All this taken together, I mean, _really_, is the lexical itz> structure of Haskell a botch, or what?
Jon> No. Innovative. All the problems described in this thread reflect Jon> unwarranted assumptions inherited in emacs. It's plainly possible Jon> to parse Haskell, and not hard either.
First, parsing of a complete program (eg. by a compiler) is quite different from parsing a buffer that is being edited by a human. The latter is hard, even for fairly well-specified languages. Irregularities only make it harder.
Second, this argument would be easier to accept if there in fact were an equally innovative tool capable of providing all the editing goodies Emacs normally does, for Haskell. But I don't know of one, even now, 10 years or so after Haskell's birth.
--brian

brian> If you think about languages that have been designed to be easy brian> to parse, are these really languages that you would want to brian> use? No, but for different (semantical) reasons. -- Ian Zimmerman, Oakland, California, U.S.A. GPG: 433BA087 9C0F 194F 203A 63F7 B1B8 6E5A 8CA3 27DB 433B A087 The world has taken on a thickness of vulgarity that raises a spiritual man's contempt to the violence of a passion. Baudelaire

What a nice place to flame... :) On Thu, Feb 07, 2002 at 01:47:16PM -0800, Ian Zimmerman wrote:
Second, this argument would be easier to accept if there in fact were an equally innovative tool capable of providing all the editing goodies Emacs normally does, for Haskell. But I don't know of one, even now, 10 years or so after Haskell's birth.
Well, vim, though maybe dumb, is often accounted as having better syntax highlighting (I had no chance to prove that, since dont use emacs). At least, the examples you provided caused no problem. Can you present the original problem with ' and ('s - I'd like to check how it does? There are quite simple parsing based on regexps (and some very common "shadowing" principles). You could look at their syntax file, and maybe port it to emacs. Max.

On 7 Feb 2002, Ian Zimmerman wrote:
itz> All this taken together, I mean, _really_, is the lexical itz> structure of Haskell a botch, or what?
Jon> No. Innovative. All the problems described in this thread reflect Jon> unwarranted assumptions inherited in emacs. It's plainly possible Jon> to parse Haskell, and not hard either.
First, parsing of a complete program (eg. by a compiler) is quite different from parsing a buffer that is being edited by a human. The latter is hard, even for fairly well-specified languages. Irregularities only make it harder.
Just to show that an opposite point of view is possible: I've recently being thinking about trying to use an ML dialect as part of some interlanguage-prototyping that I'd like to do, since it seems easier to find descriptions of interfacing into it from outside that seem comprehensible to me. I originally learned ML before Haskell, and I imagine that after a little while relearning things aren't lazy and that I shouldn't curry functions unless I need to I'd probably get back into it. But every time I look at it I just get put off by the (IMO) truly awful syntax which is both verbose and seems designed for machine parsing to the detriment of easy human understandability (e.g., ~ for unary minus and the #'c' character literal syntax and those damned end's for terminating let-in constructions). And this is quite important to me because I spend a lot of time reading and thinking about code (particularly paper printouts) and not that much time doing clever emacs searches. I will probably try again to get back into ML, but it will be whilst suppressing feelings of frustration about the syntax.
Second, this argument would be easier to accept if there in fact were an equally innovative tool capable of providing all the editing goodies Emacs normally does, for Haskell. But I don't know of one, even now, 10 years or so after Haskell's birth.
That may be more indicative of the fact that few people in the community find writing editing modes to be interesting things to do, and that emacs is still using parsing tricks that made sense when people were editing on slow, time-shared machines but not when the typical desktop machine is at least a 200MHz pentium. There was recently a PhD position advertised on the list in the area of refactoring functional programs; I'd be surprised if whoever does that doesn't eventually end up with a GUI (whether inherited from somewhere else or written as part of the project). ___cheers,_dave_________________________________________________________ www.cs.bris.ac.uk/~tweed/|`...heat generated by its microprocessors will email:tweed@cs.bris.ac.uk|slope upward exponentially, reaching the power work tel:(0117) 954-5250 |density of a nuclear reactor before 2010'-Intel

Ian Zimmerman
Why in the world did the designers of Haskell permit the ' character to be both a prime (part of identifiers) and the single-character quote?
Personally, I think the Haskell syntax is beautiful. Programs are readable, yet concise. That's more important to me than correct parenthesis matching.
Didn't they realize what they were doing to would-be intelligent editors? Or were they just a bunch of rabid ed users?
The compiler obviously have little trouble separating character literals from primed names. If Emacs has a problem, I would question the "intelligence" of Emacs. Shouldn't an "intelligent" editor have sufficient parsing capabilities to deal with this? (BTW, I'm a happy Emacs user -- e.g. see my headers -- and I find the modes available pretty much sufficient.)
Has anyone found a way to deal with this in Emacs, _correctly_?
I would suggest gathering up all the syntactics that causes trouble, and posting to an Emacs newsgroup or mailing list. -kzm -- If I haven't seen further, it is by standing in the footprints of giants

Personally, I think the Haskell syntax is beautiful. Programs are readable, yet concise. That's more important to me than correct parenthesis matching. Haskell looks nice... Isabell looks beautiful :-) (in Xemacs with the X symbol package+Proof General etc) I whish I could have lambdas, alphas and all that .
(BTW, I'm a happy Emacs user -- e.g. see my headers -- and I find the modes available pretty much sufficient.) I'm not... like I said working with Isabell is great. Haskell mode is pretty basic when compared to it. And no, I don't have the time to do something better myself now, so I'll just stick to it :-)
J.A.

Jorge Adriano
Haskell looks nice... Isabell looks beautiful :-)
I'm not familiar with Isabell, but aren't we comparing apples and oranges here? E.g. you can prettify .lhs pretty nicely with one of the LaTeX packages available.
And no, I don't have the time to do something better myself now, so I'll just stick to it :-)
If somebody would come up with a mode that used lambdas and arrows to render things nicely in my editor, I wouldn't mind. But I don't think the benefit for me would be great enough to justify the effort (I'm not much of a lisp hacker). -kzm -- If I haven't seen further, it is by standing in the footprints of giants

On Friday 08 February 2002 14:35, Ketil Z. Malde wrote:
Jorge Adriano
writes: Haskell looks nice... Isabell looks beautiful :-)
I'm not familiar with Isabell, but aren't we comparing apples and oranges here? E.g. you can prettify .lhs pretty nicely with one of the LaTeX packages available.
Well yes :-) You said "Personally, I think the Haskell syntax is beautiful", and in my answer I talked about the way it looked on Xemacs, not the syntax. But not sure if we are talking about the same thing here, how do you prettify the .lhs files? Are you talking about the dvi you get in the end or the way it looks while editing the code?
And no, I don't have the time to do something better myself now, so I'll just stick to it :-)
If somebody would come up with a mode that used lambdas and arrows to render things nicely in my editor, I wouldn't mind. But I don't think the benefit for me would be great enough to justify the effort (I'm not much of a lisp hacker).
I wouldn't mind either. Everything looks really nice, making your code really easy to read, it's not just the greek leters, the 'forall's, the arrows '=>', the 'and's and the 'or's. But the Isabell/Isar/Proof General (which I haven't used in a long time) mode had more to it than just that. The menus were pretty good, buttons (with icons) for some commands... it turns Xemacs into a very nice GUI for isabelle. J.A.

On Thu, Feb 07, 2002 at 08:00:36AM -0800, Ian Zimmerman wrote:
I am new to the language (coming from ML) and I am sorry if my first post turns out to be a flamebait, but I can't help it:
Why in the world did the designers of Haskell permit the ' character to be both a prime (part of identifiers) and the single-character quote? Didn't they realize what they were doing to would-be intelligent editors? Or were they just a bunch of rabid ed users?
Has anyone found a way to deal with this in Emacs, _correctly_? That is, among other things, '(' should be ignored for sexp parsing...
I'm just back from a party so I may be, eh, a little bit drunk ;-) but I really don't see the problem. An identifier in Haskell cannot begin with a ' so if a "could-be-identifier" ;-) starts with a ' it is a character constant. It is completely parallel to digits AFAICS: An identifier may contain digits, but it cannot begin with one. So a "could-be-identifier" beginning with a digit is a number. Remi -- See the light and feel my warm desire, Run through your veins like the evening sun It will live but no eyes will see it, I'll bless your name before I die. Key fingerprint = CC90 A1BA CF6D 891C 5B88 C543 6C5F C469 8F20 70F4
participants (10)
-
brian boutel
-
D. Tweed
-
Hal Daume III
-
Ian Zimmerman
-
Jesper Louis Andersen
-
Jon Fairbairn
-
Jorge Adriano
-
ketil@ii.uib.no
-
Max A.K.
-
Remi Turk