merge : (comparable -> These a b -> result -> result) -> Dict comparable a -> Dict comparable b -> result -> result
The definition of Dict.merge leaves something to be desired.
We provide a simpler version here that takes one function for the merging. You can handle all the cases in your one supplied function. If you use the functions from These, you can probably inline it.
The version in core requires you to write three separate functions to work with it. The reason it does this is because there's no "inclusive-or" abstraction in core. So, we're forced to deal with this more complex function.
Fun fact:
The core Dict.merge actually encodes These with a Boehm-Berarducci encoding.
It's basically Church encoding, but typed.