[Haskell-cafe] IO is a bad example for Monads
lemming at henning-thielemann.de
Tue Dec 11 02:29:34 EST 2007
On Mon, 10 Dec 2007, Paul Moore wrote:
> On 10/12/2007, Henning Thielemann <lemming at henning-thielemann.de> wrote:
> > I raise my question once again: Must Haskell's tutorials be tailored to
> > impatient programmers? Does Haskell need quick&dirty hackers?
> Haskell is the most practical functional language I have encountered,
> but I still feel that IO (in the most general sense of interaction
> with the outside world) is hard in Haskell. Maybe it *can* be easy,
> but it isn't yet. And ignoring that fact isn't helping anyone.
I myself didn't start with IO in Haskell, because I could do this in
imperative languages. I didn't learnt Haskell in order to be able to
implement something, that I couldn't program before. I used Haskell for
implementing things more cleaner, more elegant than before. Things that I
couldn't implement more elegant in Haskell, I didn't implement in Haskell.
I started in Haskell with what is especially easy to do in Haskell, for me
this was solving mathematical problems. GHCi was the way I interacted with
Haskell. I didn't do IO for more than half a year. My first programs with
IO only contained writing data to files, then reading from files. No
interaction with the user or argument parsing. Due to Hal Daume's tutorial
I found the State monad useful early. Later I did IO, Reader, List monad
and then monad transformers. In retrospective, the List monad should have
been earlier on my plan because it is the right tool for solving problems
by systematic search.
I think that getting a job done (maybe even with time constraint) is not
a good way to really learn a language. You will try to solve the problems
in the way you solved them in other languages, because that is the way you
are used to, and this promises to be the fastest one.
More information about the Haskell-Cafe