What I wrote under "Allowing hyphens in
identifiers" and what Richard O'Keefe wrote earlier under "A new form of
newtype" caused me to think. It was pointed out that hyphens are not permitted
in Haskell identifiers much as they are in Lisp for good cause even though such
a feature is regarded by some as especially desirable. It is technically
feasible (or at least appears to be). It is a matter of what constitutes good
language design. My suggestion was to whip up a makeshift preprocessor to make
the necessary substitutions.
It might be better to go about it in a
fashion similar to how one would use Haskell to create a new language using
Happy, but instead of making a full fledged language create a language that
makes only minor adjustments to the official language where most of the original
source code and command line options are copied verbatim with a handful of
things caught such as the Richard O'Keefe newtype, a nano-language if you will.
Actually I have known about this possibility for years. There is always
something you would like to change about whatever language you are working with
and so I have put thought into it.
It would make prototyping of new ideas
easier. It would furthermore make it possible to make changes that would be
unacceptable for an official version of the language such as hyphens in place of
underscores for those who feel the benefit of being able to use hyphens this way
outweigh the problems it may cause. The official language remains
intact.
Broadly speaking I am talking about a
preprocessor, but one tailored for the needs of Haskell. For related art see
Ciao Prolog (see http://ciaohome.org). They are using their
preprocessor to do some rather sophisticated things which include program
analysis and optimization. Something so elaborate may not be necessary, however.
Just some Happy code that has been cobbled together that address some of the
issues involved that is reworked to satisfy a special
need.