4 ms·
> 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 implicit
by Peaker 14y ago
> 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).