[Haskell-cafe] Re: Web server (Was: Basic question concerning
data constructors)
Luke Palmer
lrpalmer at gmail.com
Mon Dec 31 08:06:43 EST 2007
On Dec 30, 2007 6:24 PM, Joost Behrends <webmaster at h-labahn.de> wrote:
> I've already browsed through the docomentation of all that. Sorry, but i will
> not use WASH. I like things to be direct, to write >> p { ... } or similar
> things instead of <p> ... </p> is worsening things for me.
Haskell is not a good "quick and dirty" templating language. See perl
for 500 templating approaches.
So, now that we're past that. One of the beautiful things I have
noticed about Haskell is that there
has been essentially nothing I have not been able to factor out. If I
have any common repeated logic
anywhere in my program, I have always been able to naturally factor it
out so it appears in only
one place.
So how, prey tell, do you factor out an expression which includes
<p>...</p>? It is not Haskell,
Haskell has no power there. What the libraries you are looking at do
is precisely to encode
HTML/SQL into Haskell, so it may be manipulated by Haskell functions
without resorting
to string mangling. Haskell however does not look anything like HTML
or like SQL, so there
is a mapping you must learn. But that mapping is a refined version of
what you might come
up with if you were starting from scratch and diligently refactoring
as much as possible. Surely
learning that mapping is easier than building your own (which will
doubtlessly be worse (no
offense, that's the first law of library use)).
And since you are a Haskell beginner, learning a library will teach
you not only the library, but
loads about common idioms and Haskell programming in general. As an
example, it was only
after using the Parsec library that I finally came to terms with
monads; for whatever reason, I
was incapable of grokking them studying only the standard built-ins.
I dunno, it just seems odd to me to avoid "extra learning" when you're
trying to learn the
language in the first place.
Luke
More information about the Haskell-Cafe
mailing list