Suppose I have some data point like:
data Atom =
{ x :: X
, y :: Y
, z :: Z
, m :: M
}
Then, suppose I have a bunch of them, atoms :: [Atom]
.
Now, I want to group them. Perhaps first by X, then Y, or by X, Z, Y, or …
Naively, I need to write a bunch of terrible functions like byXYZ :: Dict X (Dict Y (Dict Z Atom)))
, etc, per way I want to group; but there must be a better way?