profunctors-5.6.2: Profunctors

Copyright | (C) 2015-2018 Edward Kmett
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | experimental
Portability | portable
Safe Haskell | Safe
Language | Haskell2010

Data.Profunctor.Mapping

Contents

- Traversing in terms of Mapping
- Closed in terms of Mapping

Description

Synopsis

- class (Traversing p, Closed p) => Mapping (p :: Type -> Type -> Type) where
  - map' :: Functor f => p a b -> p (f a) (f b)
  - roam :: ((a -> b) -> s -> t) -> p a b -> p s t
- newtype CofreeMapping (p :: Type -> Type -> Type) a b = CofreeMapping {
  - runCofreeMapping :: forall (f :: Type -> Type). Functor f => p (f a) (f b)
  }
- data FreeMapping (p :: Type -> Type -> Type) a b where
  - FreeMapping :: forall (f :: Type -> Type) y b (p :: Type -> Type -> Type) x a. Functor f => (f y -> b) -> p x y -> (a -> f x) -> FreeMapping p a b
- wanderMapping :: Mapping p => (forall (f :: Type -> Type). Applicative f => (a -> f b) -> s -> f t) -> p a b -> p s t
- traverseMapping :: (Mapping p, Functor f) => p a b -> p (f a) (f b)
- closedMapping :: Mapping p => p a b -> p (x -> a) (x -> b)

# Documentation

class (Traversing p, Closed p) => Mapping (p :: Type -> Type -> Type) where #

Minimal complete definition

Nothing

Methods

map' :: Functor f => p a b -> p (f a) (f b) #

Laws:

    map' . rmap f ≡ rmap (fmap f) . map'
    map' . map' ≡ dimap Compose getCompose . map'
    dimap Identity runIdentity . map' ≡ id

roam :: ((a -> b) -> s -> t) -> p a b -> p s t #

#### Instances

Instances details

(Monad m, Distributive m) => Mapping (Kleisli m) # |
Instance details Defined in Data.Profunctor.Mapping Methods map' :: Functor f => Kleisli m a b -> Kleisli m (f a) (f b) # roam :: ((a -> b) -> s -> t) -> Kleisli m a b -> Kleisli m s t #
Profunctor p => Mapping (CofreeMapping p) # |
Instance details Defined in Data.Profunctor.Mapping Methods map' :: Functor f => CofreeMapping p a b -> CofreeMapping p (f a) (f b) # roam :: ((a -> b) -> s -> t) -> CofreeMapping p a b -> CofreeMapping p s t #
Mapping (FreeMapping p) # |
Instance details Defined in Data.Profunctor.Mapping Methods map' :: Functor f => FreeMapping p a b -> FreeMapping p (f a) (f b) # roam :: ((a -> b) -> s -> t) -> FreeMapping p a b -> FreeMapping p s t #
Mapping p => Mapping (Coyoneda p) # |
Instance details Defined in Data.Profunctor.Yoneda Methods map' :: Functor f => Coyoneda p a b -> Coyoneda p (f a) (f b) # roam :: ((a -> b) -> s -> t) -> Coyoneda p a b -> Coyoneda p s t #
Mapping p => Mapping (Yoneda p) # |
Instance details Defined in Data.Profunctor.Yoneda Methods map' :: Functor f => Yoneda p a b -> Yoneda p (f a) (f b) # roam :: ((a -> b) -> s -> t) -> Yoneda p a b -> Yoneda p s t #
(Applicative m, Distributive m) => Mapping (Star m) # |
Instance details Defined in Data.Profunctor.Mapping Methods map' :: Functor f => Star m a b -> Star m (f a) (f b) # roam :: ((a -> b) -> s -> t) -> Star m a b -> Star m s t #
Mapping (->) # |
Instance details Defined in Data.Profunctor.Mapping Methods map' :: Functor f => (a -> b) -> f a -> f b # roam :: ((a -> b) -> s -> t) -> (a -> b) -> s -> t #
(Functor f, Mapping p) => Mapping (Tannen f p) # |
Instance details Defined in Data.Profunctor.Mapping Methods map' :: Functor f0 => Tannen f p a b -> Tannen f p (f0 a) (f0 b) # roam :: ((a -> b) -> s -> t) -> Tannen f p a b -> Tannen f p s t #
(Functor f, Mapping p) => Mapping (Cayley f p) # |
Instance details Defined in Data.Profunctor.Cayley Methods map' :: Functor f0 => Cayley f p a b -> Cayley f p (f0 a) (f0 b) # roam :: ((a -> b) -> s -> t) -> Cayley f p a b -> Cayley f p s t #
(Mapping p, Mapping q) => Mapping (Procompose p q) # |
Instance details Defined in Data.Profunctor.Composition Methods map' :: Functor f => Procompose p q a b -> Procompose p q (f a) (f b) # roam :: ((a -> b) -> s -> t) -> Procompose p q a b -> Procompose p q s t #

newtype CofreeMapping (p :: Type -> Type -> Type) a b #

Constructors

CofreeMapping |

Fields

- runCofreeMapping :: forall (f :: Type -> Type). Functor f => p (f a) (f b)

#### Instances

Instances details

ProfunctorComonad CofreeMapping # |
Instance details Defined in Data.Profunctor.Mapping Methods proextract :: forall (p :: Type -> Type -> Type). Profunctor p => CofreeMapping p :-> p # produplicate :: forall (p :: Type -> Type -> Type). Profunctor p => CofreeMapping p :-> CofreeMapping (CofreeMapping p) #
ProfunctorFunctor CofreeMapping # |
Instance details Defined in Data.Profunctor.Mapping Methods promap :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type). Profunctor p => (p :-> q) -> CofreeMapping p :-> CofreeMapping q #
Profunctor p => Choice (CofreeMapping p) # |
Instance details Defined in Data.Profunctor.Mapping Methods left' :: CofreeMapping p a b -> CofreeMapping p (Either a c) (Either b c) # right' :: CofreeMapping p a b -> CofreeMapping p (Either c a) (Either c b) #
Profunctor p => Closed (CofreeMapping p) # |
Instance details Defined in Data.Profunctor.Mapping Methods closed :: CofreeMapping p a b -> CofreeMapping p (x -> a) (x -> b) #
Profunctor p => Mapping (CofreeMapping p) # |
Instance details Defined in Data.Profunctor.Mapping Methods map' :: Functor f => CofreeMapping p a b -> CofreeMapping p (f a) (f b) # roam :: ((a -> b) -> s -> t) -> CofreeMapping p a b -> CofreeMapping p s t #
Profunctor p => Strong (CofreeMapping p) # |
Instance details Defined in Data.Profunctor.Mapping Methods first' :: CofreeMapping p a b -> CofreeMapping p (a, c) (b, c) # second' :: CofreeMapping p a b -> CofreeMapping p (c, a) (c, b) #
Profunctor p => Traversing (CofreeMapping p) # |
Instance details Defined in Data.Profunctor.Mapping Methods traverse' :: Traversable f => CofreeMapping p a b -> CofreeMapping p (f a) (f b) # wander :: (forall (f :: Type -> Type). Applicative f => (a -> f b) -> s -> f t) -> CofreeMapping p a b -> CofreeMapping p s t #
Profunctor p => Profunctor (CofreeMapping p) # |

Instance details

Defined in Data.Profunctor.Mapping

Methods

dimap :: (a -> b) -> (c -> d) -> CofreeMapping p b c -> CofreeMapping p a d #

lmap :: (a -> b) -> CofreeMapping p b c -> CofreeMapping p a c #

rmap :: (b -> c) -> CofreeMapping p a b -> CofreeMapping p a c #

(#.) :: forall a b c q. Coercible c b => q b c -> CofreeMapping p a b -> CofreeMapping p a c #

(.#) :: forall a b c q. Coercible b a => CofreeMapping p b c -> q a b -> CofreeMapping p a c #

data FreeMapping (p :: Type -> Type -> Type) a b where #

    FreeMapping -| CofreeMapping

Constructors

FreeMapping :: forall (f :: Type -> Type) y b (p :: Type -> Type -> Type) x a. Functor f => (f y -> b) -> p x y -> (a -> f x) -> FreeMapping p a b |

#### Instances

Instances details

ProfunctorMonad FreeMapping # |
Instance details Defined in Data.Profunctor.Mapping Methods proreturn :: forall (p :: Type -> Type -> Type). Profunctor p => p :-> FreeMapping p # projoin :: forall (p :: Type -> Type -> Type). Profunctor p => FreeMapping (FreeMapping p) :-> FreeMapping p #
ProfunctorFunctor FreeMapping # |
Instance details Defined in Data.Profunctor.Mapping Methods promap :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type). Profunctor p => (p :-> q) -> FreeMapping p :-> FreeMapping q #
Choice (FreeMapping p) # |
Instance details Defined in Data.Profunctor.Mapping Methods left' :: FreeMapping p a b -> FreeMapping p (Either a c) (Either b c) # right' :: FreeMapping p a b -> FreeMapping p (Either c a) (Either c b) #
Closed (FreeMapping p) # |
Instance details Defined in Data.Profunctor.Mapping Methods closed :: FreeMapping p a b -> FreeMapping p (x -> a) (x -> b) #
Mapping (FreeMapping p) # |
Instance details Defined in Data.Profunctor.Mapping Methods map' :: Functor f => FreeMapping p a b -> FreeMapping p (f a) (f b) # roam :: ((a -> b) -> s -> t) -> FreeMapping p a b -> FreeMapping p s t #
Strong (FreeMapping p) # |
Instance details Defined in Data.Profunctor.Mapping Methods first' :: FreeMapping p a b -> FreeMapping p (a, c) (b, c) # second' :: FreeMapping p a b -> FreeMapping p (c, a) (c, b) #
Traversing (FreeMapping p) # |
Instance details Defined in Data.Profunctor.Mapping Methods traverse' :: Traversable f => FreeMapping p a b -> FreeMapping p (f a) (f b) # wander :: (forall (f :: Type -> Type). Applicative f => (a -> f b) -> s -> f t) -> FreeMapping p a b -> FreeMapping p s t #
Profunctor (FreeMapping p) # |

Instance details

Defined in Data.Profunctor.Mapping

Methods

dimap :: (a -> b) -> (c -> d) -> FreeMapping p b c -> FreeMapping p a d #

lmap :: (a -> b) -> FreeMapping p b c -> FreeMapping p a c #

rmap :: (b -> c) -> FreeMapping p a b -> FreeMapping p a c #

(#.) :: forall a b c q. Coercible c b => q b c -> FreeMapping p a b -> FreeMapping p a c #

(.#) :: forall a b c q. Coercible b a => FreeMapping p b c -> q a b -> FreeMapping p a c #

Functor (FreeMapping p a) # |
Instance details Defined in Data.Profunctor.Mapping Methods fmap :: (a0 -> b) -> FreeMapping p a a0 -> FreeMapping p a b # (<$) :: a0 -> FreeMapping p a b -> FreeMapping p a a0 #

# Traversing in terms of Mapping

wanderMapping :: Mapping p => (forall (f :: Type -> Type). Applicative f => (a -> f b) -> s -> f t) -> p a b -> p s t #

# Closed in terms of Mapping

traverseMapping :: (Mapping p, Functor f) => p a b -> p (f a) (f b) #

closedMapping :: Mapping p => p a b -> p (x -> a) (x -> b) #