  We introduce a compositional framework for convex analysis based on the
notion of convex bifunction of Rockafellar. This framework is well-suited to
graphical reasoning, and exhibits rich dualities such as the Legendre-Fenchel
transform, while generalizing formalisms like graphical linear algebra, convex
relations and convex programming. We connect our framework to probability
theory by interpreting the Laplace approximation in its context: The exactness
of this approximation on normal distributions means that logdensity is a
functor from Gaussian probability (densities and integration) to concave
bifunctions and maximization.
