lens-5.0.1: Lenses, Folds and Traversals

Control.Lens.Internal.Context

Description

Synopsis

# 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.

Methods

ifmap :: (s -> t) -> w a b s -> w a b t Source #

#### Instances

Instances details
 Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsifmap :: (s -> t) -> Context a b s -> Context a b t Source # Source # Instance detailsDefined in Control.Lens.Internal.Magma Methodsifmap :: (s -> t) -> Mafic a b s -> Mafic a b t Source # Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsifmap :: (s -> t) -> Pretext p a b s -> Pretext p a b t Source # Source # Instance detailsDefined in Control.Lens.Internal.Bazaar Methodsifmap :: (s -> t) -> Bazaar1 p a b s -> Bazaar1 p a b t Source # Source # Instance detailsDefined in Control.Lens.Internal.Bazaar Methodsifmap :: (s -> t) -> Bazaar p a b s -> Bazaar p a b t Source # Source # Instance detailsDefined in Control.Lens.Internal.Magma Methodsifmap :: (s -> t) -> Molten i a b s -> Molten i a b t Source # Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsifmap :: (s -> t) -> PretextT p g a b s -> PretextT p g a b t Source # Source # Instance detailsDefined in Control.Lens.Internal.Bazaar Methodsifmap :: (s -> t) -> BazaarT1 p g a b s -> BazaarT1 p g a b t Source # Source # Instance detailsDefined in Control.Lens.Internal.Bazaar Methodsifmap :: (s -> t) -> BazaarT p g a b s -> BazaarT p g a b t Source # Source # Instance detailsDefined in Control.Lens.Internal.Magma Methodsifmap :: (s -> t) -> TakingWhile p f a b s -> TakingWhile p f a b t 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

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

Instances details
 Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsiextract :: Context a a t -> t Source #iduplicate :: Context a c t -> Context a b (Context b c t) Source #iextend :: (Context b c t -> r) -> Context a c t -> Context a b r Source # Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsiextract :: Pretext p a a t -> t Source #iduplicate :: Pretext p a c t -> Pretext p a b (Pretext p b c t) Source #iextend :: (Pretext p b c t -> r) -> Pretext p a c t -> Pretext p a b r Source # Source # Instance detailsDefined in Control.Lens.Internal.Bazaar Methodsiextract :: Bazaar1 p a a t -> t Source #iduplicate :: Bazaar1 p a c t -> Bazaar1 p a b (Bazaar1 p b c t) Source #iextend :: (Bazaar1 p b c t -> r) -> Bazaar1 p a c t -> Bazaar1 p a b r Source # Source # Instance detailsDefined in Control.Lens.Internal.Bazaar Methodsiextract :: Bazaar p a a t -> t Source #iduplicate :: Bazaar p a c t -> Bazaar p a b (Bazaar p b c t) Source #iextend :: (Bazaar p b c t -> r) -> Bazaar p a c t -> Bazaar p a b r Source # Source # Instance detailsDefined in Control.Lens.Internal.Magma Methodsiextract :: Molten i a a t -> t Source #iduplicate :: Molten i a c t -> Molten i a b (Molten i b c t) Source #iextend :: (Molten i b c t -> r) -> Molten i a c t -> Molten i a b r Source # Conjoined p => IndexedComonad (PretextT p g) Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsiextract :: PretextT p g a a t -> t Source #iduplicate :: PretextT p g a c t -> PretextT p g a b (PretextT p g b c t) Source #iextend :: (PretextT p g b c t -> r) -> PretextT p g a c t -> PretextT p g a b r Source # Conjoined p => IndexedComonad (BazaarT1 p g) Source # Instance detailsDefined in Control.Lens.Internal.Bazaar Methodsiextract :: BazaarT1 p g a a t -> t Source #iduplicate :: BazaarT1 p g a c t -> BazaarT1 p g a b (BazaarT1 p g b c t) Source #iextend :: (BazaarT1 p g b c t -> r) -> BazaarT1 p g a c t -> BazaarT1 p g a b r Source # Conjoined p => IndexedComonad (BazaarT p g) Source # Instance detailsDefined in Control.Lens.Internal.Bazaar Methodsiextract :: BazaarT p g a a t -> t Source #iduplicate :: BazaarT p g a c t -> BazaarT p g a b (BazaarT p g b c t) Source #iextend :: (BazaarT p g b c t -> r) -> BazaarT p g a c t -> BazaarT p g a b r Source #

This is an indexed analogue to ComonadStore for when you are working with an IndexedComonad.

Minimal complete definition

Methods

ipos :: w a c t -> a Source #

This is the generalization of pos to an indexed comonad store.

ipeek :: c -> w a c t -> t Source #

This is the generalization of peek to an indexed comonad store.

ipeeks :: (a -> c) -> w a c t -> t Source #

This is the generalization of peeks to an indexed comonad store.

iseek :: b -> w a c t -> w b c t Source #

This is the generalization of seek to an indexed comonad store.

iseeks :: (a -> b) -> w a c t -> w b c t Source #

This is the generalization of seeks to an indexed comonad store.

iexperiment :: Functor f => (b -> f c) -> w b c t -> f t Source #

This is the generalization of experiment to an indexed comonad store.

context :: w a b t -> Context a b t Source #

We can always forget the rest of the structure of w and obtain a simpler indexed comonad store model called Context.

#### Instances

Instances details
 Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsipos :: Context a c t -> a Source #ipeek :: c -> Context a c t -> t Source #ipeeks :: (a -> c) -> Context a c t -> t Source #iseek :: b -> Context a c t -> Context b c t Source #iseeks :: (a -> b) -> Context a c t -> Context b c t Source #iexperiment :: Functor f => (b -> f c) -> Context b c t -> f t Source #context :: Context a b t -> Context a b t Source # Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsipos :: Pretext p a c t -> a Source #ipeek :: c -> Pretext p a c t -> t Source #ipeeks :: (a -> c) -> Pretext p a c t -> t Source #iseek :: b -> Pretext p a c t -> Pretext p b c t Source #iseeks :: (a -> b) -> Pretext p a c t -> Pretext p b c t Source #iexperiment :: Functor f => (b -> f c) -> Pretext p b c t -> f t Source #context :: Pretext p a b t -> Context a b t Source # Conjoined p => IndexedComonadStore (PretextT p g) Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsipos :: PretextT p g a c t -> a Source #ipeek :: c -> PretextT p g a c t -> t Source #ipeeks :: (a -> c) -> PretextT p g a c t -> t Source #iseek :: b -> PretextT p g a c t -> PretextT p g b c t Source #iseeks :: (a -> b) -> PretextT p g a c t -> PretextT p g b c t Source #iexperiment :: Functor f => (b -> f c) -> PretextT p g b c t -> f t Source #context :: PretextT p g a b t -> Context a b t Source #

class Corepresentable p => Sellable p w | w -> p where Source #

This is used internally to construct a Bazaar, Context or Pretext from a singleton value.

Methods

sell :: p a (w a b b) Source #

#### Instances

Instances details
 Corepresentable p => Sellable p (Pretext p) Source # Instance detailsDefined in Control.Lens.Internal.Context Methodssell :: p a (Pretext p a b b) Source # Corepresentable p => Sellable p (Bazaar1 p) Source # Instance detailsDefined in Control.Lens.Internal.Bazaar Methodssell :: p a (Bazaar1 p a b b) Source # Corepresentable p => Sellable p (Bazaar p) Source # Instance detailsDefined in Control.Lens.Internal.Bazaar Methodssell :: p a (Bazaar p a b b) Source # Corepresentable p => Sellable p (PretextT p g) Source # Instance detailsDefined in Control.Lens.Internal.Context Methodssell :: p a (PretextT p g a b b) Source # Corepresentable p => Sellable p (BazaarT1 p g) Source # Instance detailsDefined in Control.Lens.Internal.Bazaar Methodssell :: p a (BazaarT1 p g a b b) Source # Corepresentable p => Sellable p (BazaarT p g) Source # Instance detailsDefined in Control.Lens.Internal.Bazaar Methodssell :: p a (BazaarT p g a b b) Source # Sellable (Indexed i) (Molten i) Source # Instance detailsDefined in Control.Lens.Internal.Magma Methodssell :: Indexed i a (Molten i a b b) Source # Sellable ((->) :: Type -> Type -> Type) Context Source # Instance detailsDefined in Control.Lens.Internal.Context Methodssell :: a -> Context a b b Source # Sellable ((->) :: Type -> Type -> Type) Mafic Source # Instance detailsDefined in Control.Lens.Internal.Magma Methodssell :: a -> Mafic a b b Source #

data Context a b t Source #

The indexed store can be used to characterize a Lens and is used by cloneLens.

Context a b t is isomorphic to newtype Context a b t = Context { runContext :: forall f. Functor f => (a -> f b) -> f t }, and to 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

#### Instances

Instances details
 Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsipos :: Context a c t -> a Source #ipeek :: c -> Context a c t -> t Source #ipeeks :: (a -> c) -> Context a c t -> t Source #iseek :: b -> Context a c t -> Context b c t Source #iseeks :: (a -> b) -> Context a c t -> Context b c t Source #iexperiment :: Functor f => (b -> f c) -> Context b c t -> f t Source #context :: Context a b t -> Context a b t Source # Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsiextract :: Context a a t -> t Source #iduplicate :: Context a c t -> Context a b (Context b c t) Source #iextend :: (Context b c t -> r) -> Context a c t -> Context a b r Source # Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsifmap :: (s -> t) -> Context a b s -> Context a b t Source # a ~ b => ComonadStore a (Context a b) Source # Instance detailsDefined in Control.Lens.Internal.Context Methodspos :: Context a b a0 -> a #peek :: a -> Context a b a0 -> a0 #peeks :: (a -> a) -> Context a b a0 -> a0 #seek :: a -> Context a b a0 -> Context a b a0 #seeks :: (a -> a) -> Context a b a0 -> Context a b a0 #experiment :: Functor f => (a -> f a) -> Context a b a0 -> f a0 # Functor (Context a b) Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsfmap :: (a0 -> b0) -> Context a b a0 -> Context a b b0 #(<$) :: a0 -> Context a b b0 -> Context a b a0 # a ~ b => Comonad (Context a b) Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsextract :: Context a b a0 -> a0 #duplicate :: Context a b a0 -> Context a b (Context a b a0) #extend :: (Context a b a0 -> b0) -> Context a b a0 -> Context a b b0 # Sellable ((->) :: Type -> Type -> Type) Context Source # Instance detailsDefined in Control.Lens.Internal.Context Methodssell :: a -> Context a b b Source # type Context' a = Context a a Source # type Context' a s = Context a a s 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 FieldsrunPretext :: forall f. Functor f => p a (f b) -> f t #### Instances Instances details  Corepresentable p => Sellable p (Pretext p) Source # Instance detailsDefined in Control.Lens.Internal.Context Methodssell :: p a (Pretext p a b b) Source # (a ~ b, Conjoined p) => ComonadStore a (Pretext p a b) Source # Instance detailsDefined in Control.Lens.Internal.Context Methodspos :: Pretext p a b a0 -> a #peek :: a -> Pretext p a b a0 -> a0 #peeks :: (a -> a) -> Pretext p a b a0 -> a0 #seek :: a -> Pretext p a b a0 -> Pretext p a b a0 #seeks :: (a -> a) -> Pretext p a b a0 -> Pretext p a b a0 #experiment :: Functor f => (a -> f a) -> Pretext p a b a0 -> f a0 # Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsipos :: Pretext p a c t -> a Source #ipeek :: c -> Pretext p a c t -> t Source #ipeeks :: (a -> c) -> Pretext p a c t -> t Source #iseek :: b -> Pretext p a c t -> Pretext p b c t Source #iseeks :: (a -> b) -> Pretext p a c t -> Pretext p b c t Source #iexperiment :: Functor f => (b -> f c) -> Pretext p b c t -> f t Source #context :: Pretext p a b t -> Context a b t Source # Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsiextract :: Pretext p a a t -> t Source #iduplicate :: Pretext p a c t -> Pretext p a b (Pretext p b c t) Source #iextend :: (Pretext p b c t -> r) -> Pretext p a c t -> Pretext p a b r Source # Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsifmap :: (s -> t) -> Pretext p a b s -> Pretext p a b t Source # Functor (Pretext p a b) Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsfmap :: (a0 -> b0) -> Pretext p a b a0 -> Pretext p a b b0 #(<$) :: a0 -> Pretext p a b b0 -> Pretext p a b a0 # (a ~ b, Conjoined p) => Comonad (Pretext p a b) Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsextract :: Pretext p a b a0 -> a0 #duplicate :: Pretext p a b a0 -> Pretext p a b (Pretext p a b a0) #extend :: (Pretext p a b a0 -> b0) -> Pretext p a b a0 -> Pretext p a b b0 #

type Pretext' p a = Pretext p a a Source #

type Pretext' p a s = Pretext p a a s

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 FieldsrunPretextT :: forall f. Functor f => p a (f b) -> f t

#### Instances

Instances details
 Corepresentable p => Sellable p (PretextT p g) Source # Instance detailsDefined in Control.Lens.Internal.Context Methodssell :: p a (PretextT p g a b b) Source # (a ~ b, Conjoined p) => ComonadStore a (PretextT p g a b) Source # Instance detailsDefined in Control.Lens.Internal.Context Methodspos :: PretextT p g a b a0 -> a #peek :: a -> PretextT p g a b a0 -> a0 #peeks :: (a -> a) -> PretextT p g a b a0 -> a0 #seek :: a -> PretextT p g a b a0 -> PretextT p g a b a0 #seeks :: (a -> a) -> PretextT p g a b a0 -> PretextT p g a b a0 #experiment :: Functor f => (a -> f a) -> PretextT p g a b a0 -> f a0 # Conjoined p => IndexedComonadStore (PretextT p g) Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsipos :: PretextT p g a c t -> a Source #ipeek :: c -> PretextT p g a c t -> t Source #ipeeks :: (a -> c) -> PretextT p g a c t -> t Source #iseek :: b -> PretextT p g a c t -> PretextT p g b c t Source #iseeks :: (a -> b) -> PretextT p g a c t -> PretextT p g b c t Source #iexperiment :: Functor f => (b -> f c) -> PretextT p g b c t -> f t Source #context :: PretextT p g a b t -> Context a b t Source # Conjoined p => IndexedComonad (PretextT p g) Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsiextract :: PretextT p g a a t -> t Source #iduplicate :: PretextT p g a c t -> PretextT p g a b (PretextT p g b c t) Source #iextend :: (PretextT p g b c t -> r) -> PretextT p g a c t -> PretextT p g a b r Source # Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsifmap :: (s -> t) -> PretextT p g a b s -> PretextT p g a b t Source # Functor (PretextT p g a b) Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsfmap :: (a0 -> b0) -> PretextT p g a b a0 -> PretextT p g a b b0 #(<$) :: a0 -> PretextT p g a b b0 -> PretextT p g a b a0 # (Profunctor p, Contravariant g) => Contravariant (PretextT p g a b) Source # Instance detailsDefined in Control.Lens.Internal.Context Methodscontramap :: (a0 -> b0) -> PretextT p g a b b0 -> PretextT p g a b a0 #(>$) :: b0 -> PretextT p g a b b0 -> PretextT p g a b a0 # (a ~ b, Conjoined p) => Comonad (PretextT p g a b) Source # Instance detailsDefined in Control.Lens.Internal.Context Methodsextract :: PretextT p g a b a0 -> a0 #duplicate :: PretextT p g a b a0 -> PretextT p g a b (PretextT p g a b a0) #extend :: (PretextT p g a b a0 -> b0) -> PretextT p g a b a0 -> PretextT p g a b b0 #

type PretextT' p g a = PretextT p g a a Source #

type PretextT' p g a s = PretextT p g a a s