lens-4.6.0.1: Lenses, Folds and Traversals

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

Control.Lens.Internal.Bazaar

Description

 

Synopsis

Documentation

class Profunctor p => Bizarre p w | w -> p where Source

This class is used to run the various Bazaar variants used in this library.

Methods

bazaar :: Applicative f => p a (f b) -> w a b t -> f t Source

newtype Bazaar p a b t Source

This is used to characterize a Traversal.

a.k.a. indexed Cartesian store comonad, indexed Kleene store comonad, or an indexed FunList.

http://twanvl.nl/blog/haskell/non-regular1

A Bazaar is like a Traversal that has already been applied to some structure.

Where a Context a b t holds an a and a function from b to t, a Bazaar a b t holds N as and a function from N bs to t, (where N might be infinite).

Mnemonically, a Bazaar holds many stores and you can easily add more.

This is a final encoding of Bazaar.

Constructors

Bazaar 

Fields

runBazaar :: forall f. Applicative f => p a (f b) -> f t
 

Instances

Corepresentable p => Sellable p (Bazaar p) 
Profunctor p => Bizarre p (Bazaar p) 
Conjoined p => IndexedComonad (Bazaar p) 
IndexedFunctor (Bazaar p) 
Functor (Bazaar p a b) 
Applicative (Bazaar p a b) 
((~) * a b, Conjoined p) => Comonad (Bazaar p a b) 
((~) * a b, Conjoined p) => ComonadApply (Bazaar p a b) 
Apply (Bazaar p a b) 

type Bazaar' p a = Bazaar p a a Source

This alias is helpful when it comes to reducing repetition in type signatures.

type Bazaar' p a t = Bazaar p a a t

newtype BazaarT p g a b t Source

BazaarT is like Bazaar, except that it provides a questionable Contravariant instance To protect this instance it relies on the soundness of another Contravariant type, and usage conventions.

For example. This lets us write a suitably polymorphic and lazy taking, but there must be a better way!

Constructors

BazaarT 

Fields

runBazaarT :: forall f. Applicative f => p a (f b) -> f t
 

Instances

Corepresentable p => Sellable p (BazaarT p g) 
Profunctor p => Bizarre p (BazaarT p g) 
Conjoined p => IndexedComonad (BazaarT p g) 
IndexedFunctor (BazaarT p g) 
Functor (BazaarT p g a b) 
Applicative (BazaarT p g a b) 
((~) * a b, Conjoined p) => Comonad (BazaarT p g a b) 
((~) * a b, Conjoined p) => ComonadApply (BazaarT p g a b) 
(Profunctor p, Contravariant g) => Contravariant (BazaarT p g a b) 
Apply (BazaarT p g a b) 
Contravariant g => Monoid (BazaarT p g a b t) 
Contravariant g => Semigroup (BazaarT p g a b t) 

type BazaarT' p g a = BazaarT p g a a Source

This alias is helpful when it comes to reducing repetition in type signatures.

type BazaarT' p g a t = BazaarT p g a a t

class Profunctor p => Bizarre1 p w | w -> p where Source

Methods

bazaar1 :: Apply f => p a (f b) -> w a b t -> f t Source

Instances

newtype Bazaar1 p a b t Source

This is used to characterize a Traversal.

a.k.a. indexed Cartesian store comonad, indexed Kleene store comonad, or an indexed FunList.

http://twanvl.nl/blog/haskell/non-regular1

A Bazaar1 is like a Traversal that has already been applied to some structure.

Where a Context a b t holds an a and a function from b to t, a Bazaar1 a b t holds N as and a function from N bs to t, (where N might be infinite).

Mnemonically, a Bazaar1 holds many stores and you can easily add more.

This is a final encoding of Bazaar1.

Constructors

Bazaar1 

Fields

runBazaar1 :: forall f. Apply f => p a (f b) -> f t
 

Instances

Corepresentable p => Sellable p (Bazaar1 p) 
Profunctor p => Bizarre1 p (Bazaar1 p) 
Conjoined p => IndexedComonad (Bazaar1 p) 
IndexedFunctor (Bazaar1 p) 
Functor (Bazaar1 p a b) 
((~) * a b, Conjoined p) => Comonad (Bazaar1 p a b) 
((~) * a b, Conjoined p) => ComonadApply (Bazaar1 p a b) 
Apply (Bazaar1 p a b) 

type Bazaar1' p a = Bazaar1 p a a Source

This alias is helpful when it comes to reducing repetition in type signatures.

type Bazaar1' p a t = Bazaar1 p a a t

newtype BazaarT1 p g a b t Source

BazaarT1 is like Bazaar1, except that it provides a questionable Contravariant instance To protect this instance it relies on the soundness of another Contravariant type, and usage conventions.

For example. This lets us write a suitably polymorphic and lazy taking, but there must be a better way!

Constructors

BazaarT1 

Fields

runBazaarT1 :: forall f. Apply f => p a (f b) -> f t
 

Instances

Corepresentable p => Sellable p (BazaarT1 p g) 
Profunctor p => Bizarre1 p (BazaarT1 p g) 
Conjoined p => IndexedComonad (BazaarT1 p g) 
IndexedFunctor (BazaarT1 p g) 
Functor (BazaarT1 p g a b) 
((~) * a b, Conjoined p) => Comonad (BazaarT1 p g a b) 
((~) * a b, Conjoined p) => ComonadApply (BazaarT1 p g a b) 
(Profunctor p, Contravariant g) => Contravariant (BazaarT1 p g a b) 
Apply (BazaarT1 p g a b) 
Contravariant g => Semigroup (BazaarT1 p g a b t) 

type BazaarT1' p g a = BazaarT1 p g a a Source

This alias is helpful when it comes to reducing repetition in type signatures.

type BazaarT1' p g a t = BazaarT1 p g a a t