character syntax

Ian Zimmerman
07 Feb 2002 08:38:22 -0800

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