[Haskell-cafe] bimap 0.2

Neil Mitchell ndmitchell at gmail.com
Tue Feb 5 06:25:25 EST 2008


> >  1) You depend on MTL, but I can't obviously see why. Perhaps the test suite?
> The current implementation of (!) relies on the Monad instance for
> Either exported by Control.Monad.Error. There's no fundamental reason
> for this; it was just easier to code. Perhaps I'll get rid of it in a
> later version, but I haven't bothered yet because I don't think an MTL
> dependency is a big deal.

Yes, an MTL dependency is nothing to worry about at all, and isn't
worth even thinking about removing given its actually used.

> Heck, let me prove it to you -- here's what happens if I define
> (insert = unsafeInsert):

Ah, I see now. You are of course correct.

> >  3)
> >  insert x y = delete  x
> >          >>> deleteR y
> >          >>> unsafeInsert x y
> >
> >  Why not:
> >
> >  insert x y = unsafeInsert x y . delete x . delete y
> >
> >  Now you don't end up using the arrow combinators, and it becomes more
> >  readable (at least to me). Of course, this function may disappear
> >  entirely if what I wrote in (2) is correct.
> This is a matter of taste, I guess. In this case I felt that the
> "backwards" order of (.) was a little misleading, and I'm personally
> quite comfortable with using (>>>) for forward composition.

Fair enough.

You've obviously thought about the issues in this package a great
deal, which gives me a nice happy feeling when using the package!



More information about the Haskell-Cafe mailing list