1. 9
    1. 7

      The main problem I’ve ran into with utilities like this is that they cannot generate sum types or otherwise handle varying representations in locations.

      This isn’t a problem in Haskell, you just define the sum type. It’s just that most people writing these utilities don’t go the last mile.

      This utility solves the problem but not in a way I prefer: the union typed :|: is unnecessary AFAICT. You can generate Haskell types that are more idiomatic using regular sum types.

      The next limitation to be aware of is that you want to be sure these utilities are doing breadth first unions of the representations, so that you have more normalized types. Cf. https://github.com/bitemyapp/bloodhound/blob/master/src/Database/V5/Bloodhound/Internal/Query.hs#L20-L51

      All that said, cool tool. I’m glad this was posted so that I could remember to give it a spin again next time this problem arises for me.