snoyberg / classy-prelude

A typeclass-based Prelude.
108 stars 15 forks source link

Prefer first/second from Bifunctor? #82

Closed rehno-lindeque closed 9 years ago

rehno-lindeque commented 9 years ago

Currently classy-prelude uses first and second from Control.Arrow. I think first and second from Data.Bifunctor is more general though (e.g. I occasionally use it on Either types)

e.g.

first pack $ Left ("Text" :: String) :: Either Text ()

Not sure, but I think I also read somewhere that there were some arguments for Data.Bifunctor being included in base?

snoyberg commented 9 years ago

It's not strictly more general: it confines us to the -> Category, and generalizes from tuples to any Bifunctor. I tend to agree with you that people are more likely to want to generalize their Bifunctors than their Categorys, so I think I like this change.

@gregwebs How do you feel?

gregwebs commented 9 years ago

+1. I also prefer the easy to remember bitmap and I would like to only export the fanout operator from Arrow.

gregwebs commented 9 years ago

Oops, I meant bimap.

snoyberg commented 9 years ago

OK, let's go for it. I'd say just re-export the entire Bifunctor typeclass. This will require a major version bump since it is a breaking change.

Do either of you have particular goals for how this should look? If so, please commit/pull request them. If not, I'll just commit the "obvious" implementation.

rehno-lindeque commented 9 years ago

For our prelude I've simply re-exported Data.Bifunctor since it only has those three functions exposed in that module.

snoyberg commented 9 years ago

Alright, cdf041f should address this. Comments before I release?

gregwebs commented 9 years ago

looks good!

snoyberg commented 9 years ago

I've released 0.10 to Hackage.

rehno-lindeque commented 9 years ago

:+1: