[Haskell-cafe] ANN: bimap 0.1 - a bidirectional map
scook0 at gmail.com
Mon Feb 4 05:12:32 EST 2008
On Mon, Feb 4, 2008 at 7:56 PM, Neil Mitchell <ndmitchell at gmail.com> wrote:
> A few design differences from your one:
> * I called my module BiMap" rather than "Bimap" - I debated this with
> a collegue, and we settled on the capital M, but it was a very close
Mine was also originally BiMap, but I thought the capital M looked a
little ugly, so I changed it.
> * I have no L/R and Either variants. I decided it was better to be a
> superset of Data.Map, and then have lookupRev/memberRev functions for
> the R versions. Do you think anyone is likely to use the Either
> variant, without a constant Left or Right in the code? Is this an
> artefact of how its easier to code, rather than to use?
I initially had only the Either variants, because that was easier to
code, and I thought it would make the interface cleaner. Then when I
started writing tests, I realised that this was a pain, and I went
back and added the L/R variants. I never bothered to remove the Either
variants, because the L/R versions are (currently) implemented in
terms of them anyway.
I was thinking of having another module, Data.Bimap.Asymmetric, that
would expose an interface more like that of Data.Map (i.e. biased
towards treating the left type as the key), but I decided it was
better to get the first release out as soon as possible.
Thanks for the feedback,
More information about the Haskell-Cafe