I pushed a pull request to Edward Kmett’s either package to implement two functions some guys was complaining not to find:
flipEither :: Either e a -> Either a e and
flipEitherT :: EitherT e m a -> EitherT a m e.
When implementing the functions, I wondered: “Hey, flipping stuff is a pretty common operation. Don’t we have an abstraction for that yet?”. I haven’t found any.
I decided to make a little typeclass to see what it’d be.
If you think that’s handy, I’ll write a little package with default instances to make it live.
Happy hacking folks!