Calculates the composition of two morphisms.