Arrows in JavaScript
Arrows generalise computation schemes from the sequential version provided by monads, and are thus hard to bend one’s head around. It’s interesting to see them in JS.
3 Responses to “Arrows in JavaScript”
Leave a reply
You can use HTML, but you don't have to. Formatting tips (for code, quotes, etc.) here.
I keep thinking arrows should be called categories, since an arrow type just specifies the arrows in some category. For example (->) specifies the Haskell category (did you know that ((->) a) is a monad for any a? In fact return is K and bind is (an arg-munged version of) S) and Kleisli m specifies the Kleisli category of a monad m.
Sheesh, I should give up trying to do semantics and just do category theory, I love it.
Word. But as JVT said, these days in Computer Science, category theory is like pop music: it’s everywhere and you can’t avoid it.
return and bind are just K and S? I hadn’t spotted that… :-)
Update: turns out Arrow is really categories with products and an embedding from the ambient category, since obviously arbitrary categories don’t have pure, (&&&) etc. In fact recent GHC has a Category class, which is a superclass of Arrow.