Cotupling
Cotupling is a construction used in category theory and functional programming to combine two maps with a common codomain into a single map from a coproduct (sum type) to that codomain. It is the dual notion to copairing: given a coproduct A+B with canonical injections i1: A -> A+B and i2: B -> A+B, and given maps f: A -> X and g: B -> X, there exists a unique morphism h: A+B -> X such that h ∘ i1 = f and h ∘ i2 = g. This morphism h is called the cotuple or copairing of f and g, often denoted [f,g].
In programming terms, cotupling corresponds to defining a function from a sum type to a common target
Cotupling is thus the pattern of converting two independent functions into a single function that handles