lens-5.3.3: Lenses, Folds and Traversals

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 | Safe-Inferred
Language | Haskell2010

Control.Lens.Internal.Bazaar

Description

Synopsis

- class Profunctor p => Bizarre (p :: Type -> Type -> Type) (w :: Type -> Type -> Type -> Type) | w -> p where
  - bazaar :: Applicative f => p a (f b) -> w a b t -> f t
- newtype Bazaar (p :: Type -> Type -> Type) a b t = Bazaar {
  - runBazaar :: forall (f :: Type -> Type). Applicative f => p a (f b) -> f t
  }
- type Bazaar' (p :: Type -> Type -> Type) a = Bazaar p a a
- newtype BazaarT (p :: Type -> Type -> Type) (g :: Type -> Type) a b t = BazaarT {
  - runBazaarT :: forall (f :: Type -> Type). Applicative f => p a (f b) -> f t
  }
- type BazaarT' (p :: Type -> Type -> Type) (g :: Type -> Type) a = BazaarT p g a a
- class Profunctor p => Bizarre1 (p :: Type -> Type -> Type) (w :: Type -> Type -> Type -> Type) | w -> p where
  - bazaar1 :: Apply f => p a (f b) -> w a b t -> f t
- newtype Bazaar1 (p :: Type -> Type -> Type) a b t = Bazaar1 {
  - runBazaar1 :: forall (f :: Type -> Type). Apply f => p a (f b) -> f t
  }
- type Bazaar1' (p :: Type -> Type -> Type) a = Bazaar1 p a a
- newtype BazaarT1 (p :: Type -> Type -> Type) (g :: Type -> Type) a b t = BazaarT1 {
  - runBazaarT1 :: forall (f :: Type -> Type). Apply f => p a (f b) -> f t
  }
- type BazaarT1' (p :: Type -> Type -> Type) (g :: Type -> Type) a = BazaarT1 p g a a

# Documentation

class Profunctor p => Bizarre (p :: Type -> Type -> Type) (w :: Type -> Type -> Type -> Type) | w -> p where #

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 #

#### Instances

Instances details

Profunctor p => Bizarre p (Bazaar p) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods bazaar :: Applicative f => p a (f b) -> Bazaar p a b t -> f t #
Profunctor p => Bizarre p (BazaarT p g) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods bazaar :: Applicative f => p a (f b) -> BazaarT p g a b t -> f t #
Corepresentable p => Bizarre p (TakingWhile p g) # |
Instance details Defined in Control.Lens.Internal.Magma Methods bazaar :: Applicative f => p a (f b) -> TakingWhile p g a b t -> f t #
Bizarre (Indexed Int) Mafic # |
Instance details Defined in Control.Lens.Internal.Magma Methods bazaar :: Applicative f => Indexed Int a (f b) -> Mafic a b t -> f t #
Bizarre (Indexed i) (Molten i) # |
Instance details Defined in Control.Lens.Internal.Magma Methods bazaar :: Applicative f => Indexed i a (f b) -> Molten i a b t -> f t #

newtype Bazaar (p :: Type -> Type -> Type) a b t #

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` `a`s and a function from `N` `b`s 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 :: Type -> Type). Applicative f => p a (f b) -> f t

#### Instances

Instances details

Profunctor p => Bizarre p (Bazaar p) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods bazaar :: Applicative f => p a (f b) -> Bazaar p a b t -> f t #
Corepresentable p => Sellable p (Bazaar p) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods sell :: p a (Bazaar p a b b) #
Conjoined p => IndexedComonad (Bazaar p) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods iextract :: Bazaar p a a t -> t # iduplicate :: Bazaar p a c t -> Bazaar p a b (Bazaar p b c t) # iextend :: (Bazaar p b c t -> r) -> Bazaar p a c t -> Bazaar p a b r #
IndexedFunctor (Bazaar p) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods ifmap :: (s -> t) -> Bazaar p a b s -> Bazaar p a b t #
(a ~ b, Conjoined p) => Comonad (Bazaar p a b) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods extract :: Bazaar p a b a0 -> a0 # duplicate :: Bazaar p a b a0 -> Bazaar p a b (Bazaar p a b a0) # extend :: (Bazaar p a b a0 -> b0) -> Bazaar p a b a0 -> Bazaar p a b b0 #
(a ~ b, Conjoined p) => ComonadApply (Bazaar p a b) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods (<@>) :: Bazaar p a b (a0 -> b0) -> Bazaar p a b a0 -> Bazaar p a b b0 # (@>) :: Bazaar p a b a0 -> Bazaar p a b b0 -> Bazaar p a b b0 # (<@) :: Bazaar p a b a0 -> Bazaar p a b b0 -> Bazaar p a b a0 #
Applicative (Bazaar p a b) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods pure :: a0 -> Bazaar p a b a0 # (<*>) :: Bazaar p a b (a0 -> b0) -> Bazaar p a b a0 -> Bazaar p a b b0 # liftA2 :: (a0 -> b0 -> c) -> Bazaar p a b a0 -> Bazaar p a b b0 -> Bazaar p a b c # (*>) :: Bazaar p a b a0 -> Bazaar p a b b0 -> Bazaar p a b b0 # (<*) :: Bazaar p a b a0 -> Bazaar p a b b0 -> Bazaar p a b a0 #
Functor (Bazaar p a b) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods fmap :: (a0 -> b0) -> Bazaar p a b a0 -> Bazaar p a b b0 # (<$) :: a0 -> Bazaar p a b b0 -> Bazaar p a b a0 #
Apply (Bazaar p a b) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods (<.>) :: Bazaar p a b (a0 -> b0) -> Bazaar p a b a0 -> Bazaar p a b b0 # (.>) :: Bazaar p a b a0 -> Bazaar p a b b0 -> Bazaar p a b b0 # (<.) :: Bazaar p a b a0 -> Bazaar p a b b0 -> Bazaar p a b a0 # liftF2 :: (a0 -> b0 -> c) -> Bazaar p a b a0 -> Bazaar p a b b0 -> Bazaar p a b c #

type Bazaar' (p :: Type -> Type -> Type) a = Bazaar p a a #

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 :: Type -> Type -> Type) (g :: Type -> Type) a b t #

`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 :: Type -> Type). Applicative f => p a (f b) -> f t

#### Instances

Instances details

Profunctor p => Bizarre p (BazaarT p g) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods bazaar :: Applicative f => p a (f b) -> BazaarT p g a b t -> f t #
Corepresentable p => Sellable p (BazaarT p g) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods sell :: p a (BazaarT p g a b b) #
Conjoined p => IndexedComonad (BazaarT p g) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods iextract :: BazaarT p g a a t -> t # iduplicate :: BazaarT p g a c t -> BazaarT p g a b (BazaarT p g b c t) # iextend :: (BazaarT p g b c t -> r) -> BazaarT p g a c t -> BazaarT p g a b r #
IndexedFunctor (BazaarT p g) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods ifmap :: (s -> t) -> BazaarT p g a b s -> BazaarT p g a b t #
(Profunctor p, Contravariant g) => Contravariant (BazaarT p g a b) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods contramap :: (a' -> a0) -> BazaarT p g a b a0 -> BazaarT p g a b a' # (>$) :: b0 -> BazaarT p g a b b0 -> BazaarT p g a b a0 #
(a ~ b, Conjoined p) => Comonad (BazaarT p g a b) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods extract :: BazaarT p g a b a0 -> a0 # duplicate :: BazaarT p g a b a0 -> BazaarT p g a b (BazaarT p g a b a0) # extend :: (BazaarT p g a b a0 -> b0) -> BazaarT p g a b a0 -> BazaarT p g a b b0 #
(a ~ b, Conjoined p) => ComonadApply (BazaarT p g a b) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods (<@>) :: BazaarT p g a b (a0 -> b0) -> BazaarT p g a b a0 -> BazaarT p g a b b0 # (@>) :: BazaarT p g a b a0 -> BazaarT p g a b b0 -> BazaarT p g a b b0 # (<@) :: BazaarT p g a b a0 -> BazaarT p g a b b0 -> BazaarT p g a b a0 #
Applicative (BazaarT p g a b) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods pure :: a0 -> BazaarT p g a b a0 # (<*>) :: BazaarT p g a b (a0 -> b0) -> BazaarT p g a b a0 -> BazaarT p g a b b0 # liftA2 :: (a0 -> b0 -> c) -> BazaarT p g a b a0 -> BazaarT p g a b b0 -> BazaarT p g a b c # (*>) :: BazaarT p g a b a0 -> BazaarT p g a b b0 -> BazaarT p g a b b0 # (<*) :: BazaarT p g a b a0 -> BazaarT p g a b b0 -> BazaarT p g a b a0 #
Functor (BazaarT p g a b) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods fmap :: (a0 -> b0) -> BazaarT p g a b a0 -> BazaarT p g a b b0 # (<$) :: a0 -> BazaarT p g a b b0 -> BazaarT p g a b a0 #
Apply (BazaarT p g a b) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods (<.>) :: BazaarT p g a b (a0 -> b0) -> BazaarT p g a b a0 -> BazaarT p g a b b0 # (.>) :: BazaarT p g a b a0 -> BazaarT p g a b b0 -> BazaarT p g a b b0 # (<.) :: BazaarT p g a b a0 -> BazaarT p g a b b0 -> BazaarT p g a b a0 # liftF2 :: (a0 -> b0 -> c) -> BazaarT p g a b a0 -> BazaarT p g a b b0 -> BazaarT p g a b c #
Contravariant g => Monoid (BazaarT p g a b t) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods mempty :: BazaarT p g a b t # mappend :: BazaarT p g a b t -> BazaarT p g a b t -> BazaarT p g a b t # mconcat :: [BazaarT p g a b t] -> BazaarT p g a b t #
Contravariant g => Semigroup (BazaarT p g a b t) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods (<>) :: BazaarT p g a b t -> BazaarT p g a b t -> BazaarT p g a b t # sconcat :: NonEmpty (BazaarT p g a b t) -> BazaarT p g a b t # stimes :: Integral b0 => b0 -> BazaarT p g a b t -> BazaarT p g a b t #

type BazaarT' (p :: Type -> Type -> Type) (g :: Type -> Type) a = BazaarT p g a a #

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 :: Type -> Type -> Type) (w :: Type -> Type -> Type -> Type) | w -> p where #

Methods

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

#### Instances

Instances details

Profunctor p => Bizarre1 p (Bazaar1 p) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods bazaar1 :: Apply f => p a (f b) -> Bazaar1 p a b t -> f t #
Profunctor p => Bizarre1 p (BazaarT1 p g) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods bazaar1 :: Apply f => p a (f b) -> BazaarT1 p g a b t -> f t #

newtype Bazaar1 (p :: Type -> Type -> Type) a b t #

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` `a`s and a function from `N` `b`s 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 :: Type -> Type). Apply f => p a (f b) -> f t

#### Instances

Instances details

Profunctor p => Bizarre1 p (Bazaar1 p) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods bazaar1 :: Apply f => p a (f b) -> Bazaar1 p a b t -> f t #
Corepresentable p => Sellable p (Bazaar1 p) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods sell :: p a (Bazaar1 p a b b) #
Conjoined p => IndexedComonad (Bazaar1 p) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods iextract :: Bazaar1 p a a t -> t # iduplicate :: Bazaar1 p a c t -> Bazaar1 p a b (Bazaar1 p b c t) # iextend :: (Bazaar1 p b c t -> r) -> Bazaar1 p a c t -> Bazaar1 p a b r #
IndexedFunctor (Bazaar1 p) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods ifmap :: (s -> t) -> Bazaar1 p a b s -> Bazaar1 p a b t #
(a ~ b, Conjoined p) => Comonad (Bazaar1 p a b) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods extract :: Bazaar1 p a b a0 -> a0 # duplicate :: Bazaar1 p a b a0 -> Bazaar1 p a b (Bazaar1 p a b a0) # extend :: (Bazaar1 p a b a0 -> b0) -> Bazaar1 p a b a0 -> Bazaar1 p a b b0 #
(a ~ b, Conjoined p) => ComonadApply (Bazaar1 p a b) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods (<@>) :: Bazaar1 p a b (a0 -> b0) -> Bazaar1 p a b a0 -> Bazaar1 p a b b0 # (@>) :: Bazaar1 p a b a0 -> Bazaar1 p a b b0 -> Bazaar1 p a b b0 # (<@) :: Bazaar1 p a b a0 -> Bazaar1 p a b b0 -> Bazaar1 p a b a0 #
Functor (Bazaar1 p a b) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods fmap :: (a0 -> b0) -> Bazaar1 p a b a0 -> Bazaar1 p a b b0 # (<$) :: a0 -> Bazaar1 p a b b0 -> Bazaar1 p a b a0 #
Apply (Bazaar1 p a b) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods (<.>) :: Bazaar1 p a b (a0 -> b0) -> Bazaar1 p a b a0 -> Bazaar1 p a b b0 # (.>) :: Bazaar1 p a b a0 -> Bazaar1 p a b b0 -> Bazaar1 p a b b0 # (<.) :: Bazaar1 p a b a0 -> Bazaar1 p a b b0 -> Bazaar1 p a b a0 # liftF2 :: (a0 -> b0 -> c) -> Bazaar1 p a b a0 -> Bazaar1 p a b b0 -> Bazaar1 p a b c #

type Bazaar1' (p :: Type -> Type -> Type) a = Bazaar1 p a a #

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 :: Type -> Type -> Type) (g :: Type -> Type) a b t #

`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 :: Type -> Type). Apply f => p a (f b) -> f t

#### Instances

Instances details

Profunctor p => Bizarre1 p (BazaarT1 p g) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods bazaar1 :: Apply f => p a (f b) -> BazaarT1 p g a b t -> f t #
Corepresentable p => Sellable p (BazaarT1 p g) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods sell :: p a (BazaarT1 p g a b b) #
Conjoined p => IndexedComonad (BazaarT1 p g) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods iextract :: BazaarT1 p g a a t -> t # iduplicate :: BazaarT1 p g a c t -> BazaarT1 p g a b (BazaarT1 p g b c t) # iextend :: (BazaarT1 p g b c t -> r) -> BazaarT1 p g a c t -> BazaarT1 p g a b r #
IndexedFunctor (BazaarT1 p g) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods ifmap :: (s -> t) -> BazaarT1 p g a b s -> BazaarT1 p g a b t #
(Profunctor p, Contravariant g) => Contravariant (BazaarT1 p g a b) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods contramap :: (a' -> a0) -> BazaarT1 p g a b a0 -> BazaarT1 p g a b a' # (>$) :: b0 -> BazaarT1 p g a b b0 -> BazaarT1 p g a b a0 #
(a ~ b, Conjoined p) => Comonad (BazaarT1 p g a b) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods extract :: BazaarT1 p g a b a0 -> a0 # duplicate :: BazaarT1 p g a b a0 -> BazaarT1 p g a b (BazaarT1 p g a b a0) # extend :: (BazaarT1 p g a b a0 -> b0) -> BazaarT1 p g a b a0 -> BazaarT1 p g a b b0 #
(a ~ b, Conjoined p) => ComonadApply (BazaarT1 p g a b) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods (<@>) :: BazaarT1 p g a b (a0 -> b0) -> BazaarT1 p g a b a0 -> BazaarT1 p g a b b0 # (@>) :: BazaarT1 p g a b a0 -> BazaarT1 p g a b b0 -> BazaarT1 p g a b b0 # (<@) :: BazaarT1 p g a b a0 -> BazaarT1 p g a b b0 -> BazaarT1 p g a b a0 #
Functor (BazaarT1 p g a b) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods fmap :: (a0 -> b0) -> BazaarT1 p g a b a0 -> BazaarT1 p g a b b0 # (<$) :: a0 -> BazaarT1 p g a b b0 -> BazaarT1 p g a b a0 #
Apply (BazaarT1 p g a b) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods (<.>) :: BazaarT1 p g a b (a0 -> b0) -> BazaarT1 p g a b a0 -> BazaarT1 p g a b b0 # (.>) :: BazaarT1 p g a b a0 -> BazaarT1 p g a b b0 -> BazaarT1 p g a b b0 # (<.) :: BazaarT1 p g a b a0 -> BazaarT1 p g a b b0 -> BazaarT1 p g a b a0 # liftF2 :: (a0 -> b0 -> c) -> BazaarT1 p g a b a0 -> BazaarT1 p g a b b0 -> BazaarT1 p g a b c #
Contravariant g => Semigroup (BazaarT1 p g a b t) # |
Instance details Defined in Control.Lens.Internal.Bazaar Methods (<>) :: BazaarT1 p g a b t -> BazaarT1 p g a b t -> BazaarT1 p g a b t # sconcat :: NonEmpty (BazaarT1 p g a b t) -> BazaarT1 p g a b t # stimes :: Integral b0 => b0 -> BazaarT1 p g a b t -> BazaarT1 p g a b t #

type BazaarT1' (p :: Type -> Type -> Type) (g :: Type -> Type) a = BazaarT1 p g a a #

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