-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Haskell 98 Lens Families
--   
--   This package provides first class(†) functional references. In
--   addition to the usual operations of getting, setting and composition,
--   plus integration with the state monad, lens families provide some
--   unique features:
--   
--   <ul>
--   <li>Polymorphic updating</li>
--   <li>Traversals</li>
--   <li>Cast projection functions to read-only lenses</li>
--   <li>Cast "toList" functions to read-only traversals</li>
--   <li>Cast semantic editor combinators to modify-only traversals.</li>
--   </ul>
--   
--   (†) For optimal first-class support use the <tt>lens-family</tt>
--   package with rank 2 / rank N polymorphism. <a>Lens.Family.Clone</a>
--   allows for first-class support of lenses and traversals for those who
--   require Haskell 98.
@package lens-family-core
@version 1.2.3


-- | <i>Caution</i>: Improper use of this module can lead to unexpected
--   behaviour if the preconditions of the functions are not met.
module Lens.Family.Unchecked

-- | <pre>
--   lens :: (a -&gt; b) -&gt; (a -&gt; b' -&gt; a') -&gt; Lens a a' b b'
--   </pre>
--   
--   Build a lens from a <tt>getter</tt> and <tt>setter</tt> families.
--   
--   <i>Caution</i>: In order for the generated lens family to be
--   well-defined, you must ensure that the three lens laws hold:
--   
--   <ul>
--   <li><pre>getter (setter a b) === b</pre></li>
--   <li><pre>setter a (getter a) === a</pre></li>
--   <li><pre>setter (setter a b1) b2) === setter a b2</pre></li>
--   </ul>
lens :: Functor f => (a -> b) -> (a -> b' -> a') -> LensLike f a a' b b'

-- | <pre>
--   iso :: (a -&gt; b) -&gt; (b' -&gt; a') -&gt; Lens a a' b b'
--   </pre>
--   
--   Build a lens from isomorphism families.
--   
--   <i>Caution</i>: In order for the generated lens family to be
--   well-defined, you must ensure that the two isomorphism laws hold:
--   
--   <ul>
--   <li><pre>yin . yang === id</pre></li>
--   <li><pre>yang . yin === id</pre></li>
--   </ul>
iso :: Functor f => (a -> b) -> (b' -> a') -> LensLike f a a' b b'

-- | <a>setting</a> promotes a "semantic editor combinator" to a
--   modify-only lens. To demote a lens to a semantic edit combinator, use
--   the section <tt>(l %~)</tt> or <tt>over l</tt> from
--   <a>Lens.Family</a>.
--   
--   <pre>
--   &gt;&gt;&gt; setting map . fstL %~ length $ [("The",0),("quick",1),("brown",1),("fox",2)]
--   [(3,0),(5,1),(5,1),(3,2)]
--   </pre>
--   
--   <i>Caution</i>: In order for the generated setter family to be
--   well-defined, you must ensure that the two functors laws hold:
--   
--   <ul>
--   <li><pre>sec id === id</pre></li>
--   <li><pre>sec f . sec g === sec (f . g)</pre></li>
--   </ul>
setting :: Identical f => ((b -> b') -> a -> a') -> LensLike f a a' b b'
type LensLike f a a' b b' = (b -> f b') -> (a -> f a')
type LensLike' f a b = (b -> f b) -> (a -> f a)
class Applicative f => Identical f


-- | This is the main module for end-users of lens-families-core. If you
--   are not building your own lenses or traversals, but just using
--   functional references made by others, this is the only module you
--   need.
module Lens.Family

-- | <pre>
--   to :: (a -&gt; b) -&gt; Getter a a' b b'
--   </pre>
--   
--   <a>to</a> promotes a projection function to a read-only lens called a
--   getter. To demote a lens to a projection function, use the section
--   <tt>(^.l)</tt> or <tt>view l</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; (3 :+ 4, "example")^._1.to(abs)
--   5.0 :+ 0.0
--   </pre>
to :: Phantom f => (a -> b) -> LensLike f a a' b b'

-- | <pre>
--   view :: Getter a a' b b' -&gt; a -&gt; b
--   </pre>
--   
--   Demote a lens or getter to a projection function.
--   
--   <pre>
--   view :: Monoid b =&gt; Fold a a' b b' -&gt; a -&gt; b
--   </pre>
--   
--   Returns the monoidal summary of a traversal or a fold.
view :: FoldLike b a a' b b' -> a -> b

-- | <pre>
--   (^.) :: a -&gt; Getter a a' b b' -&gt; b
--   </pre>
--   
--   Access the value referenced by a getter or lens.
--   
--   <pre>
--   (^.) :: Monoid b =&gt; a -&gt; Fold a a' b b' -&gt; b
--   </pre>
--   
--   Access the monoidal summary referenced by a getter or lens.
(^.) :: a -> FoldLike b a a' b b' -> b
infixl 8 ^.

-- | <pre>
--   folding :: (a -&gt; [b]) -&gt; Fold a a' b b'
--   </pre>
--   
--   <a>folding</a> promotes a "toList" function to a read-only traversal
--   called a fold.
--   
--   To demote a traversal or fold to a "toList" function use the section
--   <tt>(^..l)</tt> or <tt>toListOf l</tt>.
folding :: (Foldable g, Phantom f, Applicative f) => (a -> g b) -> LensLike f a a' b b'

-- | <pre>
--   views :: Monoid r =&gt; Fold a a' b b' -&gt; (b -&gt; r) -&gt; a -&gt; r
--   </pre>
--   
--   Given a fold or traversal, return the <a>foldMap</a> of all the values
--   using the given function.
--   
--   <pre>
--   views :: Getter a a' b b' -&gt; (b -&gt; r) -&gt; a -&gt; r
--   </pre>
--   
--   <a>views</a> is not particularly useful for getters or lenses, but
--   given a getter or lens, it returns the referenced value passed through
--   the given function.
--   
--   <pre>
--   views l f a = f (view l a)
--   </pre>
views :: FoldLike r a a' b b' -> (b -> r) -> a -> r

-- | <pre>
--   (^..) :: a -&gt; Getter a a' b b' -&gt; [b]
--   </pre>
--   
--   Returns a list of all of the referenced values in order.
(^..) :: a -> FoldLike [b] a a' b b' -> [b]
infixl 8 ^..

-- | <pre>
--   (^?) :: a -&gt; Fold a a' b b' -&gt; Maybe b
--   </pre>
--   
--   Returns <a>Just</a> the first referenced value. Returns <a>Nothing</a>
--   if there are no referenced values.
(^?) :: a -> FoldLike (First b) a a' b b' -> Maybe b
infixl 8 ^?

-- | <pre>
--   toListOf :: Fold a a' b b' -&gt; a -&gt; [b]
--   </pre>
--   
--   Returns a list of all of the referenced values in order.
toListOf :: FoldLike [b] a a' b b' -> a -> [b]

-- | <pre>
--   allOf :: Fold a a' b b' -&gt; (b -&gt; Bool) -&gt; a -&gt; Bool
--   </pre>
--   
--   Returns true if all of the referenced values satisfy the given
--   predicate.
allOf :: FoldLike All a a' b b' -> (b -> Bool) -> a -> Bool

-- | <pre>
--   anyOf :: Fold a a' b b' -&gt; (b -&gt; Bool) -&gt; a -&gt; Bool
--   </pre>
--   
--   Returns true if any of the referenced values satisfy the given
--   predicate.
anyOf :: FoldLike Any a a' b b' -> (b -> Bool) -> a -> Bool

-- | <pre>
--   firstOf :: Fold a a' b b' -&gt; a -&gt; Maybe b
--   </pre>
--   
--   Returns <a>Just</a> the first referenced value. Returns <a>Nothing</a>
--   if there are no referenced values. See <a>^?</a> for an infix version
--   of <a>firstOf</a>
firstOf :: FoldLike (First b) a a' b b' -> a -> Maybe b

-- | <pre>
--   lastOf :: Fold a a' b b' -&gt; a -&gt; Maybe b
--   </pre>
--   
--   Returns <a>Just</a> the last referenced value. Returns <a>Nothing</a>
--   if there are no referenced values.
lastOf :: FoldLike (Last b) a a' b b' -> a -> Maybe b

-- | <pre>
--   sumOf :: Num b =&gt; Fold a a' b b' -&gt; a -&gt; b
--   </pre>
--   
--   Returns the sum of all the referenced values.
sumOf :: Num b => FoldLike (Sum b) a a' b b' -> a -> b

-- | <pre>
--   productOf :: Num b =&gt; Fold a a' b b' -&gt; a -&gt; b
--   </pre>
--   
--   Returns the product of all the referenced values.
productOf :: Num b => FoldLike (Product b) a a' b b' -> a -> b

-- | <pre>
--   lengthOf :: Num r =&gt; Fold a a' b b' -&gt; a -&gt; r
--   </pre>
--   
--   Counts the number of references in a traversal or fold for the input.
lengthOf :: Num r => FoldLike (Sum r) a a' b b' -> a -> r

-- | <pre>
--   nullOf :: Fold a a' b b' -&gt; a -&gt; Bool
--   </pre>
--   
--   Returns true if the number of references in the input is zero.
nullOf :: FoldLike All a a' b b' -> a -> Bool

-- | <pre>
--   backwards :: Traversal a a' b b' -&gt; Traversal a a' b b'
--   backwards :: Fold a a' b b' -&gt; Fold a a' b b'
--   </pre>
--   
--   Given a traversal or fold, reverse the order that elements are
--   traversed.
--   
--   <pre>
--   backwards :: Lens a a' b b' -&gt; Lens a a' b b'
--   backwards :: Getter a a' b b' -&gt; Getter a a' b b'
--   backwards :: Setter a a' b b' -&gt; Setter a a' b b'
--   </pre>
--   
--   No effect on lenses, getters or setters.
backwards :: LensLike (Backwards f) a a' b b' -> LensLike f a a' b b'

-- | Demote a setter to a semantic editor combinator.
over :: ASetter a a' b b' -> (b -> b') -> a -> a'

-- | Modify all referenced fields.
(%~) :: ASetter a a' b b' -> (b -> b') -> a -> a'
infixr 4 %~

-- | Set all referenced fields to the given value.
set :: ASetter a a' b b' -> b' -> a -> a'

-- | Set all referenced fields to the given value.
(.~) :: ASetter a a' b b' -> b' -> a -> a'
infixr 4 .~

-- | A flipped version of <tt>($)</tt>.
(&) :: a -> (a -> b) -> b
infixl 1 &
(+~) :: Num b => ASetter' a b -> b -> a -> a
infixr 4 +~
(*~) :: Num b => ASetter' a b -> b -> a -> a
infixr 4 *~
(-~) :: Num b => ASetter' a b -> b -> a -> a
infixr 4 -~
(//~) :: Fractional b => ASetter' a b -> b -> a -> a
infixr 4 //~
(&&~) :: ASetter' a Bool -> Bool -> a -> a
infixr 4 &&~
(||~) :: ASetter' a Bool -> Bool -> a -> a
infixr 4 ||~

-- | Monoidally append a value to all referenced fields.
(<>~) :: Monoid o => ASetter' a o -> o -> a -> a
infixr 4 <>~
type LensLike f a a' b b' = (b -> f b') -> (a -> f a')
type LensLike' f a b = (b -> f b) -> (a -> f a)
type FoldLike r a a' b b' = LensLike (Constant r) a a' b b'
type FoldLike' r a b = LensLike' (Constant r) a b
type ASetter a a' b b' = LensLike Identity a a' b b'
type ASetter' a b = LensLike' Identity a b
class Functor f => Phantom f

-- | Constant functor.
data Constant a (b :: k) :: forall k. () => Type -> k -> Type

-- | Identity functor and monad. (a non-strict monad)
data Identity a

-- | A functor with application, providing operations to
--   
--   <ul>
--   <li>embed pure expressions (<a>pure</a>), and</li>
--   <li>sequence computations and combine their results (<a>&lt;*&gt;</a>
--   and <a>liftA2</a>).</li>
--   </ul>
--   
--   A minimal complete definition must include implementations of
--   <a>pure</a> and of either <a>&lt;*&gt;</a> or <a>liftA2</a>. If it
--   defines both, then they must behave the same as their default
--   definitions:
--   
--   <pre>
--   (<a>&lt;*&gt;</a>) = <a>liftA2</a> <a>id</a>
--   </pre>
--   
--   <pre>
--   <a>liftA2</a> f x y = f <tt>&lt;$&gt;</tt> x <a>&lt;*&gt;</a> y
--   </pre>
--   
--   Further, any definition must satisfy the following:
--   
--   <ul>
--   <li><i><i>identity</i></i> <pre><a>pure</a> <a>id</a> <a>&lt;*&gt;</a>
--   v = v</pre></li>
--   <li><i><i>composition</i></i> <pre><a>pure</a> (.) <a>&lt;*&gt;</a> u
--   <a>&lt;*&gt;</a> v <a>&lt;*&gt;</a> w = u <a>&lt;*&gt;</a> (v
--   <a>&lt;*&gt;</a> w)</pre></li>
--   <li><i><i>homomorphism</i></i> <pre><a>pure</a> f <a>&lt;*&gt;</a>
--   <a>pure</a> x = <a>pure</a> (f x)</pre></li>
--   <li><i><i>interchange</i></i> <pre>u <a>&lt;*&gt;</a> <a>pure</a> y =
--   <a>pure</a> (<a>$</a> y) <a>&lt;*&gt;</a> u</pre></li>
--   </ul>
--   
--   The other methods have the following default definitions, which may be
--   overridden with equivalent specialized implementations:
--   
--   <ul>
--   <li><pre>u <a>*&gt;</a> v = (<a>id</a> <a>&lt;$</a> u)
--   <a>&lt;*&gt;</a> v</pre></li>
--   <li><pre>u <a>&lt;*</a> v = <a>liftA2</a> <a>const</a> u v</pre></li>
--   </ul>
--   
--   As a consequence of these laws, the <a>Functor</a> instance for
--   <tt>f</tt> will satisfy
--   
--   <ul>
--   <li><pre><a>fmap</a> f x = <a>pure</a> f <a>&lt;*&gt;</a> x</pre></li>
--   </ul>
--   
--   It may be useful to note that supposing
--   
--   <pre>
--   forall x y. p (q x y) = f x . g y
--   </pre>
--   
--   it follows from the above that
--   
--   <pre>
--   <a>liftA2</a> p (<a>liftA2</a> q u v) = <a>liftA2</a> f u . <a>liftA2</a> g v
--   </pre>
--   
--   If <tt>f</tt> is also a <a>Monad</a>, it should satisfy
--   
--   <ul>
--   <li><pre><a>pure</a> = <a>return</a></pre></li>
--   <li><pre>(<a>&lt;*&gt;</a>) = <a>ap</a></pre></li>
--   <li><pre>(<a>*&gt;</a>) = (<a>&gt;&gt;</a>)</pre></li>
--   </ul>
--   
--   (which implies that <a>pure</a> and <a>&lt;*&gt;</a> satisfy the
--   applicative functor laws).
class Functor f => Applicative (f :: Type -> Type)

-- | Data structures that can be folded.
--   
--   For example, given a data type
--   
--   <pre>
--   data Tree a = Empty | Leaf a | Node (Tree a) a (Tree a)
--   </pre>
--   
--   a suitable instance would be
--   
--   <pre>
--   instance Foldable Tree where
--      foldMap f Empty = mempty
--      foldMap f (Leaf x) = f x
--      foldMap f (Node l k r) = foldMap f l `mappend` f k `mappend` foldMap f r
--   </pre>
--   
--   This is suitable even for abstract types, as the monoid is assumed to
--   satisfy the monoid laws. Alternatively, one could define
--   <tt>foldr</tt>:
--   
--   <pre>
--   instance Foldable Tree where
--      foldr f z Empty = z
--      foldr f z (Leaf x) = f x z
--      foldr f z (Node l k r) = foldr f (f k (foldr f z r)) l
--   </pre>
--   
--   <tt>Foldable</tt> instances are expected to satisfy the following
--   laws:
--   
--   <pre>
--   foldr f z t = appEndo (foldMap (Endo . f) t ) z
--   </pre>
--   
--   <pre>
--   foldl f z t = appEndo (getDual (foldMap (Dual . Endo . flip f) t)) z
--   </pre>
--   
--   <pre>
--   fold = foldMap id
--   </pre>
--   
--   <pre>
--   length = getSum . foldMap (Sum . const  1)
--   </pre>
--   
--   <tt>sum</tt>, <tt>product</tt>, <tt>maximum</tt>, and <tt>minimum</tt>
--   should all be essentially equivalent to <tt>foldMap</tt> forms, such
--   as
--   
--   <pre>
--   sum = getSum . foldMap Sum
--   </pre>
--   
--   but may be less defined.
--   
--   If the type is also a <a>Functor</a> instance, it should satisfy
--   
--   <pre>
--   foldMap f = fold . fmap f
--   </pre>
--   
--   which implies that
--   
--   <pre>
--   foldMap f . fmap g = foldMap (f . g)
--   </pre>
class Foldable (t :: Type -> Type)

-- | The class of monoids (types with an associative binary operation that
--   has an identity). Instances should satisfy the following laws:
--   
--   <ul>
--   <li><pre>x <a>&lt;&gt;</a> <a>mempty</a> = x</pre></li>
--   <li><pre><a>mempty</a> <a>&lt;&gt;</a> x = x</pre></li>
--   <li><tt>x <a>&lt;&gt;</a> (y <a>&lt;&gt;</a> z) = (x <a>&lt;&gt;</a>
--   y) <a>&lt;&gt;</a> z</tt> (<a>Semigroup</a> law)</li>
--   <li><pre><a>mconcat</a> = <a>foldr</a> '(&lt;&gt;)'
--   <a>mempty</a></pre></li>
--   </ul>
--   
--   The method names refer to the monoid of lists under concatenation, but
--   there are many other instances.
--   
--   Some types can be viewed as a monoid in more than one way, e.g. both
--   addition and multiplication on numbers. In such cases we often define
--   <tt>newtype</tt>s and make those instances of <a>Monoid</a>, e.g.
--   <tt>Sum</tt> and <tt>Product</tt>.
--   
--   <b>NOTE</b>: <a>Semigroup</a> is a superclass of <a>Monoid</a> since
--   <i>base-4.11.0.0</i>.
class Semigroup a => Monoid a

-- | The same functor, but with an <a>Applicative</a> instance that
--   performs actions in the reverse order.
data Backwards (f :: k -> Type) (a :: k) :: forall k. () => k -> Type -> k -> Type

-- | Boolean monoid under conjunction (<a>&amp;&amp;</a>).
--   
--   <pre>
--   &gt;&gt;&gt; getAll (All True &lt;&gt; mempty &lt;&gt; All False)
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; getAll (mconcat (map (\x -&gt; All (even x)) [2,4,6,7,8]))
--   False
--   </pre>
data All

-- | Boolean monoid under disjunction (<a>||</a>).
--   
--   <pre>
--   &gt;&gt;&gt; getAny (Any True &lt;&gt; mempty &lt;&gt; Any False)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; getAny (mconcat (map (\x -&gt; Any (even x)) [2,4,6,7,8]))
--   True
--   </pre>
data Any

-- | Maybe monoid returning the leftmost non-Nothing value.
--   
--   <tt><a>First</a> a</tt> is isomorphic to <tt><a>Alt</a> <a>Maybe</a>
--   a</tt>, but precedes it historically.
--   
--   <pre>
--   &gt;&gt;&gt; getFirst (First (Just "hello") &lt;&gt; First Nothing &lt;&gt; First (Just "world"))
--   Just "hello"
--   </pre>
--   
--   Use of this type is discouraged. Note the following equivalence:
--   
--   <pre>
--   Data.Monoid.First x === Maybe (Data.Semigroup.First x)
--   </pre>
--   
--   In addition to being equivalent in the structural sense, the two also
--   have <a>Monoid</a> instances that behave the same. This type will be
--   marked deprecated in GHC 8.8, and removed in GHC 8.10. Users are
--   advised to use the variant from <a>Data.Semigroup</a> and wrap it in
--   <a>Maybe</a>.
data First a

-- | Maybe monoid returning the rightmost non-Nothing value.
--   
--   <tt><a>Last</a> a</tt> is isomorphic to <tt><a>Dual</a> (<a>First</a>
--   a)</tt>, and thus to <tt><a>Dual</a> (<a>Alt</a> <a>Maybe</a> a)</tt>
--   
--   <pre>
--   &gt;&gt;&gt; getLast (Last (Just "hello") &lt;&gt; Last Nothing &lt;&gt; Last (Just "world"))
--   Just "world"
--   </pre>
--   
--   Use of this type is discouraged. Note the following equivalence:
--   
--   <pre>
--   Data.Monoid.Last x === Maybe (Data.Semigroup.Last x)
--   </pre>
--   
--   In addition to being equivalent in the structural sense, the two also
--   have <a>Monoid</a> instances that behave the same. This type will be
--   marked deprecated in GHC 8.8, and removed in GHC 8.10. Users are
--   advised to use the variant from <a>Data.Semigroup</a> and wrap it in
--   <a>Maybe</a>.
data Last a

-- | Monoid under addition.
--   
--   <pre>
--   &gt;&gt;&gt; getSum (Sum 1 &lt;&gt; Sum 2 &lt;&gt; mempty)
--   3
--   </pre>
data Sum a

-- | Monoid under multiplication.
--   
--   <pre>
--   &gt;&gt;&gt; getProduct (Product 3 &lt;&gt; Product 4 &lt;&gt; mempty)
--   12
--   </pre>
data Product a


-- | This module contains lenses and traversals for common structures in
--   Haskell. It also contains the combinators for lenses and traversals.
module Lens.Family.Stock

-- | <pre>
--   choosing :: Lens a a' c c' -&gt; Lens b b' c c' -&gt; Lens (Either a b) (Either a' b') c c'
--   </pre>
--   
--   <pre>
--   choosing :: Traversal a a' c c' -&gt; Traversal b b' c c' -&gt; Traversal (Either a b) (Either a' b') c c'
--   </pre>
--   
--   <pre>
--   choosing :: Getter a a' c c' -&gt; Getter b b' c c' -&gt; Getter (Either a b) (Either a' b') c c'
--   </pre>
--   
--   <pre>
--   choosing :: Fold a a' c c' -&gt; Fold b b' c c' -&gt; Fold (Either a b) (Either a' b') c c'
--   </pre>
--   
--   <pre>
--   choosing :: Setter a a' c c' -&gt; Setter b b' c c' -&gt; Setter (Either a b) (Either a' b') c c'
--   </pre>
--   
--   Given two lens/traversal/getter/fold/setter families with the same
--   substructure, make a new lens/traversal/getter/fold/setter on
--   <a>Either</a>.
choosing :: Functor f => LensLike f a a' c c' -> LensLike f b b' c c' -> LensLike f (Either a b) (Either a' b') c c'

-- | <pre>
--   alongside :: Lens a1 a1' b1 b1' -&gt; Lens a2 a2' b2 b2' -&gt; Lens (a1, a2) (a1', a2') (b1, b2) (b1', b2')
--   </pre>
--   
--   <pre>
--   alongside :: Getter a1 a1' b1 b1' -&gt; Getter a2 a2' b2 b2' -&gt; Getter (a1, a2) (a1', a2') (b1, b2) (b1', b2')
--   </pre>
--   
--   Given two lens/getter families, make a new lens/getter on their
--   product.
alongside :: Functor f => LensLike (AlongsideLeft f b2') a1 a1' b1 b1' -> LensLike (AlongsideRight f a1') a2 a2' b2 b2' -> LensLike f (a1, a2) (a1', a2') (b1, b2) (b1', b2')

-- | <pre>
--   beside :: Traversal a a' c c' -&gt; Traversal b' b' c c' -&gt; Traversal (a,b) (a',b') c c'
--   </pre>
--   
--   <pre>
--   beside :: Fold a a' c c' -&gt; Fold b' b' c c' -&gt; Fold (a,b) (a',b') c c'
--   </pre>
--   
--   <pre>
--   beside :: Setter a a' c c' -&gt; Setter b' b' c c' -&gt; Setter (a,b) (a',b') c c'
--   </pre>
--   
--   Given two traversals/folds/setters referencing a type <tt>c</tt>,
--   create a traversal/fold/setter on the pair referencing <tt>c</tt>.
beside :: Applicative f => LensLike f a a' c c' -> LensLike f b b' c c' -> LensLike f (a, b) (a', b') c c'

-- | <pre>
--   _1 :: Lens (a, b) (a', b) a a'
--   </pre>
--   
--   Lens on the first element of a pair.
_1 :: Functor f => LensLike f (a, b) (a', b) a a'

-- | <pre>
--   _2 :: Lens (a, b) (a, b') b b'
--   </pre>
--   
--   Lens on the second element of a pair.
_2 :: Functor f => LensLike f (a, b) (a, b') b b'

-- | <pre>
--   chosen :: Lens (Either a a) (Either b b) a b
--   </pre>
--   
--   Lens on the Left or Right element of an (<a>Either</a> a a).
chosen :: Functor f => LensLike f (Either a a) (Either b b) a b

-- | <pre>
--   ix :: Eq k =&gt; k -&gt; Lens' (k -&gt; v) v
--   </pre>
--   
--   Lens on a given point of a function.
ix :: (Eq k, Functor f) => k -> LensLike' f (k -> v) v

-- | <pre>
--   at :: Ord k =&gt; k -&gt; Lens' (Map.Map k v) (Maybe v)
--   </pre>
--   
--   Lens on a given point of a <a>Map</a>.
at :: (Ord k, Functor f) => k -> LensLike' f (Map k v) (Maybe v)

-- | <pre>
--   intAt :: Int -&gt; Lens (IntMap.IntMap v) (Maybe v)
--   </pre>
--   
--   Lens on a given point of a <a>IntMap</a>.
intAt :: Functor f => Int -> LensLike' f (IntMap v) (Maybe v)

-- | <pre>
--   at :: Ord k =&gt; k -&gt; Lens' (Map.Map k v) (Maybe v)
--   </pre>
--   
--   Lens providing strict access to a given point of a <a>Map</a>.
at' :: (Ord k, Functor f) => k -> LensLike' f (Map k v) (Maybe v)

-- | <pre>
--   intAt :: Int -&gt; Lens (IntMap.IntMap v) (Maybe v)
--   </pre>
--   
--   Lens providing strict access to a given point of a <a>IntMap</a>.
intAt' :: Functor f => Int -> LensLike' f (IntMap v) (Maybe v)

-- | <pre>
--   contains :: Ord =&gt; k -&gt; Lens' (Set.Set k) Bool
--   </pre>
--   
--   Lens on a given point of a <a>Set</a>.
contains :: (Ord k, Functor f) => k -> LensLike' f (Set k) Bool

-- | <pre>
--   intContains :: Int -&gt; Lens' IntSet.IntSet Bool
--   </pre>
--   
--   Lens on a given point of a <a>IntSet</a>.
intContains :: Functor f => Int -> LensLike' f IntSet Bool

-- | <pre>
--   both :: Traversal (a,a) (b,b) a b
--   </pre>
--   
--   Traversals on both elements of a pair <tt>(a,a)</tt>.
both :: Applicative f => LensLike f (a, a) (b, b) a b

-- | <pre>
--   _Left :: Traversal (Either a b) (Either a' b) a a'
--   </pre>
--   
--   Traversal on the <a>Left</a> element of an <a>Either</a>.
_Left :: Applicative f => LensLike f (Either a b) (Either a' b) a a'

-- | <pre>
--   _Right :: Traversal (Either a b) (Either a b') b b'
--   </pre>
--   
--   Traversal on the <a>Right</a> element of an <a>Either</a>.
_Right :: Applicative f => LensLike f (Either a b) (Either a b') b b'

-- | <pre>
--   _Just :: Traversal (Maybe a) (Maybe a') a a'
--   </pre>
--   
--   Traversal on the <a>Just</a> element of a <a>Maybe</a>.
_Just :: Applicative f => LensLike f (Maybe a) (Maybe a') a a'

-- | <pre>
--   _Nothing :: Traversal' (Maybe a) ()
--   </pre>
--   
--   Traversal on the <a>Nothing</a> element of a <a>Maybe</a>.
_Nothing :: Applicative f => LensLike' f (Maybe a) ()

-- | <pre>
--   ignored :: Traversal a a b b'
--   </pre>
--   
--   The empty traversal on any type.
ignored :: Applicative f => null -> a -> f a

-- | <pre>
--   mapped :: Functor g =&gt; Setter (g a) (g a') a a'
--   </pre>
--   
--   An SEC referencing the parameter of a functor.
mapped :: (Identical f, Functor g) => LensLike f (g a) (g a') a a'
data AlongsideLeft f b a
data AlongsideRight f a b
type LensLike f a a' b b' = (b -> f b') -> (a -> f a')
type LensLike' f a b = (b -> f b) -> (a -> f a)

-- | A functor with application, providing operations to
--   
--   <ul>
--   <li>embed pure expressions (<a>pure</a>), and</li>
--   <li>sequence computations and combine their results (<a>&lt;*&gt;</a>
--   and <a>liftA2</a>).</li>
--   </ul>
--   
--   A minimal complete definition must include implementations of
--   <a>pure</a> and of either <a>&lt;*&gt;</a> or <a>liftA2</a>. If it
--   defines both, then they must behave the same as their default
--   definitions:
--   
--   <pre>
--   (<a>&lt;*&gt;</a>) = <a>liftA2</a> <a>id</a>
--   </pre>
--   
--   <pre>
--   <a>liftA2</a> f x y = f <tt>&lt;$&gt;</tt> x <a>&lt;*&gt;</a> y
--   </pre>
--   
--   Further, any definition must satisfy the following:
--   
--   <ul>
--   <li><i><i>identity</i></i> <pre><a>pure</a> <a>id</a> <a>&lt;*&gt;</a>
--   v = v</pre></li>
--   <li><i><i>composition</i></i> <pre><a>pure</a> (.) <a>&lt;*&gt;</a> u
--   <a>&lt;*&gt;</a> v <a>&lt;*&gt;</a> w = u <a>&lt;*&gt;</a> (v
--   <a>&lt;*&gt;</a> w)</pre></li>
--   <li><i><i>homomorphism</i></i> <pre><a>pure</a> f <a>&lt;*&gt;</a>
--   <a>pure</a> x = <a>pure</a> (f x)</pre></li>
--   <li><i><i>interchange</i></i> <pre>u <a>&lt;*&gt;</a> <a>pure</a> y =
--   <a>pure</a> (<a>$</a> y) <a>&lt;*&gt;</a> u</pre></li>
--   </ul>
--   
--   The other methods have the following default definitions, which may be
--   overridden with equivalent specialized implementations:
--   
--   <ul>
--   <li><pre>u <a>*&gt;</a> v = (<a>id</a> <a>&lt;$</a> u)
--   <a>&lt;*&gt;</a> v</pre></li>
--   <li><pre>u <a>&lt;*</a> v = <a>liftA2</a> <a>const</a> u v</pre></li>
--   </ul>
--   
--   As a consequence of these laws, the <a>Functor</a> instance for
--   <tt>f</tt> will satisfy
--   
--   <ul>
--   <li><pre><a>fmap</a> f x = <a>pure</a> f <a>&lt;*&gt;</a> x</pre></li>
--   </ul>
--   
--   It may be useful to note that supposing
--   
--   <pre>
--   forall x y. p (q x y) = f x . g y
--   </pre>
--   
--   it follows from the above that
--   
--   <pre>
--   <a>liftA2</a> p (<a>liftA2</a> q u v) = <a>liftA2</a> f u . <a>liftA2</a> g v
--   </pre>
--   
--   If <tt>f</tt> is also a <a>Monad</a>, it should satisfy
--   
--   <ul>
--   <li><pre><a>pure</a> = <a>return</a></pre></li>
--   <li><pre>(<a>&lt;*&gt;</a>) = <a>ap</a></pre></li>
--   <li><pre>(<a>*&gt;</a>) = (<a>&gt;&gt;</a>)</pre></li>
--   </ul>
--   
--   (which implies that <a>pure</a> and <a>&lt;*&gt;</a> satisfy the
--   applicative functor laws).
class Functor f => Applicative (f :: Type -> Type)
class Applicative f => Identical f
instance GHC.Base.Functor f => GHC.Base.Functor (Lens.Family.Stock.AlongsideRight f a)
instance Lens.Family.Phantom.Phantom f => Lens.Family.Phantom.Phantom (Lens.Family.Stock.AlongsideRight f a)
instance GHC.Base.Functor f => GHC.Base.Functor (Lens.Family.Stock.AlongsideLeft f a)
instance Lens.Family.Phantom.Phantom f => Lens.Family.Phantom.Phantom (Lens.Family.Stock.AlongsideLeft f a)


-- | Lenses allow you to use fields of the state of a state monad as if
--   they were variables in an imperative language. <a>use</a> is used to
--   retrieve the value of a variable, and <a>.=</a> and <a>%=</a> allow
--   you to set and modify a variable. C-style compound assignments are
--   also provided.
module Lens.Family.State.Strict

-- | <pre>
--   zoom :: Monad m =&gt; Lens' a b -&gt; StateT b m c -&gt; StateT a m c
--   </pre>
--   
--   Lift a stateful operation on a field to a stateful operation on the
--   whole state. This is a good way to call a "subroutine" that only needs
--   access to part of the state.
--   
--   <pre>
--   zoom :: (Monoid c, Monad m) =&gt; Traversal' a b -&gt; StateT b m c -&gt; StateT a m c
--   </pre>
--   
--   Run the "subroutine" on each element of the traversal in turn and
--   <a>mconcat</a> all the results together.
--   
--   <pre>
--   zoom :: Monad m =&gt; Traversal' a b -&gt; StateT b m () -&gt; StateT a m ()
--   </pre>
--   
--   Run the "subroutine" on each element the traversal in turn.
zoom :: Monad m => LensLike' (Zooming m c) a b -> StateT b m c -> StateT a m c

-- | <pre>
--   use :: Monad m =&gt; Getter a a' b b' -&gt; StateT a m b
--   </pre>
--   
--   Retrieve a field of the state
--   
--   <pre>
--   use :: (Monoid b, Monad m) =&gt; Fold a a' b b' -&gt; StateT a m b
--   </pre>
--   
--   Retrieve a monoidal summary of all the referenced fields from the
--   state
use :: Monad m => FoldLike b a a' b b' -> StateT a m b

-- | <pre>
--   uses :: (Monoid r, Monad m) =&gt; Fold a a' b b' -&gt; (b -&gt; r) -&gt; StateT a m r
--   </pre>
--   
--   Retrieve all the referenced fields from the state and foldMap the
--   results together with <tt>f :: b -&gt; r</tt>.
--   
--   <pre>
--   uses :: Monad m =&gt; Getter a a' b b' -&gt; (b -&gt; r) -&gt; StateT a m r
--   </pre>
--   
--   Retrieve a field of the state and pass it through the function <tt>f
--   :: b -&gt; r</tt>.
--   
--   <pre>
--   uses l f = f &lt;$&gt; use l
--   </pre>
uses :: Monad m => FoldLike r a a' b b' -> (b -> r) -> StateT a m r

-- | Modify a field of the state.
(%=) :: Monad m => ASetter a a b b' -> (b -> b') -> StateT a m ()
infix 4 %=

-- | Set a field of the state.
assign :: Monad m => ASetter a a b b' -> b' -> StateT a m ()

-- | Set a field of the state.
(.=) :: Monad m => ASetter a a b b' -> b' -> StateT a m ()
infix 4 .=

-- | <pre>
--   (%%=) :: Monad m =&gt; Lens a a b b' -&gt; (b -&gt; (c, b')) -&gt; StateT a m c
--   </pre>
--   
--   Modify a field of the state while returning another value.
--   
--   <pre>
--   (%%=) :: (Monad m, Monoid c) =&gt; Traversal a a b b' -&gt; (b -&gt; (c, b')) -&gt; StateT a m c
--   </pre>
--   
--   Modify each field of the state and return the <a>mconcat</a> of the
--   other values.
(%%=) :: Monad m => LensLike (Writer c) a a b b' -> (b -> (c, b')) -> StateT a m c
infix 4 %%=

-- | Set a field of the state using the result of executing a stateful
--   command.
(<~) :: Monad m => ASetter a a b b' -> StateT a m b' -> StateT a m ()
infixr 2 <~
(+=) :: (Monad m, Num b) => ASetter' a b -> b -> StateT a m ()
infixr 4 +=
(-=) :: (Monad m, Num b) => ASetter' a b -> b -> StateT a m ()
infixr 4 -=
(*=) :: (Monad m, Num b) => ASetter' a b -> b -> StateT a m ()
infixr 4 *=
(//=) :: (Monad m, Fractional b) => ASetter' a b -> b -> StateT a m ()
infixr 4 //=
(&&=) :: Monad m => ASetter' a Bool -> Bool -> StateT a m ()
infixr 4 &&=
(||=) :: Monad m => ASetter' a Bool -> Bool -> StateT a m ()
infixr 4 ||=

-- | Monoidally append a value to all referenced fields of the state.
(<>=) :: (Monoid o, Monad m) => ASetter' a o -> o -> StateT a m ()
infixr 4 <>=

-- | Strictly modify a field of the state.
(%!=) :: Monad m => ASetter a a b b' -> (b -> b') -> StateT a m ()
infix 4 %!=
(+!=) :: (Monad m, Num b) => ASetter' a b -> b -> StateT a m ()
infixr 4 +!=
(-!=) :: (Monad m, Num b) => ASetter' a b -> b -> StateT a m ()
infixr 4 -!=
(*!=) :: (Monad m, Num b) => ASetter' a b -> b -> StateT a m ()
infixr 4 *!=
(//!=) :: (Monad m, Fractional b) => ASetter' a b -> b -> StateT a m ()
infixr 4 //!=
(&&!=) :: Monad m => ASetter' a Bool -> Bool -> StateT a m ()
infixr 4 &&!=
(||!=) :: Monad m => ASetter' a Bool -> Bool -> StateT a m ()
infixr 4 ||!=
(<>!=) :: (Monoid o, Monad m) => ASetter' a o -> o -> StateT a m ()
infixr 4 <>!=
data Zooming m c a
type LensLike f a a' b b' = (b -> f b') -> (a -> f a')
type LensLike' f a b = (b -> f b) -> (a -> f a)
type FoldLike r a a' b b' = LensLike (Constant r) a a' b b'

-- | Constant functor.
data Constant a (b :: k) :: forall k. () => Type -> k -> Type
type ASetter a a' b b' = LensLike Identity a a' b b'
type ASetter' a b = LensLike' Identity a b

-- | Identity functor and monad. (a non-strict monad)
data Identity a

-- | A state transformer monad parameterized by:
--   
--   <ul>
--   <li><tt>s</tt> - The state.</li>
--   <li><tt>m</tt> - The inner monad.</li>
--   </ul>
--   
--   The <a>return</a> function leaves the state unchanged, while
--   <tt>&gt;&gt;=</tt> uses the final state of the first computation as
--   the initial state of the second.
data StateT s (m :: Type -> Type) a

-- | A writer monad parameterized by the type <tt>w</tt> of output to
--   accumulate.
--   
--   The <a>return</a> function produces the output <a>mempty</a>, while
--   <tt>&gt;&gt;=</tt> combines the outputs of the subcomputations using
--   <a>mappend</a>.
type Writer w = WriterT w Identity

-- | The class of monoids (types with an associative binary operation that
--   has an identity). Instances should satisfy the following laws:
--   
--   <ul>
--   <li><pre>x <a>&lt;&gt;</a> <a>mempty</a> = x</pre></li>
--   <li><pre><a>mempty</a> <a>&lt;&gt;</a> x = x</pre></li>
--   <li><tt>x <a>&lt;&gt;</a> (y <a>&lt;&gt;</a> z) = (x <a>&lt;&gt;</a>
--   y) <a>&lt;&gt;</a> z</tt> (<a>Semigroup</a> law)</li>
--   <li><pre><a>mconcat</a> = <a>foldr</a> '(&lt;&gt;)'
--   <a>mempty</a></pre></li>
--   </ul>
--   
--   The method names refer to the monoid of lists under concatenation, but
--   there are many other instances.
--   
--   Some types can be viewed as a monoid in more than one way, e.g. both
--   addition and multiplication on numbers. In such cases we often define
--   <tt>newtype</tt>s and make those instances of <a>Monoid</a>, e.g.
--   <tt>Sum</tt> and <tt>Product</tt>.
--   
--   <b>NOTE</b>: <a>Semigroup</a> is a superclass of <a>Monoid</a> since
--   <i>base-4.11.0.0</i>.
class Semigroup a => Monoid a


-- | Lenses allow you to use fields of the state of a state monad as if
--   they were variables in an imperative language. <a>use</a> is used to
--   retrieve the value of a variable, and <a>.=</a> and <a>%=</a> allow
--   you to set and modify a variable. C-style compound assignments are
--   also provided.
module Lens.Family.State.Lazy

-- | <pre>
--   zoom :: Monad m =&gt; Lens' a b -&gt; StateT b m c -&gt; StateT a m c
--   </pre>
--   
--   Lift a stateful operation on a field to a stateful operation on the
--   whole state. This is a good way to call a "subroutine" that only needs
--   access to part of the state.
--   
--   <pre>
--   zoom :: (Monoid c, Monad m) =&gt; Traversal' a b -&gt; StateT b m c -&gt; StateT a m c
--   </pre>
--   
--   Run the "subroutine" on each element of the traversal in turn and
--   <a>mconcat</a> all the results together.
--   
--   <pre>
--   zoom :: Monad m =&gt; Traversal' a b -&gt; StateT b m () -&gt; StateT a m ()
--   </pre>
--   
--   Run the "subroutine" on each element the traversal in turn.
zoom :: Monad m => LensLike' (Zooming m c) a b -> StateT b m c -> StateT a m c

-- | <pre>
--   use :: Monad m =&gt; Getter a a' b b' -&gt; StateT a m b
--   </pre>
--   
--   Retrieve a field of the state
--   
--   <pre>
--   use :: (Monoid b, Monad m) =&gt; Fold a a' b b' -&gt; StateT a m b
--   </pre>
--   
--   Retrieve a monoidal summary of all the referenced fields from the
--   state
use :: Monad m => FoldLike b a a' b b' -> StateT a m b

-- | <pre>
--   uses :: (Monoid r, Monad m) =&gt; Fold a a' b b' -&gt; (b -&gt; r) -&gt; StateT a m r
--   </pre>
--   
--   Retrieve all the referenced fields from the state and foldMap the
--   results together with <tt>f :: b -&gt; r</tt>.
--   
--   <pre>
--   uses :: Monad m =&gt; Getter a a' b b' -&gt; (b -&gt; r) -&gt; StateT a m r
--   </pre>
--   
--   Retrieve a field of the state and pass it through the function <tt>f
--   :: b -&gt; r</tt>.
--   
--   <pre>
--   uses l f = f &lt;$&gt; use l
--   </pre>
uses :: Monad m => FoldLike r a a' b b' -> (b -> r) -> StateT a m r

-- | Modify a field of the state.
(%=) :: Monad m => ASetter a a b b' -> (b -> b') -> StateT a m ()
infix 4 %=

-- | Set a field of the state.
assign :: Monad m => ASetter a a b b' -> b' -> StateT a m ()

-- | Set a field of the state.
(.=) :: Monad m => ASetter a a b b' -> b' -> StateT a m ()
infix 4 .=

-- | <pre>
--   (%%=) :: Monad m =&gt; Lens a a b b' -&gt; (b -&gt; (c, b')) -&gt; StateT a m c
--   </pre>
--   
--   Modify a field of the state while returning another value.
--   
--   <pre>
--   (%%=) :: (Monad m, Monoid c) =&gt; Traversal a a b b' -&gt; (b -&gt; (c, b')) -&gt; StateT a m c
--   </pre>
--   
--   Modify each field of the state and return the <a>mconcat</a> of the
--   other values.
(%%=) :: Monad m => LensLike (Writer c) a a b b' -> (b -> (c, b')) -> StateT a m c
infix 4 %%=

-- | Set a field of the state using the result of executing a stateful
--   command.
(<~) :: Monad m => ASetter a a b b' -> StateT a m b' -> StateT a m ()
infixr 2 <~
(+=) :: (Monad m, Num b) => ASetter' a b -> b -> StateT a m ()
infixr 4 +=
(-=) :: (Monad m, Num b) => ASetter' a b -> b -> StateT a m ()
infixr 4 -=
(*=) :: (Monad m, Num b) => ASetter' a b -> b -> StateT a m ()
infixr 4 *=
(//=) :: (Monad m, Fractional b) => ASetter' a b -> b -> StateT a m ()
infixr 4 //=
(&&=) :: Monad m => ASetter' a Bool -> Bool -> StateT a m ()
infixr 4 &&=
(||=) :: Monad m => ASetter' a Bool -> Bool -> StateT a m ()
infixr 4 ||=

-- | Monoidally append a value to all referenced fields of the state.
(<>=) :: (Monoid o, Monad m) => ASetter' a o -> o -> StateT a m ()
infixr 4 <>=

-- | Strictly modify a field of the state.
(%!=) :: Monad m => ASetter a a b b' -> (b -> b') -> StateT a m ()
infix 4 %!=
(+!=) :: (Monad m, Num b) => ASetter' a b -> b -> StateT a m ()
infixr 4 +!=
(-!=) :: (Monad m, Num b) => ASetter' a b -> b -> StateT a m ()
infixr 4 -!=
(*!=) :: (Monad m, Num b) => ASetter' a b -> b -> StateT a m ()
infixr 4 *!=
(//!=) :: (Monad m, Fractional b) => ASetter' a b -> b -> StateT a m ()
infixr 4 //!=
(&&!=) :: Monad m => ASetter' a Bool -> Bool -> StateT a m ()
infixr 4 &&!=
(||!=) :: Monad m => ASetter' a Bool -> Bool -> StateT a m ()
infixr 4 ||!=
(<>!=) :: (Monoid o, Monad m) => ASetter' a o -> o -> StateT a m ()
infixr 4 <>!=
data Zooming m c a
type LensLike f a a' b b' = (b -> f b') -> (a -> f a')
type LensLike' f a b = (b -> f b) -> (a -> f a)
type FoldLike r a a' b b' = LensLike (Constant r) a a' b b'

-- | Constant functor.
data Constant a (b :: k) :: forall k. () => Type -> k -> Type
type ASetter a a' b b' = LensLike Identity a a' b b'
type ASetter' a b = LensLike' Identity a b

-- | Identity functor and monad. (a non-strict monad)
data Identity a

-- | A state transformer monad parameterized by:
--   
--   <ul>
--   <li><tt>s</tt> - The state.</li>
--   <li><tt>m</tt> - The inner monad.</li>
--   </ul>
--   
--   The <a>return</a> function leaves the state unchanged, while
--   <tt>&gt;&gt;=</tt> uses the final state of the first computation as
--   the initial state of the second.
data StateT s (m :: Type -> Type) a

-- | A writer monad parameterized by the type <tt>w</tt> of output to
--   accumulate.
--   
--   The <a>return</a> function produces the output <a>mempty</a>, while
--   <tt>&gt;&gt;=</tt> combines the outputs of the subcomputations using
--   <a>mappend</a>.
type Writer w = WriterT w Identity

-- | The class of monoids (types with an associative binary operation that
--   has an identity). Instances should satisfy the following laws:
--   
--   <ul>
--   <li><pre>x <a>&lt;&gt;</a> <a>mempty</a> = x</pre></li>
--   <li><pre><a>mempty</a> <a>&lt;&gt;</a> x = x</pre></li>
--   <li><tt>x <a>&lt;&gt;</a> (y <a>&lt;&gt;</a> z) = (x <a>&lt;&gt;</a>
--   y) <a>&lt;&gt;</a> z</tt> (<a>Semigroup</a> law)</li>
--   <li><pre><a>mconcat</a> = <a>foldr</a> '(&lt;&gt;)'
--   <a>mempty</a></pre></li>
--   </ul>
--   
--   The method names refer to the monoid of lists under concatenation, but
--   there are many other instances.
--   
--   Some types can be viewed as a monoid in more than one way, e.g. both
--   addition and multiplication on numbers. In such cases we often define
--   <tt>newtype</tt>s and make those instances of <a>Monoid</a>, e.g.
--   <tt>Sum</tt> and <tt>Product</tt>.
--   
--   <b>NOTE</b>: <a>Semigroup</a> is a superclass of <a>Monoid</a> since
--   <i>base-4.11.0.0</i>.
class Semigroup a => Monoid a

module Lens.Family.State


-- | This module is provided for Haskell 98 compatibility. If you are able
--   to use <tt>Rank2Types</tt>, I advise you to instead use the rank 2
--   aliases
--   
--   <ul>
--   <li><tt>Lens</tt>, <tt>Lens'</tt></li>
--   <li><tt>Traversal</tt>, <tt>Traversal'</tt></li>
--   <li><tt>Setter</tt>, <tt>Setter'</tt></li>
--   <li><tt>Fold</tt>, <tt>Fold'</tt></li>
--   <li><tt>Getter</tt>, <tt>Getter'</tt></li>
--   </ul>
--   
--   from the <tt>lens-family</tt> package instead.
--   
--   <a>cloneLens</a> allows one to circumvent the need for rank 2 types by
--   allowing one to take a universal monomorphic lens instance and
--   rederive a polymorphic instance. When you require a lens family
--   parameter you use the type <tt><a>ALens</a> a a' b b'</tt> (or
--   <tt><a>ALens'</a> a b</tt>). Then, inside a <tt>where</tt> clause, you
--   use <a>cloneLens</a> to create a <tt>Lens</tt> type.
--   
--   For example.
--   
--   <pre>
--   example :: ALens a a' b b' -&gt; Example
--   example l = ... x^.cl ... cl .~ y ...
--    where
--     cl x = cloneLens l x
--   </pre>
--   
--   <i>Note</i>: It is important to eta-expand the definition of
--   <tt>cl</tt> to avoid the dreaded monomorphism restriction.
--   
--   <a>cloneTraversal</a>, <a>cloneGetter</a>, <a>cloneSetter</a>, and
--   <a>cloneFold</a> provides similar functionality for traversals,
--   getters, setters, and folds respectively.
--   
--   <i>Note</i>: Cloning is only need if you use a functional reference
--   multiple times with different instances.
module Lens.Family.Clone

-- | Converts a universal lens instance back into a polymorphic lens.
cloneLens :: Functor f => ALens a a' b b' -> LensLike f a a' b b'

-- | Converts a universal traversal instance back into a polymorphic
--   traversal.
cloneTraversal :: Applicative f => ATraversal a a' b b' -> LensLike f a a' b b'

-- | Converts a universal setter instance back into a polymorphic setter.
cloneSetter :: Identical f => ASetter a a' b b' -> LensLike f a a' b b'

-- | Converts a universal getter instance back into a polymorphic getter.
cloneGetter :: Phantom f => AGetter a a' b b' -> LensLike f a a' b b'

-- | Converts a universal fold instance back into a polymorphic fold.
cloneFold :: (Phantom f, Applicative f) => AFold a a' b b' -> LensLike f a a' b b'

-- | ALens a a' b b' is a universal Lens a a' b b' instance
type ALens a a' b b' = LensLike (IStore b b') a a' b b'

-- | ALens' a b is a universal Lens' a b instance
type ALens' a b = LensLike' (IStore b b) a b

-- | ATraversal a a' b b' is a universal Traversal a a' b b' instance
type ATraversal a a' b b' = LensLike (IKleeneStore b b') a a' b b'

-- | ATraversal' a b is a universal Traversal' a b instance
type ATraversal' a b = LensLike' (IKleeneStore b b) a b

-- | AGetter a a' b b' is a universal Fold a a' b b' instance
type AGetter a a' b b' = FoldLike b a a' b b'

-- | AGetter' a b is a universal Fold' a b instance
type AGetter' a b = FoldLike' b a b

-- | AFold a a' b b' is a universal Fold' a a' b b' instance
type AFold a a' b b' = FoldLike [b] a a' b b'

-- | AFold' a b is a universal Fold' a b instance
type AFold' a b = FoldLike' [b] a b
data IStore b b' a
data IKleeneStore b b' a
type LensLike f a a' b b' = (b -> f b') -> (a -> f a')
type LensLike' f a b = (b -> f b) -> (a -> f a)
type FoldLike r a a' b b' = LensLike (Constant r) a a' b b'
type FoldLike' r a b = LensLike' (Constant r) a b
type ASetter a a' b b' = LensLike Identity a a' b b'

-- | A functor with application, providing operations to
--   
--   <ul>
--   <li>embed pure expressions (<a>pure</a>), and</li>
--   <li>sequence computations and combine their results (<a>&lt;*&gt;</a>
--   and <a>liftA2</a>).</li>
--   </ul>
--   
--   A minimal complete definition must include implementations of
--   <a>pure</a> and of either <a>&lt;*&gt;</a> or <a>liftA2</a>. If it
--   defines both, then they must behave the same as their default
--   definitions:
--   
--   <pre>
--   (<a>&lt;*&gt;</a>) = <a>liftA2</a> <a>id</a>
--   </pre>
--   
--   <pre>
--   <a>liftA2</a> f x y = f <tt>&lt;$&gt;</tt> x <a>&lt;*&gt;</a> y
--   </pre>
--   
--   Further, any definition must satisfy the following:
--   
--   <ul>
--   <li><i><i>identity</i></i> <pre><a>pure</a> <a>id</a> <a>&lt;*&gt;</a>
--   v = v</pre></li>
--   <li><i><i>composition</i></i> <pre><a>pure</a> (.) <a>&lt;*&gt;</a> u
--   <a>&lt;*&gt;</a> v <a>&lt;*&gt;</a> w = u <a>&lt;*&gt;</a> (v
--   <a>&lt;*&gt;</a> w)</pre></li>
--   <li><i><i>homomorphism</i></i> <pre><a>pure</a> f <a>&lt;*&gt;</a>
--   <a>pure</a> x = <a>pure</a> (f x)</pre></li>
--   <li><i><i>interchange</i></i> <pre>u <a>&lt;*&gt;</a> <a>pure</a> y =
--   <a>pure</a> (<a>$</a> y) <a>&lt;*&gt;</a> u</pre></li>
--   </ul>
--   
--   The other methods have the following default definitions, which may be
--   overridden with equivalent specialized implementations:
--   
--   <ul>
--   <li><pre>u <a>*&gt;</a> v = (<a>id</a> <a>&lt;$</a> u)
--   <a>&lt;*&gt;</a> v</pre></li>
--   <li><pre>u <a>&lt;*</a> v = <a>liftA2</a> <a>const</a> u v</pre></li>
--   </ul>
--   
--   As a consequence of these laws, the <a>Functor</a> instance for
--   <tt>f</tt> will satisfy
--   
--   <ul>
--   <li><pre><a>fmap</a> f x = <a>pure</a> f <a>&lt;*&gt;</a> x</pre></li>
--   </ul>
--   
--   It may be useful to note that supposing
--   
--   <pre>
--   forall x y. p (q x y) = f x . g y
--   </pre>
--   
--   it follows from the above that
--   
--   <pre>
--   <a>liftA2</a> p (<a>liftA2</a> q u v) = <a>liftA2</a> f u . <a>liftA2</a> g v
--   </pre>
--   
--   If <tt>f</tt> is also a <a>Monad</a>, it should satisfy
--   
--   <ul>
--   <li><pre><a>pure</a> = <a>return</a></pre></li>
--   <li><pre>(<a>&lt;*&gt;</a>) = <a>ap</a></pre></li>
--   <li><pre>(<a>*&gt;</a>) = (<a>&gt;&gt;</a>)</pre></li>
--   </ul>
--   
--   (which implies that <a>pure</a> and <a>&lt;*&gt;</a> satisfy the
--   applicative functor laws).
class Functor f => Applicative (f :: Type -> Type)
class Functor f => Phantom f
class Applicative f => Identical f
instance GHC.Base.Functor (Lens.Family.Clone.IKleeneStore b b')
instance GHC.Base.Applicative (Lens.Family.Clone.IKleeneStore b b')
instance GHC.Base.Functor (Lens.Family.Clone.IStore b b')
