lens-4.11.1: Lenses, Folds and Traversals

Copyright(C) 2012-2015 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellSafe
LanguageHaskell98

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

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

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.

class IndexedComonad w => IndexedComonadStore w 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.

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

Sellable (->) Context Source 
Sellable (->) Mafic Source 
Corepresentable p => Sellable p (Pretext p) Source 
Corepresentable p => Sellable p (Bazaar1 p) Source 
Corepresentable p => Sellable p (Bazaar p) Source 
Corepresentable p => Sellable p (PretextT p g) Source 
Corepresentable p => Sellable p (BazaarT1 p g) Source 
Corepresentable p => Sellable p (BazaarT p g) Source 
Sellable (Indexed i) (Molten i) Source 

data Context a b t Source

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

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

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 

Fields

runPretext :: forall f. Functor f => p a (f b) -> f t
 

Instances

Corepresentable p => Sellable p (Pretext p) Source 
((~) * a b, Conjoined p) => ComonadStore a (Pretext p a b) Source 
Conjoined p => IndexedComonadStore (Pretext p) Source 
Conjoined p => IndexedComonad (Pretext p) Source 
IndexedFunctor (Pretext p) Source 
Functor (Pretext p a b) Source 
((~) * a b, Conjoined p) => Comonad (Pretext p a b) Source 

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 

Fields

runPretextT :: forall f. Functor f => p a (f b) -> f t
 

Instances

Corepresentable p => Sellable p (PretextT p g) Source 
((~) * a b, Conjoined p) => ComonadStore a (PretextT p g a b) Source 
Conjoined p => IndexedComonadStore (PretextT p g) Source 
Conjoined p => IndexedComonad (PretextT p g) Source 
IndexedFunctor (PretextT p g) Source 
Functor (PretextT p g a b) Source 
((~) * a b, Conjoined p) => Comonad (PretextT p g a b) Source 
(Profunctor p, Contravariant g) => Contravariant (PretextT p g a b) Source 

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

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