categories-1.0.7: Categories

Copyright | 2008-2010 Edward Kmett
License | BSD3
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | experimental
Portability | non-portable (functional-dependencies)
Safe Haskell | Trustworthy
Language | Haskell2010

Control.Categorical.Bifunctor

Description

A more categorical definition of `Bifunctor`

Synopsis

- class (Category r, Category t) => PFunctor (p :: Type -> Type -> Type) (r :: Type -> Type -> Type) (t :: Type -> Type -> Type) | p r -> t, p t -> r where
  - first :: r a b -> t (p a c) (p b c)
- class (Category s, Category t) => QFunctor (q :: Type -> Type -> Type) (s :: Type -> Type -> Type) (t :: Type -> Type -> Type) | q s -> t, q t -> s where
  - second :: s a b -> t (q c a) (q c b)
- class (PFunctor p r t, QFunctor p s t) => Bifunctor (p :: Type -> Type -> Type) (r :: Type -> Type -> Type) (s :: Type -> Type -> Type) (t :: Type -> Type -> Type) | p r -> s t, p s -> r t, p t -> r s where
  - bimap :: r a b -> s c d -> t (p a c) (p b d)
- dimap :: Bifunctor f (Dual s) t u => s b a -> t c d -> u (f a c) (f b d)
- difirst :: PFunctor f (Dual s) t => s b a -> t (f a c) (f b c)

# Documentation

class (Category r, Category t) => PFunctor (p :: Type -> Type -> Type) (r :: Type -> Type -> Type) (t :: Type -> Type -> Type) | p r -> t, p t -> r where Source #

Methods

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

#### Instances

Instances details

PFunctor Either (->) (->) Source # |
Instance details Defined in Control.Categorical.Bifunctor Methods first :: (a -> b) -> Either a c -> Either b c Source #
PFunctor (,) (->) (->) Source # |
Instance details Defined in Control.Categorical.Bifunctor Methods first :: (a -> b) -> (a, c) -> (b, c) Source #

class (Category s, Category t) => QFunctor (q :: Type -> Type -> Type) (s :: Type -> Type -> Type) (t :: Type -> Type -> Type) | q s -> t, q t -> s where Source #

Methods

second :: s a b -> t (q c a) (q c b) Source #

#### Instances

Instances details

QFunctor Either (->) (->) Source # |
Instance details Defined in Control.Categorical.Bifunctor Methods second :: (a -> b) -> Either c a -> Either c b Source #
QFunctor (,) (->) (->) Source # |
Instance details Defined in Control.Categorical.Bifunctor Methods second :: (a -> b) -> (c, a) -> (c, b) Source #
QFunctor (->) (->) (->) Source # |
Instance details Defined in Control.Categorical.Bifunctor Methods second :: (a -> b) -> (c -> a) -> (c -> b) Source #

class (PFunctor p r t, QFunctor p s t) => Bifunctor (p :: Type -> Type -> Type) (r :: Type -> Type -> Type) (s :: Type -> Type -> Type) (t :: Type -> Type -> Type) | p r -> s t, p s -> r t, p t -> r s where Source #

Minimal definition: `bimap`

Methods

bimap :: r a b -> s c d -> t (p a c) (p b d) Source #

#### Instances

Instances details

Bifunctor Either (->) (->) (->) Source # |
Instance details Defined in Control.Categorical.Bifunctor Methods bimap :: (a -> b) -> (c -> d) -> Either a c -> Either b d Source #
Bifunctor (,) (->) (->) (->) Source # |
Instance details Defined in Control.Categorical.Bifunctor Methods bimap :: (a -> b) -> (c -> d) -> (a, c) -> (b, d) Source #

dimap :: Bifunctor f (Dual s) t u => s b a -> t c d -> u (f a c) (f b d) Source #

difirst :: PFunctor f (Dual s) t => s b a -> t (f a c) (f b c) Source #