More Data.Set and Data.Map operations
David Feuer
david.feuer at gmail.com
Sun Aug 7 20:06:54 UTC 2016
On Sun, Aug 7, 2016 at 3:31 PM, Henning Thielemann
<lemming at henning-thielemann.de> wrote:
> If I import a package (containers) with functions that are only available on
> GHC then I need to insert conditionals for whether I am running on GHC or
> not.
This is true. Unfortunately, the safe, relatively pleasant, relatively
comprehensible, and relatively general API this function offers simply
can't be supported without GADTs. It would be possible to retain
safety and generality in a potentially-more-portable fashion using
rank 2 types, but the API is unlikely to be pleasant or easy to
understand. The alternatives are to use mergeWithKey, which is
unpleasant, difficult to understand, and unsafe, or to export four
functions instead of one. I don't particularly care for either of
those options. If you are more concerned about portability than safety
or ease of understanding, you can always use mergeWithKey.
More information about the Libraries
mailing list