The Compositional Structure of Bayesian Inference