[Haskell] Re: [Haskell-cafe] Haskell versus Lisp
Glynn Clements
glynn at gclements.plus.com
Fri Sep 16 12:40:04 EDT 2005
Wolfgang Jeltsch wrote:
> > > > Bearing this in mind, and hoping you can see where I'm coming from, I
> > > > think my question is: shouldn't you guys be using Lisp?
> > >
> > > Lisp is impure, weakly typed and has way too many parentheses. Why would
> > > we use lisp? It seems to be lacking almost all the advantages of Haskell,
> > > and have an ugly, inflexible syntax to boot.
> >
> > The ability to dynamically generate, manipulate and analyse code in a
> > structured manner provides a flexibility which is unmatched by any
> > other language I know of.
> >
> > A good example is Emacs; lisp is entirely the right language for that,
> > IMHO.
>
> Could you explain this a bit more, please? To the moment, I cannot imagine
> cases where you need LISP's way of code analysis and manipulation because
> Haskell's capabilities are not sufficient.
>
> In Haskell, code is data too because code in the sense of imperative actions
> is described by IO values. You cannot analyse them.
And thus they are not data.
> But you can use your do
> expressions etc. to construct action descriptions with a more general type
> like MonadIO m => m a. Then you can instantiate m with a monad whose values
> store part of the action's structure so that this information can be used
> later. Or you use a monad which doesn't keep structural information to use
> it for later processing but which does the processing upon construction.
Yeah, but this is heading in the direction of Greenspun's Tenth Rule
of Programming:
Any sufficiently complicated C or Fortran program contains an
ad hoc informally-specified bug-ridden slow implementation of
half of Common Lisp."
You could easily end up doing the same thing in Haskell.
The main thing about Lisp is that it tends to make it fairly easy to
write something close to the ideal language for the task in hand
without starting from the ground floor. You get stuck with Lisp's
token syntax, and the semantics of its core primitives, but you can
replace anything else.
Every other language (including Haskell) tends to have the problem
that eventually you will encounter a situation where the language's
own worldview gets in the way.
Or, to put it another way: if Haskell is so flexible, why do we need
Template Haskell? I can't imagine a "Template Lisp"; it would just be
Lisp.
--
Glynn Clements <glynn at gclements.plus.com>
More information about the Haskell
mailing list