| Copyright | (C) 2012-2016 Edward Kmett |
|---|---|
| License | BSD-style (see the file LICENSE) |
| Maintainer | Edward Kmett <ekmett@gmail.com> |
| Stability | experimental |
| Portability | non-portable |
| Safe Haskell | None |
| Language | Haskell2010 |
Control.Lens.Internal.Context
Description
Synopsis
- class IndexedFunctor w where
- ifmap :: (s -> t) -> w a b s -> w a b t
- class IndexedFunctor w => IndexedComonad w where
- iextract :: w a a t -> t
- iduplicate :: w a c t -> w a b (w b c t)
- iextend :: (w b c t -> r) -> w a c t -> w a b r
- data Context a b t = Context (b -> t) a
- type Context' a = Context a a
- newtype Pretext p a b t = Pretext {
- runPretext :: forall f. Functor f => p a (f b) -> f t
- type Pretext' p a = Pretext p a a
- newtype PretextT p (g :: * -> *) a b t = PretextT {
- runPretextT :: forall f. Functor f => p a (f b) -> f t
- type PretextT' p g a = PretextT p g a a
Documentation
class IndexedFunctor w where Source #
This is a Bob Atkey -style 2-argument indexed functor.
It exists as a superclass for IndexedComonad and expresses the functoriality
of an IndexedComonad in its third argument.
Instances
| IndexedFunctor Context Source # | |
| IndexedFunctor Mafic Source # | |
| IndexedFunctor (Pretext p) Source # | |
| IndexedFunctor (Bazaar1 p) Source # | |
| IndexedFunctor (Bazaar p) Source # | |
| IndexedFunctor (Molten i) Source # | |
| IndexedFunctor (PretextT p g) Source # | |
class IndexedFunctor w => IndexedComonad w where Source #
This is a Bob Atkey -style 2-argument indexed comonad.
It exists as a superclass for IndexedComonad and expresses the functoriality
of an IndexedComonad in its third argument.
The notion of indexed monads is covered in more depth in Bob Atkey's "Parameterized Notions of Computation" http://bentnib.org/paramnotions-jfp.pdf and that construction is dualized here.
Minimal complete definition
iextract, (iduplicate | iextend)
Methods
iextract :: w a a t -> t Source #
extract from an indexed comonadic value when the indices match.
iduplicate :: w a c t -> w a b (w b c t) Source #
duplicate an indexed comonadic value splitting the index.
iextend :: (w b c t -> r) -> w a c t -> w a b r Source #
extend a indexed comonadic computation splitting the index.
Instances
| IndexedComonad Context Source # | |
| IndexedComonad (Molten i) Source # | |
The indexed store can be used to characterize a Lens
and is used by cloneLens.
is isomorphic to
Context a b tnewtype ,
and to Context a b t = Context { runContext :: forall f. Functor f => (a -> f b) -> f t }exists s. (s, .Lens s t a b)
A Context is like a Lens that has already been applied to a some structure.
Constructors
| Context (b -> t) a |
newtype Pretext p a b t Source #
This is a generalized form of Context that can be repeatedly cloned with less
impact on its performance, and which permits the use of an arbitrary Conjoined
Profunctor
Constructors
| Pretext | |
Fields
| |
newtype PretextT p (g :: * -> *) a b t Source #
This is a generalized form of Context that can be repeatedly cloned with less
impact on its performance, and which permits the use of an arbitrary Conjoined
Profunctor.
The extra phantom Functor is used to let us lie and claim
Getter-compatibility under limited circumstances.
This is used internally to permit a number of combinators to gracefully
degrade when applied to a Fold or
Getter.
Constructors
| PretextT | |
Fields
| |