Module Bifunctor.Via_bimap

Parameters

Signature

Type

type ('a, 'b) t = ('a, 'b) Req.t

The type held by the Bifunctor

Functions

val bimap : ('a -> 'b) -> ('c -> 'd) -> ('a, 'c) t -> ('b, 'd) t

Mapping over both arguments at the same time.

val map_fst : ('a -> 'b) -> ('a, 'c) t -> ('b, 'c) t

Mapping over the first argument.

val map_snd : ('b -> 'c) -> ('a, 'b) t -> ('a, 'c) t

Mapping over the second argument.

val replace_fst : 'a -> ('b, 'c) t -> ('a, 'c) t

Create a new ('a, 'b) t, replacing all values in the ('c, 'b) t by given a value of 'a.

val replace_snd : 'a -> ('b, 'c) t -> ('b, 'a) t

Create a new ('b, 'a) t, replacing all values in the ('b, 'c) t by given a value of 'a.