
On Tue, Feb 5, 2008 at 11:33 PM, Christian Maeder
Neil Mitchell wrote:
Yes, an MTL dependency is nothing to worry about at all, and isn't worth even thinking about removing given its actually used.
I would appreciate haskell98 portability!
My development version has removed the need for Control.Monad.Exception and Control.Arrow. The only remaining H98 incompatibility I can think of is the use of foldl' in fromList.
We've called it "injective maps". Does surjectivity make sense a all? Our other names are bad, but maybe "transpose" or "inverse" is better than "twist" (viewing maps as finite functions).
In my mind, surjectivity is the property that each key in the right-hand map is a value in the left-hand map (and vice-versa). This is related to the unsafeInsert problem I mentioned earlier. I'm open to suggesions for alternatives to "twist". I think it's cute, because it suggests transposing something without fundamentally changing it, but a less fanciful name could be a good idea.
Our delete function takes both values as input, possibly deleting two entries, but your two delete functions make more sense.
Incidentally, someone might find it useful to have a two-argument delete defined as deletePair :: (Ord a, Ord b) => a -> b -> Bimap a b -> Bimap a b deletePair x y bi | (x, y) `pairMember` bi = delete x bi | otherwise = bi but it's easy enough to define that I probably don't need to provide it myself.
http://www.dfki.de/sks/hets/src-distribution/daily/Hets/docs/Common-InjMap.h... or http://www.dfki.de/sks/hets/src-distribution/versions/Hets/docs/Common-InjMa...
The getAToB and getBToA functions are interesting. I'm thinking of adding them as toMap and toMapR. Stuart