Search code examples
haskellapplicativecategory-theory

What does "lax" mean in "lax monoidal functor"?


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?


Solution

  • 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.