News for hackers. Stuff that matters.
Re:The Haskell Cheatsheet by Peaker on Sunday December 16, 2012 @06:15PM (#4929974)
> relative to just writing the code in the order you want things to happen in an imperative language

When you write them in the order you want, you're implicitly chaining them with a primitive chain operator that's built-into the language.

In Haskell, this is exactly what "do" notation does. So in what sense is it "overcomplicated"?

Example, Python:

  def func(x, y, z):
    foo(x())
    otherFunc(lambda : y.hello(z))
Haskell:

  func x y z = do
    foo =<< x
    otherFunc (hello y z)
The syntax is slightly more verbose for chaining actions as arguments (foo), but more concise when passing around first-class actions (hello).

There are no comments on this comment yet.