Data.Bifunctor

lib/Data/Bifunctor.gob

No module comment.

class Bifunctor f

Two type parameters, both mapped. Either is right-biased, so Functor (Either l) can only reach the right; this is how the left is reached, and reaching it is not an error operation -- Either is not Result, and nothing here presumes a Left is a failure.

The class variable has kind * -> * -> *, discovered from f a b in bimap's own signature and written down nowhere, exactly as Monad's * -> * is.

The Prelude does not mention this module, in either tier: not among the classes it puts in every file, and not among the thirteen modules every file has qualified. Functor, Applicative and Monad are in the first because ? is written in terms of them; Array, Int and String are in the second because everything reaches for them. Nothing in the language names this one and most programs never touch it, so it does not earn a permanent slot in either namespace -- a program that wants it imports it, as it would any other library module.

Unchecked law: second must agree with map at every type that is both a Functor (in its second parameter) and a Bifunctor.

fun bimap : [Bifunctor f] fun(f a b, fun(a) -> c, fun(b) -> d) -> f c d
fun first : [Bifunctor f] fun(f a b, fun(a) -> c) -> f c b
fun second : [Bifunctor f] fun(f a b, fun(b) -> d) -> f a d