[Haskell-cafe] Tutorial: Haskell for the Evil Genius

Andrew Pennebaker andrew.pennebaker at gmail.com
Sat Sep 15 02:23:42 CEST 2012

> But, Haskell records aren't better than OOP.
> I am not trying to be controversial here -- Haskell records would
> "naturally" implement prototype-based OOP, like JavaScript uses, if they
> (Haskell records) weren't so useless.  This is basically why "lenses" were
> designed (i.e., to make consistent syntax for getters and setters)

Hey, I don't want the tutorial to be controversial either, especially since
my word choice of words like "better" are highly subjective. I find
it extraordinarily empowering that Haskell's type system allows programmers
to use a wide variety of programming paradigms: functional, declarative,
imperative, lazy, eager, parallel, quantum, matrix, CUDA, multithreaded,
distributed, logical, object oriented...

When I describe Haskell's type system as better than OOP, what I mean is
this: You can code OOP in Haskell, because the type system can adapt to
that. But it's much harder to go the other way, trying to code GADTs in
Java/C++. In order to get the effect, you'll have to code something as
complex as Scala, at which point you might as well just use Haskell (unless
you really really really need the JVM for compatibility). It's the same
with Lisp or JavaScript or Smalltalk or Ruby: Allowing the programmer to
roll his own paradigm, such as OOP, is more powerful than offering only
that paradigm. More to the point, the monad system enables all of this, and
I'm not sure how to reword this tutorial to reflect that; monads themselves
are generally treated as an advanced lesson, and this one tries to hit the
ground running.

Does anyone know of a brief introductory Haskell tutorial that engages
monads? LYAH covers monads, but it does so after a few chapters of simpler,
pure function Haskell coding. I know of some brief tutorials for monads
that explain them in a variety of creative ways, but they all assume the
reader is at least somewhat familiar with Haskell.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20120914/9956382a/attachment.htm>

More information about the Haskell-Cafe mailing list