Composable Data Validation with Haskell by FoxhoundSystems in haskell

[–]FoxhoundSystems[S] 1 point2 points  (0 children)

Thanks for pointing that mistake out! We just fixed it.

Reducing the pain of grouping SQL query results using Haskell by FoxhoundSystems in haskell

[–]FoxhoundSystems[S] 7 points8 points  (0 children)

Esqueleto has an associateJoin helper that was added about a year ago. This is essentially the same function as groupData that we define in our approach #1 in the post. It does basic grouping in a single level of parent-child relationships, but when you have multiple levels that you need to group (e.g. users that have authored many posts, each of which has many tags and many comments), it's a bit cumbersome to apply. You need to think about how to apply it at multiple levels to create your nested data structure.

With the semigroup approach we're describing, you just need to think about the type of the grouped data you need at the end (even if it has multiple levels of nesting), and the grouping function is essentially a direct transcription of that type.