Functor => Pointed => Applicative => Monad
stephen.tetley at gmail.com
Mon Nov 29 06:38:45 EST 2010
Convention has Bifunctor as this class:
class Bifunctor f where
bimap :: (a -> x) -> (b -> y) -> f a b -> f x y
Personally I'd like to add these two so they can be optimized if required:
mapFst :: (a -> x) -> f a b -> f x b
mapSnd :: (b -> y) -> f a b -> f a y
Though, I'm sanguine about the names.
On pairs mapSnd is fmap, however I'd still like mapSnd in addition to
fmap - if I'm working with pairs I'd want the symmetric "vocabulary"
of pairs not a pidgin of two vocabularies.
Bifunctor is a class I'd really like to see in Base. When working with
pairs, I much prefer the notation from Bifunctor to the notations from
Control.Categrory & Arrows.
More information about the Libraries