Based on Abstract Algebra
H[?, ?]( f ) is a homomorphism from a collection monoid ?
H[?, ?] ( f ) ( Z? ) = Z?
H[?, ?] ( f ) ( U ?( a ) ) = f( a )
H[?, ?] ( f ) ( x ? y ) = H[?, ?] ( f ) ( x ) ? H[?, ?] ( f ) ( y )
For example, for h = H[?,+] ( f ) :
h ( x ? y ) = h ( x ) + h ( y )
H[?, ?] ( f ) is the homomorphic extension of f,
H[?, ?] ( f ) ? U ? = f is an adjunction.
Notes:
Monoid comprehensions are based on the notion of monoid homomorphisms from abstract algebra. A monoid homomorphism is from a collection monoid to any monoid. It maps the zero element of the input monoid to the zero of the output monoid, it replaces the unit function with function f, and it distributes over merge. For example, the homomorphism from the set monoid to the + monoid applies f to every element of the set and adds together the results.