[Haskell-cafe] Re: When to teach IO (was Tutorial uploaded)

David Roundy droundy at abridgegame.org
Wed Dec 21 11:31:40 EST 2005

On Wed, Dec 21, 2005 at 03:47:14PM -0000, Bayley, Alistair wrote:
> It's good to start with IO. Reading and writing files, parsing and
> printing (show and read), talking to databases, GUIs, and networking are
> more-or-less essential activities, and people want to know early on how
> to do these things. You don't have to introduce the IO monad; just tell
> people that we separate IO functions from "pure" functions with this
> special IO type, and, with the "imperative" do-notation, IO code in
> Haskell looks a lot like IO code in C/Java/.Net. The Really Good Stuff
> (real monadic programming) can come later.

I'd just add that in my opinion its handling of IO is actually one of the
*strengths* of Haskell.  The primary advantage Haskell has (in my mind) is
that it is strongly typed, and the monadic handling of IO is an impressive
display of how much that typing can clarify one's code.  I'd far rather
write IO code in Haskell than in any other language.  Pure code can be
written in any language pretty easily (albeit more easily in a functional
language), since pure code doesn't have the complexities present in IO
code, and it's in handling those complexities that the type-safety of
Haskell really helps.
David Roundy

More information about the Haskell-Cafe mailing list