I know that the Applicative
class is described in category theory as a "lax monoidal functor" but I've never heard the term "lax" before, and the nlab
page on lax functor a bunch of stuff I don't recognize at all, re: bicategories and things that I didn't know we cared about in Haskell. If it is actually about bicategories, can someone give me a plebian view of what that means? Otherwise, what is "lax" doing in this name?
Asked
Active
Viewed 697 times
18
-
Wrong nlab page. See this https://ncatlab.org/nlab/show/monoidal+functor – n. m. could be an AI Sep 07 '18 at 10:38
-
"Lax" as in "Relax" over the constraint of having isomorphic mempty & mappend. – Pawan Kumar Nov 13 '19 at 16:42
1 Answers
22
Let's switch to the monoidal view of Applicative
:
unit :: () -> f ()
mult :: (f s, f t) -> f (s, t)
pure :: x -> f x
pure x = fmap (const x) (unit ())
(<*>) :: f (s -> t) -> f s -> f t
ff <*> fs = fmap (uncurry ($)) (mult (ff, fs))
For a strict monoidal functor, unit
and mult
must be isomorphisms. The impact of "lax" is to drop that requirement.
E.g., (up to the usual naivete) (->) a
is strict-monoidal, but []
is only lax-monoidal.

pigworker
- 43,025
- 18
- 121
- 214
-
I'm not sure I see how `unit` and `mult`, given here, could be isomorphisms, as it's not clear how `unit` and `mult` can compose, let alone have `unit . mult == mult . unit == id`. – chepner Sep 07 '18 at 11:36
-
8I don't mean that they are a pair of mutual inverses: I mean that they each have inverses. – pigworker Sep 07 '18 at 12:18