[Haskell-cafe] Wow Monads!
MarLinn
monkleyon at gmail.com
Sun Apr 16 22:43:45 UTC 2017
On 2017-04-16 03:13, John Wiegley wrote:
> MD> Anyone else have Lisp experience using Monads? Did it offer some major enhancements for you?
>
> In Lisp, I don't think the abstraction buys you much, because all the functionality you need (state, exceptions, runtime, etc) are always available to all expressions. They become an excellent way of representing "extensible composition" in a pure language that otherwise could not allow those things, but I don't see that you need it for an untyped language like Lisp.
May I present to you the lecture "Monads and Gonads" by Douglas
Crockford (https://www.youtube.com/watch?v=b0EF0VTs9Dc). He shows that
monads can make even a language like JavaScript useful (not his words).
And the talk is one of the better monad tutorials out there to boot, not
least because it's different from all the others.
My own conclusion from it is that I would maybe even turn your argument
around and claim that especially a language that has as few tools to
keep programs sensible as JS can benefit greatly from the structure a
monad provides. The benefits will be different for Lisp, but I imagine
there might be some nice use cases as well. After all, structures are a
great tool even if you're not forced to use them. ;)
On another note: the more I work with monads and their brethren, the
more I find myself thinking in terms of (a -> f b) functions instead of
things like bind. Not only is it closer to the mathematical basis, but
there's also the close relationship to lenses. I mention this because my
feeling is that this type of function is a more usable puzzle piece in
languages with limited syntax support. Especially if you also implement
functors. But that's just unsubstantiated gut feeling.
Cheers,
MarLinn
More information about the Haskell-Cafe
mailing list