lens-4.16: 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 # 

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 # 

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 # 

Methods

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

ArrowLoop ReifiedGetter Source # 

Methods

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

Representable ReifiedGetter Source # 

Associated Types

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

Methods

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

Corepresentable ReifiedGetter Source # 

Associated Types

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

Methods

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

Choice ReifiedGetter Source # 

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 # 

Methods

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

Strong ReifiedGetter Source # 

Methods

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

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

Costrong ReifiedGetter Source # 

Methods

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

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

Profunctor ReifiedGetter Source # 

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 # 

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 # 

Methods

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

Cosieve ReifiedGetter Identity Source # 

Methods

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

MonadReader s (ReifiedGetter s) Source # 

Methods

ask :: ReifiedGetter s s #

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

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

Monad (ReifiedGetter s) Source # 

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 # 

Methods

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

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

Applicative (ReifiedGetter s) Source # 

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 # 

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

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 # 

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 #

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

Bind (ReifiedGetter s) Source # 

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

Methods

id :: cat a a #

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

type Rep ReifiedGetter Source # 
type Corep ReifiedGetter Source # 

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 # 

Associated Types

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

Methods

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

Strong (ReifiedIndexedGetter i) Source # 

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 # 

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 # 

Methods

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

Functor (ReifiedIndexedGetter i s) Source # 

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

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 # 

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 # 

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 # 

Methods

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

Representable ReifiedFold Source # 

Associated Types

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

Methods

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

Choice ReifiedFold Source # 

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 # 

Methods

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

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

Profunctor ReifiedFold Source # 

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 # 

Methods

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

MonadReader s (ReifiedFold s) Source # 

Methods

ask :: ReifiedFold s s #

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

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

Monad (ReifiedFold s) Source # 

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 # 

Methods

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

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

Applicative (ReifiedFold s) Source # 

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 # 

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 # 

Methods

mzero :: ReifiedFold s a #

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

Plus (ReifiedFold s) Source # 

Methods

zero :: ReifiedFold s a #

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

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 #

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

Bind (ReifiedFold s) Source # 

Methods

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

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

Category * ReifiedFold Source # 

Methods

id :: cat a a #

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

Semigroup (ReifiedFold s a) Source # 

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 # 

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

newtype ReifiedIndexedFold i s a Source #

Constructors

IndexedFold 

Fields

Instances

Representable (ReifiedIndexedFold i) Source # 

Associated Types

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

Methods

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

Strong (ReifiedIndexedFold i) Source # 

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 # 

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 # 

Methods

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

Functor (ReifiedIndexedFold i s) Source # 

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 # 

Methods

zero :: ReifiedIndexedFold i s a #

Alt (ReifiedIndexedFold i s) Source # 
Semigroup (ReifiedIndexedFold i s a) Source # 
Monoid (ReifiedIndexedFold i s a) Source # 
type Rep (ReifiedIndexedFold i) Source # 
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