3 ms·
> Wait, a functor is just a pure unary function? And guess what another name for a unary functions is... 'monadic'.
by chrisseaton 5y ago
> Wait, a functor is just a pure unary function?
And guess what another name for a unary functions is... 'monadic'.
- lmm 5y agoWhich means something completely different from the use of "monadic" here.
- Twisol 5y agoTo expand on this, because it's actually fascinating... Functors capture a particular pattern of "pipelining": a series of operations A -> B, B -> C, etc. can be uniformly assembled in the context of any arbitrary functor F, ultimately giving a unary pipeline `F A -> F C`. (I won't detail what this means completely; I'm going for a gut instinct in the following bit.) But what if you have a binary function, (A1, A2) -> B? Functors only let you assemble unary operators; there's no provision for taking the outputs of two pipelines and weaving them together. Applicatives (or, "monoidal functors") give you an additional operator that let you turn a pair `(F A1, F A2)` into a contextual pair `F (A1, A2)`, which can then be fed to a unary pipeline. (In terms of pipe shapes, it's a Y-bend.) Monads extend this in a less interesting way, but in the sense of "monadic" as "unary", functors are actually more monadic than monads!