Data.Profunctor.Closed

profunctors-5.2: Profunctors

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

Data.Profunctor.Closed

Description

Synopsis

- class Profunctor p => Closed p where
- newtype Closure p a b = Closure {
  - runClosure :: forall x. p (x -> a) (x -> b)
  }
- close :: Closed p => (p :-> q) -> p :-> Closure q
- unclose :: Profunctor q => (p :-> Closure q) -> p :-> q
- data Environment p a b where
  - Environment :: ((z -> y) -> b) -> p x y -> (a -> z -> x) -> Environment p a b
- curry' :: Closed p => p (a, b) c -> p a (b -> c)

# Documentation

class Profunctor p => Closed p where #

A strong profunctor allows the monoidal structure to pass through.

A closed profunctor allows the closed structure to pass through.

Minimal complete definition

closed

Methods

closed :: p a b -> p (x -> a) (x -> b) #

Instances

Closed (->) # |
Methods closed :: (a -> b) -> (x -> a) -> x -> b #
(Distributive f, Monad f) => Closed (Kleisli f) # |
Methods closed :: Kleisli f a b -> Kleisli f (x -> a) (x -> b) #
Functor f => Closed (Cokleisli f) # |
Methods closed :: Cokleisli f a b -> Cokleisli f (x -> a) (x -> b) #
Closed (Tagged *) # |
Methods closed :: Tagged * a b -> Tagged * (x -> a) (x -> b) #
Functor f => Closed (Costar f) # |
Methods closed :: Costar f a b -> Costar f (x -> a) (x -> b) #
Distributive f => Closed (Star f) # |
Methods closed :: Star f a b -> Star f (x -> a) (x -> b) #
Closed (Environment p) # |
Methods closed :: Environment p a b -> Environment p (x -> a) (x -> b) #
Profunctor p => Closed (Closure p) # |
Methods closed :: Closure p a b -> Closure p (x -> a) (x -> b) #
Closed (FreeMapping p) # |
Methods closed :: FreeMapping p a b -> FreeMapping p (x -> a) (x -> b) #
Profunctor p => Closed (CofreeMapping p) # |
Methods closed :: CofreeMapping p a b -> CofreeMapping p (x -> a) (x -> b) #
(Closed p, Closed q) => Closed (Procompose p q) # |
Methods closed :: Procompose p q a b -> Procompose p q (x -> a) (x -> b) #
(Closed p, Closed q) => Closed (Product * * p q) # |
Methods closed :: Product * * p q a b -> Product * * p q (x -> a) (x -> b) #
(Functor f, Closed p) => Closed (Tannen * * * f p) # |
Methods closed :: Tannen * * * f p a b -> Tannen * * * f p (x -> a) (x -> b) #

newtype Closure p a b #

`Closure` adjoins a `Closed` structure to any `Profunctor`.

Analogous to `Tambara` for `Strong`.

Constructors

Closure |
Fields runClosure :: forall x. p (x -> a) (x -> b)

Instances

ProfunctorComonad Closure # |
Methods proextract :: Profunctor p => Closure p :-> p # produplicate :: Profunctor p => Closure p :-> Closure (Closure p) #
ProfunctorFunctor Closure # |
Methods promap :: Profunctor p => (p :-> q) -> Closure p :-> Closure q #
ProfunctorAdjunction Environment Closure # |
Methods unit :: Profunctor p => p :-> Closure (Environment p) # counit :: Profunctor p => Environment (Closure p) :-> p #
Arrow p => Arrow (Closure p) # |
Methods arr :: (b -> c) -> Closure p b c # first :: Closure p b c -> Closure p (b, d) (c, d) # second :: Closure p b c -> Closure p (d, b) (d, c) # (***) :: Closure p b c -> Closure p b' c' -> Closure p (b, b') (c, c') # (&&&) :: Closure p b c -> Closure p b c' -> Closure p b (c, c') #
ArrowZero p => ArrowZero (Closure p) # |
Methods zeroArrow :: Closure p b c #
ArrowPlus p => ArrowPlus (Closure p) # |
Methods (<+>) :: Closure p b c -> Closure p b c -> Closure p b c #
ArrowLoop p => ArrowLoop (Closure p) # |
Methods loop :: Closure p (b, d) (c, d) -> Closure p b c #
Profunctor p => Profunctor (Closure p) # |
Methods dimap :: (a -> b) -> (c -> d) -> Closure p b c -> Closure p a d # lmap :: (a -> b) -> Closure p b c -> Closure p a c # rmap :: (b -> c) -> Closure p a b -> Closure p a c # (#.) :: Coercible * c b => (b -> c) -> Closure p a b -> Closure p a c # (.#) :: Coercible * b a => Closure p b c -> (a -> b) -> Closure p a c #
Strong p => Strong (Closure p) # |
Methods first' :: Closure p a b -> Closure p (a, c) (b, c) # second' :: Closure p a b -> Closure p (c, a) (c, b) #
Profunctor p => Closed (Closure p) # |
Methods closed :: Closure p a b -> Closure p (x -> a) (x -> b) #
Category * p => Category * (Closure p) # |
Methods id :: cat a a # (.) :: cat b c -> cat a b -> cat a c #
Profunctor p => Functor (Closure p a) # |
Methods fmap :: (a -> b) -> Closure p a a -> Closure p a b # (<$) :: a -> Closure p a b -> Closure p a a #
(Profunctor p, Arrow p) => Applicative (Closure p a) # |
Methods pure :: a -> Closure p a a # (<*>) :: Closure p a (a -> b) -> Closure p a a -> Closure p a b # (*>) :: Closure p a a -> Closure p a b -> Closure p a b # (<*) :: Closure p a a -> Closure p a b -> Closure p a a #
(Profunctor p, ArrowPlus p) => Alternative (Closure p a) # |
Methods empty :: Closure p a a # (<|>) :: Closure p a a -> Closure p a a -> Closure p a a # some :: Closure p a a -> Closure p a [a] # many :: Closure p a a -> Closure p a [a] #
(Profunctor p, Arrow p, Monoid b) => Monoid (Closure p a b) # |
Methods mempty :: Closure p a b # mappend :: Closure p a b -> Closure p a b -> Closure p a b # mconcat :: [Closure p a b] -> Closure p a b #

close :: Closed p => (p :-> q) -> p :-> Closure q #

    close . unclose ≡ id
    unclose . close ≡ id

unclose :: Profunctor q => (p :-> Closure q) -> p :-> q #

    close . unclose ≡ id
    unclose . close ≡ id

data Environment p a b where #

Constructors

Environment :: ((z -> y) -> b) -> p x y -> (a -> z -> x) -> Environment p a b |

Instances

ProfunctorMonad Environment # |
Methods proreturn :: Profunctor p => p :-> Environment p # projoin :: Profunctor p => Environment (Environment p) :-> Environment p #
ProfunctorFunctor Environment # |
Methods promap :: Profunctor p => (p :-> q) -> Environment p :-> Environment q #
ProfunctorAdjunction Environment Closure # |
Methods unit :: Profunctor p => p :-> Closure (Environment p) # counit :: Profunctor p => Environment (Closure p) :-> p #
Profunctor (Environment p) # |
Methods dimap :: (a -> b) -> (c -> d) -> Environment p b c -> Environment p a d # lmap :: (a -> b) -> Environment p b c -> Environment p a c # rmap :: (b -> c) -> Environment p a b -> Environment p a c # (#.) :: Coercible * c b => (b -> c) -> Environment p a b -> Environment p a c # (.#) :: Coercible * b a => Environment p b c -> (a -> b) -> Environment p a c #
Closed (Environment p) # |
Methods closed :: Environment p a b -> Environment p (x -> a) (x -> b) #

curry' :: Closed p => p (a, b) c -> p a (b -> c) #