[Haskell-cafe] Haskell, Step by Step, Tutorial, Developing a Whole Application

Jonathan Geddes geddes.jonathan at gmail.com
Sat Dec 18 21:03:25 CET 2010

I agree with the feeling that Haskell tutorials feel like they are
bottom-up. But I think there's a reason for this: In my experience, at
least, Haskell applications are built bottom-up.

Functional programming languages strive for composability. In Haskell
you have very clean, clear ways of composing functions, Monads, and
even composing them with each other. In OOP languages, the glue that
you have for composing objects is more objects. This can be a much
less elegant way to build applications bottom-up, and so bottom up
applications feel sloppy and hacked together.

In an OOP app, you need to start with some kind of scaffolding, such
as mvc or the like, so that as you compose your objects, they start to
take the shape of a well-structured application. In functional
programming, that composability is much more flexible, so you don't
need to worry as much about coding yourself into a poorly structured
app. After all, mvc is all about separation of concerns which comes
naturally if you keep as much as possible outside of the IO monad.

When I'm coding in Haskell, I like to think in the paradigm of
creating a domain specific language. I'm not writing my program for
the first 90% of development, I'm actually working on the DSL that
will be used to create my app. Finally, i switch from functional
programming to imperative, procedural programming in the IO monad (or
some custom Monad) to write the actual code. The end result is a
flexible, maintainable program in very few lines of code and then some
very general, reusable library code supporting it.

I didn't address the actual question, instead I tried to speak to how
I got around the problem. Hope my $0.02 helps.


More information about the Haskell-Cafe mailing list