Reducing the pain of grouping SQL query results using Haskell
By Ben Levy and Christian Charukiewicz
Semigroups allow us to transform the denormalized results of our SQL queries into a structure that models parent-child relationships by focusing on the types we want to achieve rather than by writing tedious merge operations.