Control.Lens.Reified

lens-4.15.1: Lenses, Folds and Traversals

Copyright | (C) 2012-16 Edward Kmett
License | BSD-style (see the file LICENSE)
Maintainer | Edward Kmett <ekmett@gmail.com>
Stability | provisional
Portability | Rank2Types
Safe Haskell | None
Language | Haskell98

Control.Lens.Reified

Description

Synopsis

- newtype ReifiedLens s t a b = Lens {
  - runLens :: Lens s t a b
  }
- type ReifiedLens' s a = ReifiedLens s s a a
- newtype ReifiedIndexedLens i s t a b = IndexedLens {
  - runIndexedLens :: IndexedLens i s t a b
  }
- type ReifiedIndexedLens' i s a = ReifiedIndexedLens i s s a a
- newtype ReifiedIndexedTraversal i s t a b = IndexedTraversal {
  - runIndexedTraversal :: IndexedTraversal i s t a b
  }
- type ReifiedIndexedTraversal' i s a = ReifiedIndexedTraversal i s s a a
- newtype ReifiedTraversal s t a b = Traversal {
  - runTraversal :: Traversal s t a b
  }
- type ReifiedTraversal' s a = ReifiedTraversal s s a a
- newtype ReifiedGetter s a = Getter {
  - runGetter :: Getter s a
  }
- newtype ReifiedIndexedGetter i s a = IndexedGetter {
  - runIndexedGetter :: IndexedGetter i s a
  }
- newtype ReifiedFold s a = Fold {
  - runFold :: Fold s a
  }
- newtype ReifiedIndexedFold i s a = IndexedFold {
  - runIndexedFold :: IndexedFold i s a
  }
- newtype ReifiedSetter s t a b = Setter {
  - runSetter :: Setter s t a b
  }
- type ReifiedSetter' s a = ReifiedSetter s s a a
- newtype ReifiedIndexedSetter i s t a b = IndexedSetter {
  - runIndexedSetter :: IndexedSetter i s t a b
  }
- type ReifiedIndexedSetter' i s a = ReifiedIndexedSetter i s s a a
- newtype ReifiedIso s t a b = Iso {
  - runIso :: Iso s t a b
  }
- type ReifiedIso' s a = ReifiedIso s s a a
- newtype ReifiedPrism s t a b = Prism {
  - runPrism :: Prism s t a b
  }
- type ReifiedPrism' s a = ReifiedPrism s s a a

# Documentation

    >>> import Control.Lens

newtype ReifiedLens s t a b #

Reify a `Lens` so it can be stored safely in a container.

Constructors

Lens |
Fields runLens :: Lens s t a b

type ReifiedLens' s a = ReifiedLens s s a a #

    type ReifiedLens' = Simple ReifiedLens

newtype ReifiedIndexedLens i s t a b #

Reify an `IndexedLens` so it can be stored safely in a container.

Constructors

IndexedLens |
Fields runIndexedLens :: IndexedLens i s t a b

type ReifiedIndexedLens' i s a = ReifiedIndexedLens i s s a a #

    type ReifiedIndexedLens' i = Simple (ReifiedIndexedLens i)

newtype ReifiedIndexedTraversal i s t a b #

Reify an `IndexedTraversal` so it can be stored safely in a container.

Constructors

IndexedTraversal |
Fields runIndexedTraversal :: IndexedTraversal i s t a b

type ReifiedIndexedTraversal' i s a = ReifiedIndexedTraversal i s s a a #

    type ReifiedIndexedTraversal' i = Simple (ReifiedIndexedTraversal i)

newtype ReifiedTraversal s t a b #

A form of `Traversal` that can be stored monomorphically in a container.

Constructors

Traversal |
Fields runTraversal :: Traversal s t a b

type ReifiedTraversal' s a = ReifiedTraversal s s a a #

    type ReifiedTraversal' = Simple ReifiedTraversal

newtype ReifiedGetter s a #

Reify a `Getter` so it can be stored safely in a container.

This can also be useful when combining getters in novel ways, as `ReifiedGetter` is isomorphic to '(->)' and provides similar instances.

    >>> ("hello","world","!!!")^.runGetter ((,) <$> Getter _2 <*> Getter (_1.to length))
    ("world",5)

Constructors

Getter |
Fields runGetter :: Getter s a

Instances

Arrow ReifiedGetter # |
Methods arr :: (b -> c) -> ReifiedGetter b c # first :: ReifiedGetter b c -> ReifiedGetter (b, d) (c, d) # second :: ReifiedGetter b c -> ReifiedGetter (d, b) (d, c) # (***) :: ReifiedGetter b c -> ReifiedGetter b' c' -> ReifiedGetter (b, b') (c, c') # (&&&) :: ReifiedGetter b c -> ReifiedGetter b c' -> ReifiedGetter b (c, c') #
ArrowChoice ReifiedGetter # |
Methods left :: ReifiedGetter b c -> ReifiedGetter (Either b d) (Either c d) # right :: ReifiedGetter b c -> ReifiedGetter (Either d b) (Either d c) # (+++) :: ReifiedGetter b c -> ReifiedGetter b' c' -> ReifiedGetter (Either b b') (Either c c') # (|||) :: ReifiedGetter b d -> ReifiedGetter c d -> ReifiedGetter (Either b c) d #
ArrowApply ReifiedGetter # |
Methods app :: ReifiedGetter (ReifiedGetter b c, b) c #
ArrowLoop ReifiedGetter # |
Methods loop :: ReifiedGetter (b, d) (c, d) -> ReifiedGetter b c #
Representable ReifiedGetter # |
Associated Types type Rep (ReifiedGetter :: * -> * -> *) :: * -> * # Methods tabulate :: (d -> Rep ReifiedGetter c) -> ReifiedGetter d c #
Corepresentable ReifiedGetter # |
Associated Types type Corep (ReifiedGetter :: * -> * -> *) :: * -> * # Methods cotabulate :: (Corep ReifiedGetter d -> c) -> ReifiedGetter d c #
Choice ReifiedGetter # |
Methods left' :: ReifiedGetter a b -> ReifiedGetter (Either a c) (Either b c) # right' :: ReifiedGetter a b -> ReifiedGetter (Either c a) (Either c b) #
Closed ReifiedGetter # |
Methods closed :: ReifiedGetter a b -> ReifiedGetter (x -> a) (x -> b) #
Strong ReifiedGetter # |
Methods first' :: ReifiedGetter a b -> ReifiedGetter (a, c) (b, c) # second' :: ReifiedGetter a b -> ReifiedGetter (c, a) (c, b) #
Costrong ReifiedGetter # |
Methods unfirst :: ReifiedGetter (a, d) (b, d) -> ReifiedGetter a b # unsecond :: ReifiedGetter (d, a) (d, b) -> ReifiedGetter a b #
Profunctor ReifiedGetter # |
Methods dimap :: (a -> b) -> (c -> d) -> ReifiedGetter b c -> ReifiedGetter a d # lmap :: (a -> b) -> ReifiedGetter b c -> ReifiedGetter a c # rmap :: (b -> c) -> ReifiedGetter a b -> ReifiedGetter a c # (#.) :: Coercible * c b => (b -> c) -> ReifiedGetter a b -> ReifiedGetter a c # (.#) :: Coercible * b a => ReifiedGetter b c -> (a -> b) -> ReifiedGetter a c #
Conjoined ReifiedGetter # |
Methods distrib :: Functor f => ReifiedGetter a b -> ReifiedGetter (f a) (f b) # conjoined :: (((* -> * -> *) ~ ReifiedGetter) (->) -> q (a -> b) r) -> q (ReifiedGetter a b) r -> q (ReifiedGetter a b) r #
Sieve ReifiedGetter Identity # |
Methods sieve :: ReifiedGetter a b -> a -> Identity b #
Cosieve ReifiedGetter Identity # |
Methods cosieve :: ReifiedGetter a b -> Identity a -> b #
MonadReader s (ReifiedGetter s) # |
Methods ask :: ReifiedGetter s s # local :: (s -> s) -> ReifiedGetter s a -> ReifiedGetter s a # reader :: (s -> a) -> ReifiedGetter s a #
Monad (ReifiedGetter s) # |
Methods (>>=) :: ReifiedGetter s a -> (a -> ReifiedGetter s b) -> ReifiedGetter s b # (>>) :: ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s b # return :: a -> ReifiedGetter s a # fail :: String -> ReifiedGetter s a #
Functor (ReifiedGetter s) # |
Methods fmap :: (a -> b) -> ReifiedGetter s a -> ReifiedGetter s b # (<$) :: a -> ReifiedGetter s b -> ReifiedGetter s a #
Applicative (ReifiedGetter s) # |
Methods pure :: a -> ReifiedGetter s a # (<*>) :: ReifiedGetter s (a -> b) -> ReifiedGetter s a -> ReifiedGetter s b # (*>) :: ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s b # (<*) :: ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s a #
Distributive (ReifiedGetter s) # |
Methods distribute :: Functor f => f (ReifiedGetter s a) -> ReifiedGetter s (f a) # collect :: Functor f => (a -> ReifiedGetter s b) -> f a -> ReifiedGetter s (f b) # distributeM :: Monad m => m (ReifiedGetter s a) -> ReifiedGetter s (m a) # collectM :: Monad m => (a -> ReifiedGetter s b) -> m a -> ReifiedGetter s (m b) #
Monoid s => Comonad (ReifiedGetter s) # |
Methods extract :: ReifiedGetter s a -> a # duplicate :: ReifiedGetter s a -> ReifiedGetter s (ReifiedGetter s a) # extend :: (ReifiedGetter s a -> b) -> ReifiedGetter s a -> ReifiedGetter s b #
Monoid s => ComonadApply (ReifiedGetter s) # |
Methods (<@>) :: ReifiedGetter s (a -> b) -> ReifiedGetter s a -> ReifiedGetter s b # (@>) :: ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s b # (<@) :: ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s a #
Apply (ReifiedGetter s) # |
Methods (<.>) :: ReifiedGetter s (a -> b) -> ReifiedGetter s a -> ReifiedGetter s b # (.>) :: ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s b # (<.) :: ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s a #
Bind (ReifiedGetter s) # |
Methods (>>-) :: ReifiedGetter s a -> (a -> ReifiedGetter s b) -> ReifiedGetter s b # join :: ReifiedGetter s (ReifiedGetter s a) -> ReifiedGetter s a #
Semigroup s => Extend (ReifiedGetter s) # |
Methods duplicated :: ReifiedGetter s a -> ReifiedGetter s (ReifiedGetter s a) # extended :: (ReifiedGetter s a -> b) -> ReifiedGetter s a -> ReifiedGetter s b #
Category * ReifiedGetter # |
Methods id :: cat a a # (.) :: cat b c -> cat a b -> cat a c #
type Rep ReifiedGetter # |
type Rep ReifiedGetter = Identity
type Corep ReifiedGetter # |
type Corep ReifiedGetter = Identity

newtype ReifiedIndexedGetter i s a #

Reify an `IndexedGetter` so it can be stored safely in a container.

Constructors

IndexedGetter |
Fields runIndexedGetter :: IndexedGetter i s a

Instances

Representable (ReifiedIndexedGetter i) # |
Associated Types type Rep (ReifiedIndexedGetter i :: * -> * -> *) :: * -> * # Methods tabulate :: (d -> Rep (ReifiedIndexedGetter i) c) -> ReifiedIndexedGetter i d c #
Strong (ReifiedIndexedGetter i) # |
Methods first' :: ReifiedIndexedGetter i a b -> ReifiedIndexedGetter i (a, c) (b, c) # second' :: ReifiedIndexedGetter i a b -> ReifiedIndexedGetter i (c, a) (c, b) #
Profunctor (ReifiedIndexedGetter i) # |
Methods dimap :: (a -> b) -> (c -> d) -> ReifiedIndexedGetter i b c -> ReifiedIndexedGetter i a d # lmap :: (a -> b) -> ReifiedIndexedGetter i b c -> ReifiedIndexedGetter i a c # rmap :: (b -> c) -> ReifiedIndexedGetter i a b -> ReifiedIndexedGetter i a c # (#.) :: Coercible * c b => (b -> c) -> ReifiedIndexedGetter i a b -> ReifiedIndexedGetter i a c # (.#) :: Coercible * b a => ReifiedIndexedGetter i b c -> (a -> b) -> ReifiedIndexedGetter i a c #
Sieve (ReifiedIndexedGetter i) ((,) i) # |
Methods sieve :: ReifiedIndexedGetter i a b -> a -> (i, b) #
Functor (ReifiedIndexedGetter i s) # |
Methods fmap :: (a -> b) -> ReifiedIndexedGetter i s a -> ReifiedIndexedGetter i s b # (<$) :: a -> ReifiedIndexedGetter i s b -> ReifiedIndexedGetter i s a #
Semigroup i => Apply (ReifiedIndexedGetter i s) # |
Methods (<.>) :: ReifiedIndexedGetter i s (a -> b) -> ReifiedIndexedGetter i s a -> ReifiedIndexedGetter i s b # (.>) :: ReifiedIndexedGetter i s a -> ReifiedIndexedGetter i s b -> ReifiedIndexedGetter i s b # (<.) :: ReifiedIndexedGetter i s a -> ReifiedIndexedGetter i s b -> ReifiedIndexedGetter i s a #
type Rep (ReifiedIndexedGetter i) # |
type Rep (ReifiedIndexedGetter i) = (,) i

newtype ReifiedFold s a #

Reify a `Fold` so it can be stored safely in a container.

This can also be useful for creatively combining folds as ``ReifiedFold` s` is isomorphic to `ReaderT s []` and provides similar instances.

    >>> ("hello","world")^..runFold ((,) <$> Fold _2 <*> Fold both)
    [("world","hello"),("world","world")]

Constructors

Fold |
Fields runFold :: Fold s a

Instances

Arrow ReifiedFold # |
Methods arr :: (b -> c) -> ReifiedFold b c # first :: ReifiedFold b c -> ReifiedFold (b, d) (c, d) # second :: ReifiedFold b c -> ReifiedFold (d, b) (d, c) # (***) :: ReifiedFold b c -> ReifiedFold b' c' -> ReifiedFold (b, b') (c, c') # (&&&) :: ReifiedFold b c -> ReifiedFold b c' -> ReifiedFold b (c, c') #
ArrowChoice ReifiedFold # |
Methods left :: ReifiedFold b c -> ReifiedFold (Either b d) (Either c d) # right :: ReifiedFold b c -> ReifiedFold (Either d b) (Either d c) # (+++) :: ReifiedFold b c -> ReifiedFold b' c' -> ReifiedFold (Either b b') (Either c c') # (|||) :: ReifiedFold b d -> ReifiedFold c d -> ReifiedFold (Either b c) d #
ArrowApply ReifiedFold # |
Methods app :: ReifiedFold (ReifiedFold b c, b) c #
Representable ReifiedFold # |
Associated Types type Rep (ReifiedFold :: * -> * -> *) :: * -> * # Methods tabulate :: (d -> Rep ReifiedFold c) -> ReifiedFold d c #
Choice ReifiedFold # |
Methods left' :: ReifiedFold a b -> ReifiedFold (Either a c) (Either b c) # right' :: ReifiedFold a b -> ReifiedFold (Either c a) (Either c b) #
Strong ReifiedFold # |
Methods first' :: ReifiedFold a b -> ReifiedFold (a, c) (b, c) # second' :: ReifiedFold a b -> ReifiedFold (c, a) (c, b) #
Profunctor ReifiedFold # |
Methods dimap :: (a -> b) -> (c -> d) -> ReifiedFold b c -> ReifiedFold a d # lmap :: (a -> b) -> ReifiedFold b c -> ReifiedFold a c # rmap :: (b -> c) -> ReifiedFold a b -> ReifiedFold a c # (#.) :: Coercible * c b => (b -> c) -> ReifiedFold a b -> ReifiedFold a c # (.#) :: Coercible * b a => ReifiedFold b c -> (a -> b) -> ReifiedFold a c #
Sieve ReifiedFold [] # |
Methods sieve :: ReifiedFold a b -> a -> [b] #
MonadReader s (ReifiedFold s) # |
Methods ask :: ReifiedFold s s # local :: (s -> s) -> ReifiedFold s a -> ReifiedFold s a # reader :: (s -> a) -> ReifiedFold s a #
Monad (ReifiedFold s) # |
Methods (>>=) :: ReifiedFold s a -> (a -> ReifiedFold s b) -> ReifiedFold s b # (>>) :: ReifiedFold s a -> ReifiedFold s b -> ReifiedFold s b # return :: a -> ReifiedFold s a # fail :: String -> ReifiedFold s a #
Functor (ReifiedFold s) # |
Methods fmap :: (a -> b) -> ReifiedFold s a -> ReifiedFold s b # (<$) :: a -> ReifiedFold s b -> ReifiedFold s a #
Applicative (ReifiedFold s) # |
Methods pure :: a -> ReifiedFold s a # (<*>) :: ReifiedFold s (a -> b) -> ReifiedFold s a -> ReifiedFold s b # (*>) :: ReifiedFold s a -> ReifiedFold s b -> ReifiedFold s b # (<*) :: ReifiedFold s a -> ReifiedFold s b -> ReifiedFold s a #
Alternative (ReifiedFold s) # |
Methods empty :: ReifiedFold s a # (<|>) :: ReifiedFold s a -> ReifiedFold s a -> ReifiedFold s a # some :: ReifiedFold s a -> ReifiedFold s [a] # many :: ReifiedFold s a -> ReifiedFold s [a] #
MonadPlus (ReifiedFold s) # |
Methods mzero :: ReifiedFold s a # mplus :: ReifiedFold s a -> ReifiedFold s a -> ReifiedFold s a #
Plus (ReifiedFold s) # |
Methods zero :: ReifiedFold s a #
Alt (ReifiedFold s) # |
Methods (<!>) :: ReifiedFold s a -> ReifiedFold s a -> ReifiedFold s a # some :: Applicative (ReifiedFold s) => ReifiedFold s a -> ReifiedFold s [a] # many :: Applicative (ReifiedFold s) => ReifiedFold s a -> ReifiedFold s [a] #
Apply (ReifiedFold s) # |
Methods (<.>) :: ReifiedFold s (a -> b) -> ReifiedFold s a -> ReifiedFold s b # (.>) :: ReifiedFold s a -> ReifiedFold s b -> ReifiedFold s b # (<.) :: ReifiedFold s a -> ReifiedFold s b -> ReifiedFold s a #
Bind (ReifiedFold s) # |
Methods (>>-) :: ReifiedFold s a -> (a -> ReifiedFold s b) -> ReifiedFold s b # join :: ReifiedFold s (ReifiedFold s a) -> ReifiedFold s a #
Category * ReifiedFold # |
Methods id :: cat a a # (.) :: cat b c -> cat a b -> cat a c #
Semigroup (ReifiedFold s a) # |
Methods (<>) :: ReifiedFold s a -> ReifiedFold s a -> ReifiedFold s a # sconcat :: NonEmpty (ReifiedFold s a) -> ReifiedFold s a # stimes :: Integral b => b -> ReifiedFold s a -> ReifiedFold s a #
Monoid (ReifiedFold s a) # |
Methods mempty :: ReifiedFold s a # mappend :: ReifiedFold s a -> ReifiedFold s a -> ReifiedFold s a # mconcat :: [ReifiedFold s a] -> ReifiedFold s a #
type Rep ReifiedFold # |
type Rep ReifiedFold = []

newtype ReifiedIndexedFold i s a #

Constructors

IndexedFold |
Fields runIndexedFold :: IndexedFold i s a

Instances

Representable (ReifiedIndexedFold i) # |
Associated Types type Rep (ReifiedIndexedFold i :: * -> * -> *) :: * -> * # Methods tabulate :: (d -> Rep (ReifiedIndexedFold i) c) -> ReifiedIndexedFold i d c #
Strong (ReifiedIndexedFold i) # |
Methods first' :: ReifiedIndexedFold i a b -> ReifiedIndexedFold i (a, c) (b, c) # second' :: ReifiedIndexedFold i a b -> ReifiedIndexedFold i (c, a) (c, b) #
Profunctor (ReifiedIndexedFold i) # |
Methods dimap :: (a -> b) -> (c -> d) -> ReifiedIndexedFold i b c -> ReifiedIndexedFold i a d # lmap :: (a -> b) -> ReifiedIndexedFold i b c -> ReifiedIndexedFold i a c # rmap :: (b -> c) -> ReifiedIndexedFold i a b -> ReifiedIndexedFold i a c # (#.) :: Coercible * c b => (b -> c) -> ReifiedIndexedFold i a b -> ReifiedIndexedFold i a c # (.#) :: Coercible * b a => ReifiedIndexedFold i b c -> (a -> b) -> ReifiedIndexedFold i a c #
Sieve (ReifiedIndexedFold i) (Compose * * [] ((,) i)) # |
Methods sieve :: ReifiedIndexedFold i a b -> a -> Compose * * [] ((,) i) b #
Functor (ReifiedIndexedFold i s) # |
Methods fmap :: (a -> b) -> ReifiedIndexedFold i s a -> ReifiedIndexedFold i s b # (<$) :: a -> ReifiedIndexedFold i s b -> ReifiedIndexedFold i s a #
Plus (ReifiedIndexedFold i s) # |
Methods zero :: ReifiedIndexedFold i s a #
Alt (ReifiedIndexedFold i s) # |
Methods (<!>) :: ReifiedIndexedFold i s a -> ReifiedIndexedFold i s a -> ReifiedIndexedFold i s a # some :: Applicative (ReifiedIndexedFold i s) => ReifiedIndexedFold i s a -> ReifiedIndexedFold i s [a] # many :: Applicative (ReifiedIndexedFold i s) => ReifiedIndexedFold i s a -> ReifiedIndexedFold i s [a] #
Semigroup (ReifiedIndexedFold i s a) # |
Methods (<>) :: ReifiedIndexedFold i s a -> ReifiedIndexedFold i s a -> ReifiedIndexedFold i s a # sconcat :: NonEmpty (ReifiedIndexedFold i s a) -> ReifiedIndexedFold i s a # stimes :: Integral b => b -> ReifiedIndexedFold i s a -> ReifiedIndexedFold i s a #
Monoid (ReifiedIndexedFold i s a) # |
Methods mempty :: ReifiedIndexedFold i s a # mappend :: ReifiedIndexedFold i s a -> ReifiedIndexedFold i s a -> ReifiedIndexedFold i s a # mconcat :: [ReifiedIndexedFold i s a] -> ReifiedIndexedFold i s a #
type Rep (ReifiedIndexedFold i) # |
type Rep (ReifiedIndexedFold i) = Compose * * [] ((,) i)

newtype ReifiedSetter s t a b #

Reify a `Setter` so it can be stored safely in a container.

Constructors

Setter |
Fields runSetter :: Setter s t a b

type ReifiedSetter' s a = ReifiedSetter s s a a #

    type ReifiedSetter' = Simple ReifiedSetter

newtype ReifiedIndexedSetter i s t a b #

Reify an `IndexedSetter` so it can be stored safely in a container.

Constructors

IndexedSetter |
Fields runIndexedSetter :: IndexedSetter i s t a b

type ReifiedIndexedSetter' i s a = ReifiedIndexedSetter i s s a a #

    type ReifiedIndexedSetter' i = Simple (ReifiedIndexedSetter i)

newtype ReifiedIso s t a b #

Reify an `Iso` so it can be stored safely in a container.

Constructors

Iso |
Fields runIso :: Iso s t a b

type ReifiedIso' s a = ReifiedIso s s a a #

    type ReifiedIso' = Simple ReifiedIso

newtype ReifiedPrism s t a b #

Reify a `Prism` so it can be stored safely in a container.

Constructors

Prism |
Fields runPrism :: Prism s t a b

type ReifiedPrism' s a = ReifiedPrism s s a a #

    type ReifiedPrism' = Simple ReifiedPrism