18

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?

duplode
  • 33,731
  • 7
  • 79
  • 150
luqui
  • 59,485
  • 12
  • 145
  • 204

1 Answers1

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
  • 8
    I 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