[Haskell] Re: [Haskell-cafe] Haskell versus Lisp

Wolfgang Jeltsch wolfgang at jeltsch.net
Mon Sep 19 09:36:59 EDT 2005


Am Freitag, 16. September 2005 18:40 schrieben Sie:
> 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.

They are some kind of opaque 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. 

I'm not sure.  Haskell is much more powerful than C, for instance concerning 
the type system.  The point of the concept I described above is that the 
general MonadIO-based description of actions is very similar to what you 
would normally write when using IO directly.  I doubt that you can do 
something similar with C.

> [...]

> 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.

Haskell alone is not so flexible but Haskell with Template Haskell is.  The 
difference is that the Haskell/Template Haskell combination separates 
compile-time evaluation/code generation clearly from runtime evaluation which 
is, in my opinion, a very good thing.

Best wishes,
Wolfgang


More information about the Haskell-Cafe mailing list