optics-core-0.4.1.1: Optics as an abstract interface: core definitions

Safe Haskell | None
Language | Haskell2010

Optics.Internal.Bi

Description

Classes for co- and contravariant bifunctors.

This module is intended for internal use only, and may change without warning in subsequent releases.

Synopsis

- class Bifunctor (p :: Type -> Type -> Type -> Type) where
  - bimap :: (a -> b) -> (c -> d) -> p i a c -> p i b d
  - first :: (a -> b) -> p i a c -> p i b c
  - second :: (c -> d) -> p i a c -> p i a d
- class Bicontravariant (p :: Type -> Type -> Type -> Type) where
  - contrabimap :: (b -> a) -> (d -> c) -> p i a c -> p i b d
  - contrafirst :: (b -> a) -> p i a c -> p i b c
  - contrasecond :: (c -> b) -> p i a b -> p i a c
- lphantom :: (Profunctor p, Bifunctor p) => p i a c -> p i b c
- rphantom :: (Profunctor p, Bicontravariant p) => p i c a -> p i c b

# Documentation

class Bifunctor (p :: Type -> Type -> Type -> Type) where Source #

Class for (covariant) bifunctors.

Methods

bimap :: (a -> b) -> (c -> d) -> p i a c -> p i b d Source #

first :: (a -> b) -> p i a c -> p i b c Source #

second :: (c -> d) -> p i a c -> p i a d Source #

#### Instances

Instances details

Bifunctor Tagged Source # |
Instance details Defined in Optics.Internal.Bi Methods bimap :: (a -> b) -> (c -> d) -> Tagged i a c -> Tagged i b d Source # first :: (a -> b) -> Tagged i a c -> Tagged i b c Source # second :: (c -> d) -> Tagged i a c -> Tagged i a d Source #

class Bicontravariant (p :: Type -> Type -> Type -> Type) where Source #

Class for contravariant bifunctors.

Methods

contrabimap :: (b -> a) -> (d -> c) -> p i a c -> p i b d Source #

contrafirst :: (b -> a) -> p i a c -> p i b c Source #

contrasecond :: (c -> b) -> p i a b -> p i a c Source #

#### Instances

Instances details

Bicontravariant (Forget r) Source # |
Instance details Defined in Optics.Internal.Bi Methods contrabimap :: (b -> a) -> (d -> c) -> Forget r i a c -> Forget r i b d Source # contrafirst :: (b -> a) -> Forget r i a c -> Forget r i b c Source # contrasecond :: (c -> b) -> Forget r i a b -> Forget r i a c Source #
Bicontravariant (ForgetM r) Source # |
Instance details Defined in Optics.Internal.Bi Methods contrabimap :: (b -> a) -> (d -> c) -> ForgetM r i a c -> ForgetM r i b d Source # contrafirst :: (b -> a) -> ForgetM r i a c -> ForgetM r i b c Source # contrasecond :: (c -> b) -> ForgetM r i a b -> ForgetM r i a c Source #
Bicontravariant (IxForget r) Source # |
Instance details Defined in Optics.Internal.Bi Methods contrabimap :: (b -> a) -> (d -> c) -> IxForget r i a c -> IxForget r i b d Source # contrafirst :: (b -> a) -> IxForget r i a c -> IxForget r i b c Source # contrasecond :: (c -> b) -> IxForget r i a b -> IxForget r i a c Source #
Bicontravariant (IxForgetM r) Source # |
Instance details Defined in Optics.Internal.Bi Methods contrabimap :: (b -> a) -> (d -> c) -> IxForgetM r i a c -> IxForgetM r i b d Source # contrafirst :: (b -> a) -> IxForgetM r i a c -> IxForgetM r i b c Source # contrasecond :: (c -> b) -> IxForgetM r i a b -> IxForgetM r i a c Source #

lphantom :: (Profunctor p, Bifunctor p) => p i a c -> p i b c Source #

If `p` is a `Profunctor` and a `Bifunctor` then its left parameter must be phantom.

rphantom :: (Profunctor p, Bicontravariant p) => p i c a -> p i c b Source #

If `p` is a `Profunctor` and `Bicontravariant` then its right parameter must be phantom.