lens-4.15.4: Lenses, Folds and Traversals

Copyright(C) 2012-16 Edward Kmett
LicenseBSD-style (see the file LICENSE)
MaintainerEdward Kmett <ekmett@gmail.com>
Stabilityprovisional
PortabilityRank2Types
Safe HaskellSafe
LanguageHaskell98

Control.Lens.Reified

Description

 
Synopsis

Documentation

>>> import Control.Lens

newtype ReifiedLens s t a b Source #

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

Constructors

Lens 

Fields

newtype ReifiedIndexedLens i s t a b Source #

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

Constructors

IndexedLens 

Fields

newtype ReifiedIndexedTraversal i s t a b Source #

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

Constructors

IndexedTraversal 

newtype ReifiedTraversal s t a b Source #

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

Constructors

Traversal 

Fields

newtype ReifiedGetter s a Source #

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

Instances
Arrow ReifiedGetter Source # 
Instance details

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

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

Methods

app :: ReifiedGetter (ReifiedGetter b c, b) c #

ArrowLoop ReifiedGetter Source # 
Instance details

Methods

loop :: ReifiedGetter (b, d) (c, d) -> ReifiedGetter b c #

Representable ReifiedGetter Source # 
Instance details

Associated Types

type Rep (ReifiedGetter :: * -> * -> *) :: * -> * #

Methods

tabulate :: (d -> Rep ReifiedGetter c) -> ReifiedGetter d c #

Corepresentable ReifiedGetter Source # 
Instance details

Associated Types

type Corep (ReifiedGetter :: * -> * -> *) :: * -> * #

Methods

cotabulate :: (Corep ReifiedGetter d -> c) -> ReifiedGetter d c #

Choice ReifiedGetter Source # 
Instance details

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

Methods

closed :: ReifiedGetter a b -> ReifiedGetter (x -> a) (x -> b) #

Strong ReifiedGetter Source # 
Instance details

Methods

first' :: ReifiedGetter a b -> ReifiedGetter (a, c) (b, c) #

second' :: ReifiedGetter a b -> ReifiedGetter (c, a) (c, b) #

Costrong ReifiedGetter Source # 
Instance details

Methods

unfirst :: ReifiedGetter (a, d) (b, d) -> ReifiedGetter a b #

unsecond :: ReifiedGetter (d, a) (d, b) -> ReifiedGetter a b #

Profunctor ReifiedGetter Source # 
Instance details

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

Methods

distrib :: Functor f => ReifiedGetter a b -> ReifiedGetter (f a) (f b) Source #

conjoined :: (((* -> * -> *) ~ ReifiedGetter) (LiftedRep -> LiftedRep) -> q (a -> b) r) -> q (ReifiedGetter a b) r -> q (ReifiedGetter a b) r Source #

Sieve ReifiedGetter Identity Source # 
Instance details

Methods

sieve :: ReifiedGetter a b -> a -> Identity b #

Cosieve ReifiedGetter Identity Source # 
Instance details

Methods

cosieve :: ReifiedGetter a b -> Identity a -> b #

MonadReader s (ReifiedGetter s) Source # 
Instance details

Methods

ask :: ReifiedGetter s s #

local :: (s -> s) -> ReifiedGetter s a -> ReifiedGetter s a #

reader :: (s -> a) -> ReifiedGetter s a #

Monad (ReifiedGetter s) Source # 
Instance details

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

Methods

fmap :: (a -> b) -> ReifiedGetter s a -> ReifiedGetter s b #

(<$) :: a -> ReifiedGetter s b -> ReifiedGetter s a #

Applicative (ReifiedGetter s) Source # 
Instance details

Methods

pure :: a -> ReifiedGetter s a #

(<*>) :: ReifiedGetter s (a -> b) -> ReifiedGetter s a -> ReifiedGetter s b #

liftA2 :: (a -> b -> c) -> ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s c #

(*>) :: ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s b #

(<*) :: ReifiedGetter s a -> ReifiedGetter s b -> ReifiedGetter s a #

Distributive (ReifiedGetter s) Source # 
Instance details

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) Source # 
Instance details
Monoid s => ComonadApply (ReifiedGetter s) Source # 
Instance details

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

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

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) Source # 
Instance details
Category * ReifiedGetter Source # 
Instance details

Methods

id :: cat a a #

(.) :: cat b c -> cat a b -> cat a c #

type Rep ReifiedGetter Source # 
Instance details
type Corep ReifiedGetter Source # 
Instance details

newtype ReifiedIndexedGetter i s a Source #

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

Constructors

IndexedGetter 
Instances
Representable (ReifiedIndexedGetter i) Source # 
Instance details

Associated Types

type Rep (ReifiedIndexedGetter i :: * -> * -> *) :: * -> * #

Methods

tabulate :: (d -> Rep (ReifiedIndexedGetter i) c) -> ReifiedIndexedGetter i d c #

Strong (ReifiedIndexedGetter i) Source # 
Instance details

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

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

Methods

sieve :: ReifiedIndexedGetter i a b -> a -> (i, b) #

Functor (ReifiedIndexedGetter i s) Source # 
Instance details

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) Source # 
Instance details
type Rep (ReifiedIndexedGetter i) Source # 
Instance details

newtype ReifiedFold s a Source #

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

Instances
Arrow ReifiedFold Source # 
Instance details

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

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

Methods

app :: ReifiedFold (ReifiedFold b c, b) c #

Representable ReifiedFold Source # 
Instance details

Associated Types

type Rep (ReifiedFold :: * -> * -> *) :: * -> * #

Methods

tabulate :: (d -> Rep ReifiedFold c) -> ReifiedFold d c #

Choice ReifiedFold Source # 
Instance details

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

Methods

first' :: ReifiedFold a b -> ReifiedFold (a, c) (b, c) #

second' :: ReifiedFold a b -> ReifiedFold (c, a) (c, b) #

Profunctor ReifiedFold Source # 
Instance details

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 [] Source # 
Instance details

Methods

sieve :: ReifiedFold a b -> a -> [b] #

MonadReader s (ReifiedFold s) Source # 
Instance details

Methods

ask :: ReifiedFold s s #

local :: (s -> s) -> ReifiedFold s a -> ReifiedFold s a #

reader :: (s -> a) -> ReifiedFold s a #

Monad (ReifiedFold s) Source # 
Instance details

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

Methods

fmap :: (a -> b) -> ReifiedFold s a -> ReifiedFold s b #

(<$) :: a -> ReifiedFold s b -> ReifiedFold s a #

Applicative (ReifiedFold s) Source # 
Instance details

Methods

pure :: a -> ReifiedFold s a #

(<*>) :: ReifiedFold s (a -> b) -> ReifiedFold s a -> ReifiedFold s b #

liftA2 :: (a -> b -> c) -> ReifiedFold s a -> ReifiedFold s b -> ReifiedFold s c #

(*>) :: ReifiedFold s a -> ReifiedFold s b -> ReifiedFold s b #

(<*) :: ReifiedFold s a -> ReifiedFold s b -> ReifiedFold s a #

Alternative (ReifiedFold s) Source # 
Instance details

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

Methods

mzero :: ReifiedFold s a #

mplus :: ReifiedFold s a -> ReifiedFold s a -> ReifiedFold s a #

Plus (ReifiedFold s) Source # 
Instance details

Methods

zero :: ReifiedFold s a #

Alt (ReifiedFold s) Source # 
Instance details
Apply (ReifiedFold s) Source # 
Instance details

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

Methods

(>>-) :: ReifiedFold s a -> (a -> ReifiedFold s b) -> ReifiedFold s b #

join :: ReifiedFold s (ReifiedFold s a) -> ReifiedFold s a #

Category * ReifiedFold Source # 
Instance details

Methods

id :: cat a a #

(.) :: cat b c -> cat a b -> cat a c #

Semigroup (ReifiedFold s a) Source # 
Instance details

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

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 Source # 
Instance details
type Rep ReifiedFold = []

newtype ReifiedIndexedFold i s a Source #

Constructors

IndexedFold 

Fields

Instances
Representable (ReifiedIndexedFold i) Source # 
Instance details

Associated Types

type Rep (ReifiedIndexedFold i :: * -> * -> *) :: * -> * #

Methods

tabulate :: (d -> Rep (ReifiedIndexedFold i) c) -> ReifiedIndexedFold i d c #

Strong (ReifiedIndexedFold i) Source # 
Instance details

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

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

Methods

sieve :: ReifiedIndexedFold i a b -> a -> Compose * * [] ((,) i) b #

Functor (ReifiedIndexedFold i s) Source # 
Instance details

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

Methods

zero :: ReifiedIndexedFold i s a #

Alt (ReifiedIndexedFold i s) Source # 
Instance details
Semigroup (ReifiedIndexedFold i s a) Source # 
Instance details
Monoid (ReifiedIndexedFold i s a) Source # 
Instance details
type Rep (ReifiedIndexedFold i) Source # 
Instance details
type Rep (ReifiedIndexedFold i) = Compose * * [] ((,) i)

newtype ReifiedSetter s t a b Source #

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

Constructors

Setter 

Fields

newtype ReifiedIndexedSetter i s t a b Source #

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

Constructors

IndexedSetter 

Fields

newtype ReifiedIso s t a b Source #

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

Constructors

Iso 

Fields

newtype ReifiedPrism s t a b Source #

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

Constructors

Prism 

Fields