lens-5.2.3: Lenses, Folds and Traversals
Copyright(C) 2012-2016 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe-Inferred
LanguageHaskell2010

Control.Lens.Internal.Context

Description

 
Synopsis

Documentation

class IndexedFunctor (w :: Type -> Type -> Type -> Type) 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
IndexedFunctor Context Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

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

IndexedFunctor Mafic Source # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

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

IndexedFunctor (Bazaar p) Source # 
Instance details

Defined in Control.Lens.Internal.Bazaar

Methods

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

IndexedFunctor (Bazaar1 p) Source # 
Instance details

Defined in Control.Lens.Internal.Bazaar

Methods

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

IndexedFunctor (Pretext p) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

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

IndexedFunctor (Molten i) Source # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

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

IndexedFunctor (BazaarT p g) Source # 
Instance details

Defined in Control.Lens.Internal.Bazaar

Methods

ifmap :: (s -> t) -> BazaarT p g a b s -> BazaarT p g a b t Source #

IndexedFunctor (BazaarT1 p g) Source # 
Instance details

Defined in Control.Lens.Internal.Bazaar

Methods

ifmap :: (s -> t) -> BazaarT1 p g a b s -> BazaarT1 p g a b t Source #

IndexedFunctor (PretextT p g) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

ifmap :: (s -> t) -> PretextT p g a b s -> PretextT p g a b t Source #

IndexedFunctor (TakingWhile p f) Source # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

ifmap :: (s -> t) -> TakingWhile p f a b s -> TakingWhile p f a b t Source #

class IndexedFunctor w => IndexedComonad (w :: Type -> Type -> Type -> Type) 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

Instances details
IndexedComonad Context Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

iextract :: 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 #

Conjoined p => IndexedComonad (Bazaar p) Source # 
Instance details

Defined in Control.Lens.Internal.Bazaar

Methods

iextract :: 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 #

Conjoined p => IndexedComonad (Bazaar1 p) Source # 
Instance details

Defined in Control.Lens.Internal.Bazaar

Methods

iextract :: 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 #

Conjoined p => IndexedComonad (Pretext p) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

iextract :: 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 #

IndexedComonad (Molten i) Source # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

iextract :: 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 (BazaarT p g) Source # 
Instance details

Defined in Control.Lens.Internal.Bazaar

Methods

iextract :: 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 #

Conjoined p => IndexedComonad (BazaarT1 p g) Source # 
Instance details

Defined in Control.Lens.Internal.Bazaar

Methods

iextract :: 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 (PretextT p g) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

iextract :: 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 #

class IndexedComonad w => IndexedComonadStore (w :: Type -> Type -> Type -> Type) where Source #

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

Minimal complete definition

ipos, iseek, iseeks

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
IndexedComonadStore Context Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

ipos :: 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 #

Conjoined p => IndexedComonadStore (Pretext p) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

ipos :: 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 details

Defined in Control.Lens.Internal.Context

Methods

ipos :: 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 :: Type -> Type -> Type) (w :: Type -> Type -> Type -> Type) | 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 (Bazaar p) Source # 
Instance details

Defined in Control.Lens.Internal.Bazaar

Methods

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

Corepresentable p => Sellable p (Bazaar1 p) Source # 
Instance details

Defined in Control.Lens.Internal.Bazaar

Methods

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

Corepresentable p => Sellable p (Pretext p) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

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

Corepresentable p => Sellable p (BazaarT p g) Source # 
Instance details

Defined in Control.Lens.Internal.Bazaar

Methods

sell :: p a (BazaarT p g a b b) Source #

Corepresentable p => Sellable p (BazaarT1 p g) Source # 
Instance details

Defined in Control.Lens.Internal.Bazaar

Methods

sell :: p a (BazaarT1 p g a b b) Source #

Corepresentable p => Sellable p (PretextT p g) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

sell :: p a (PretextT p g a b b) Source #

Sellable (Indexed i) (Molten i) Source # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

sell :: Indexed i a (Molten i a b b) Source #

Sellable (->) Context Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

sell :: a -> Context a b b Source #

Sellable (->) Mafic Source # 
Instance details

Defined in Control.Lens.Internal.Magma

Methods

sell :: 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
IndexedComonad Context Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

iextract :: 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 #

IndexedComonadStore Context Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

ipos :: 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 #

IndexedFunctor Context Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

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

a ~ b => ComonadStore a (Context a b) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

pos :: 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 details

Defined in Control.Lens.Internal.Context

Methods

fmap :: (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 details

Defined in Control.Lens.Internal.Context

Methods

extract :: 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 (->) Context Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

sell :: a -> Context a b b Source #

type Context' a = Context a a Source #

type Context' a s = Context a a s

newtype Pretext (p :: Type -> Type -> Type) 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

Instances

Instances details
Corepresentable p => Sellable p (Pretext p) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

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

(a ~ b, Conjoined p) => ComonadStore a (Pretext p a b) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

pos :: 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 #

Conjoined p => IndexedComonad (Pretext p) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

iextract :: 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 #

Conjoined p => IndexedComonadStore (Pretext p) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

ipos :: 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 #

IndexedFunctor (Pretext p) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

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

Functor (Pretext p a b) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

fmap :: (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 details

Defined in Control.Lens.Internal.Context

Methods

extract :: 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 :: Type -> Type -> Type) a = Pretext p a a Source #

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

newtype PretextT (p :: Type -> Type -> Type) (g :: Type -> Type) 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

Instances

Instances details
Corepresentable p => Sellable p (PretextT p g) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

sell :: p a (PretextT p g a b b) Source #

(a ~ b, Conjoined p) => ComonadStore a (PretextT p g a b) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

pos :: 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 => IndexedComonad (PretextT p g) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

iextract :: 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 => IndexedComonadStore (PretextT p g) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

ipos :: 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 #

IndexedFunctor (PretextT p g) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

ifmap :: (s -> t) -> PretextT p g a b s -> PretextT p g a b t Source #

(Profunctor p, Contravariant g) => Contravariant (PretextT p g a b) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

contramap :: (a' -> a0) -> PretextT p g a b a0 -> PretextT p g a b a' #

(>$) :: b0 -> PretextT p g a b b0 -> PretextT p g a b a0 #

Functor (PretextT p g a b) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

fmap :: (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 #

(a ~ b, Conjoined p) => Comonad (PretextT p g a b) Source # 
Instance details

Defined in Control.Lens.Internal.Context

Methods

extract :: 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 :: Type -> Type -> Type) (g :: Type -> Type) a = PretextT p g a a Source #

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