-- 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:
--   
--   
--   
- Polymorphic updating
--   
- Traversals
--   
- Cast projection functions to read-only lenses
--   
- Cast "toList" functions to read-only traversals
--   
- Cast semantic editor combinators to modify-only traversals.
--   
--   
--   (†) For optimal first-class support use the lens-family
--   package with rank 2 / rank N polymorphism. Lens.Family.Clone
--   allows for first-class support of lenses and traversals for those who
--   require Haskell 98.
@package lens-family-core
@version 1.2.3

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

-- | 
--   lens :: (a -> b) -> (a -> b' -> a') -> Lens a a' b b'
--   
--   
--   Build a lens from a getter and setter families.
--   
--   Caution: In order for the generated lens family to be
--   well-defined, you must ensure that the three lens laws hold:
--   
--   
--   
- 
getter (setter a b) === b

--   
- 
setter a (getter a) === a

--   
- 
setter (setter a b1) b2) === setter a b2

--   
lens :: Functor f => (a -> b) -> (a -> b' -> a') -> LensLike f a a' b b'

-- | 
--   iso :: (a -> b) -> (b' -> a') -> Lens a a' b b'
--   
--   
--   Build a lens from isomorphism families.
--   
--   Caution: In order for the generated lens family to be
--   well-defined, you must ensure that the two isomorphism laws hold:
--   
--   
--   
- 
yin . yang === id

--   
- 
yang . yin === id

--   
iso :: Functor f => (a -> b) -> (b' -> a') -> LensLike f a a' b b'

-- | setting promotes a "semantic editor combinator" to a
--   modify-only lens. To demote a lens to a semantic edit combinator, use
--   the section (l %~) or over l from
--   Lens.Family.
--   
--   
--   >>> setting map . fstL %~ length $ [("The",0),("quick",1),("brown",1),("fox",2)]
--   [(3,0),(5,1),(5,1),(3,2)]
--   
--   
--   Caution: In order for the generated setter family to be
--   well-defined, you must ensure that the two functors laws hold:
--   
--   
--   
- 
sec id === id

--   
- 
sec f . sec g === sec (f . g)

--   
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

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

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

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

-- | 
--   folding :: (a -> [b]) -> Fold a a' b b'
--   
--   
--   folding 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
--   (^..l) or toListOf l.
folding :: (Foldable g, Phantom f, Applicative f) => (a -> g b) -> LensLike f a a' b b'

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

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

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

-- | 
--   toListOf :: Fold a a' b b' -> a -> [b]
--   
--   
--   Returns a list of all of the referenced values in order.
toListOf :: FoldLike [b] a a' b b' -> a -> [b]

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

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

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

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

-- | 
--   sumOf :: Num b => Fold a a' b b' -> a -> b
--   
--   
--   Returns the sum of all the referenced values.
sumOf :: Num b => FoldLike (Sum b) a a' b b' -> a -> b

-- | 
--   productOf :: Num b => Fold a a' b b' -> a -> b
--   
--   
--   Returns the product of all the referenced values.
productOf :: Num b => FoldLike (Product b) a a' b b' -> a -> b

-- | 
--   lengthOf :: Num r => Fold a a' b b' -> a -> r
--   
--   
--   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

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

-- | 
--   backwards :: Traversal a a' b b' -> Traversal a a' b b'
--   backwards :: Fold a a' b b' -> Fold a a' b b'
--   
--   
--   Given a traversal or fold, reverse the order that elements are
--   traversed.
--   
--   
--   backwards :: Lens a a' b b' -> Lens a a' b b'
--   backwards :: Getter a a' b b' -> Getter a a' b b'
--   backwards :: Setter a a' b b' -> Setter a a' b b'
--   
--   
--   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 ($).
(&) :: 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
--   
--   
--   
- embed pure expressions (pure), and
--   
- sequence computations and combine their results (<*>
--   and liftA2).
--   
--   
--   A minimal complete definition must include implementations of
--   pure and of either <*> or liftA2. If it
--   defines both, then they must behave the same as their default
--   definitions:
--   
--   
--   (<*>) = liftA2 id
--   
--   
--   
--   liftA2 f x y = f <$> x <*> y
--   
--   
--   Further, any definition must satisfy the following:
--   
--   
--   
- identity 
pure id <*>
--   v = v

--   
- composition 
pure (.) <*> u
--   <*> v <*> w = u <*> (v
--   <*> w)

--   
- homomorphism 
pure f <*>
--   pure x = pure (f x)

--   
- interchange 
u <*> pure y =
--   pure ($ y) <*> u

--   
--   
--   The other methods have the following default definitions, which may be
--   overridden with equivalent specialized implementations:
--   
--   
--   
- 
u *> v = (id <$ u)
--   <*> v

--   
- 
u <* v = liftA2 const u v

--   
--   
--   As a consequence of these laws, the Functor instance for
--   f will satisfy
--   
--   
--   
- 
fmap f x = pure f <*> x

--   
--   
--   It may be useful to note that supposing
--   
--   
--   forall x y. p (q x y) = f x . g y
--   
--   
--   it follows from the above that
--   
--   
--   liftA2 p (liftA2 q u v) = liftA2 f u . liftA2 g v
--   
--   
--   If f is also a Monad, it should satisfy
--   
--   
--   
- 
pure = return

--   
- 
(<*>) = ap

--   
- 
(*>) = (>>)

--   
--   
--   (which implies that pure and <*> satisfy the
--   applicative functor laws).
class Functor f => Applicative (f :: Type -> Type)

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

--   
- 
mempty <> x = x

--   
- x <> (y <> z) = (x <>
--   y) <> z (Semigroup law)
--   
- 
mconcat = foldr '(<>)'
--   mempty

--   
--   
--   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
--   newtypes and make those instances of Monoid, e.g.
--   Sum and Product.
--   
--   NOTE: Semigroup is a superclass of Monoid since
--   base-4.11.0.0.
class Semigroup a => Monoid a

-- | The same functor, but with an Applicative 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 (&&).
--   
--   
--   >>> getAll (All True <> mempty <> All False)
--   False
--   
--   
--   
--   >>> getAll (mconcat (map (\x -> All (even x)) [2,4,6,7,8]))
--   False
--   
data All

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

-- | Maybe monoid returning the leftmost non-Nothing value.
--   
--   First a is isomorphic to Alt Maybe
--   a, but precedes it historically.
--   
--   
--   >>> getFirst (First (Just "hello") <> First Nothing <> First (Just "world"))
--   Just "hello"
--   
--   
--   Use of this type is discouraged. Note the following equivalence:
--   
--   
--   Data.Monoid.First x === Maybe (Data.Semigroup.First x)
--   
--   
--   In addition to being equivalent in the structural sense, the two also
--   have Monoid 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 Data.Semigroup and wrap it in
--   Maybe.
data First a

-- | Maybe monoid returning the rightmost non-Nothing value.
--   
--   Last a is isomorphic to Dual (First
--   a), and thus to Dual (Alt Maybe a)
--   
--   
--   >>> getLast (Last (Just "hello") <> Last Nothing <> Last (Just "world"))
--   Just "world"
--   
--   
--   Use of this type is discouraged. Note the following equivalence:
--   
--   
--   Data.Monoid.Last x === Maybe (Data.Semigroup.Last x)
--   
--   
--   In addition to being equivalent in the structural sense, the two also
--   have Monoid 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 Data.Semigroup and wrap it in
--   Maybe.
data Last a

-- | Monoid under addition.
--   
--   
--   >>> getSum (Sum 1 <> Sum 2 <> mempty)
--   3
--   
data Sum a

-- | Monoid under multiplication.
--   
--   
--   >>> getProduct (Product 3 <> Product 4 <> mempty)
--   12
--   
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

-- | 
--   choosing :: Lens a a' c c' -> Lens b b' c c' -> Lens (Either a b) (Either a' b') c c'
--   
--   
--   
--   choosing :: Traversal a a' c c' -> Traversal b b' c c' -> Traversal (Either a b) (Either a' b') c c'
--   
--   
--   
--   choosing :: Getter a a' c c' -> Getter b b' c c' -> Getter (Either a b) (Either a' b') c c'
--   
--   
--   
--   choosing :: Fold a a' c c' -> Fold b b' c c' -> Fold (Either a b) (Either a' b') c c'
--   
--   
--   
--   choosing :: Setter a a' c c' -> Setter b b' c c' -> Setter (Either a b) (Either a' b') c c'
--   
--   
--   Given two lens/traversal/getter/fold/setter families with the same
--   substructure, make a new lens/traversal/getter/fold/setter on
--   Either.
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'

-- | 
--   alongside :: Lens a1 a1' b1 b1' -> Lens a2 a2' b2 b2' -> Lens (a1, a2) (a1', a2') (b1, b2) (b1', b2')
--   
--   
--   
--   alongside :: Getter a1 a1' b1 b1' -> Getter a2 a2' b2 b2' -> Getter (a1, a2) (a1', a2') (b1, b2) (b1', b2')
--   
--   
--   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')

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

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

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

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

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

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

-- | 
--   intAt :: Int -> Lens (IntMap.IntMap v) (Maybe v)
--   
--   
--   Lens on a given point of a IntMap.
intAt :: Functor f => Int -> LensLike' f (IntMap v) (Maybe v)

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

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

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

-- | 
--   intContains :: Int -> Lens' IntSet.IntSet Bool
--   
--   
--   Lens on a given point of a IntSet.
intContains :: Functor f => Int -> LensLike' f IntSet Bool

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

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

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

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

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

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

-- | 
--   mapped :: Functor g => Setter (g a) (g a') a a'
--   
--   
--   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
--   
--   
--   
- embed pure expressions (pure), and
--   
- sequence computations and combine their results (<*>
--   and liftA2).
--   
--   
--   A minimal complete definition must include implementations of
--   pure and of either <*> or liftA2. If it
--   defines both, then they must behave the same as their default
--   definitions:
--   
--   
--   (<*>) = liftA2 id
--   
--   
--   
--   liftA2 f x y = f <$> x <*> y
--   
--   
--   Further, any definition must satisfy the following:
--   
--   
--   
- identity 
pure id <*>
--   v = v

--   
- composition 
pure (.) <*> u
--   <*> v <*> w = u <*> (v
--   <*> w)

--   
- homomorphism 
pure f <*>
--   pure x = pure (f x)

--   
- interchange 
u <*> pure y =
--   pure ($ y) <*> u

--   
--   
--   The other methods have the following default definitions, which may be
--   overridden with equivalent specialized implementations:
--   
--   
--   
- 
u *> v = (id <$ u)
--   <*> v

--   
- 
u <* v = liftA2 const u v

--   
--   
--   As a consequence of these laws, the Functor instance for
--   f will satisfy
--   
--   
--   
- 
fmap f x = pure f <*> x

--   
--   
--   It may be useful to note that supposing
--   
--   
--   forall x y. p (q x y) = f x . g y
--   
--   
--   it follows from the above that
--   
--   
--   liftA2 p (liftA2 q u v) = liftA2 f u . liftA2 g v
--   
--   
--   If f is also a Monad, it should satisfy
--   
--   
--   
- 
pure = return

--   
- 
(<*>) = ap

--   
- 
(*>) = (>>)

--   
--   
--   (which implies that pure and <*> 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. use is used to
--   retrieve the value of a variable, and .= and %= allow
--   you to set and modify a variable. C-style compound assignments are
--   also provided.
module Lens.Family.State.Strict

-- | 
--   zoom :: Monad m => Lens' a b -> StateT b m c -> StateT a m c
--   
--   
--   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.
--   
--   
--   zoom :: (Monoid c, Monad m) => Traversal' a b -> StateT b m c -> StateT a m c
--   
--   
--   Run the "subroutine" on each element of the traversal in turn and
--   mconcat all the results together.
--   
--   
--   zoom :: Monad m => Traversal' a b -> StateT b m () -> StateT a m ()
--   
--   
--   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

-- | 
--   use :: Monad m => Getter a a' b b' -> StateT a m b
--   
--   
--   Retrieve a field of the state
--   
--   
--   use :: (Monoid b, Monad m) => Fold a a' b b' -> StateT a m b
--   
--   
--   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

-- | 
--   uses :: (Monoid r, Monad m) => Fold a a' b b' -> (b -> r) -> StateT a m r
--   
--   
--   Retrieve all the referenced fields from the state and foldMap the
--   results together with f :: b -> r.
--   
--   
--   uses :: Monad m => Getter a a' b b' -> (b -> r) -> StateT a m r
--   
--   
--   Retrieve a field of the state and pass it through the function f
--   :: b -> r.
--   
--   
--   uses l f = f <$> use l
--   
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 .=

-- | 
--   (%%=) :: Monad m => Lens a a b b' -> (b -> (c, b')) -> StateT a m c
--   
--   
--   Modify a field of the state while returning another value.
--   
--   
--   (%%=) :: (Monad m, Monoid c) => Traversal a a b b' -> (b -> (c, b')) -> StateT a m c
--   
--   
--   Modify each field of the state and return the mconcat 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:
--   
--   
--   
- s - The state.
--   
- m - The inner monad.
--   
--   
--   The return function leaves the state unchanged, while
--   >>= 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 w of output to
--   accumulate.
--   
--   The return function produces the output mempty, while
--   >>= combines the outputs of the subcomputations using
--   mappend.
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:
--   
--   
--   
- 
x <> mempty = x

--   
- 
mempty <> x = x

--   
- x <> (y <> z) = (x <>
--   y) <> z (Semigroup law)
--   
- 
mconcat = foldr '(<>)'
--   mempty

--   
--   
--   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
--   newtypes and make those instances of Monoid, e.g.
--   Sum and Product.
--   
--   NOTE: Semigroup is a superclass of Monoid since
--   base-4.11.0.0.
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. use is used to
--   retrieve the value of a variable, and .= and %= allow
--   you to set and modify a variable. C-style compound assignments are
--   also provided.
module Lens.Family.State.Lazy

-- | 
--   zoom :: Monad m => Lens' a b -> StateT b m c -> StateT a m c
--   
--   
--   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.
--   
--   
--   zoom :: (Monoid c, Monad m) => Traversal' a b -> StateT b m c -> StateT a m c
--   
--   
--   Run the "subroutine" on each element of the traversal in turn and
--   mconcat all the results together.
--   
--   
--   zoom :: Monad m => Traversal' a b -> StateT b m () -> StateT a m ()
--   
--   
--   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

-- | 
--   use :: Monad m => Getter a a' b b' -> StateT a m b
--   
--   
--   Retrieve a field of the state
--   
--   
--   use :: (Monoid b, Monad m) => Fold a a' b b' -> StateT a m b
--   
--   
--   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

-- | 
--   uses :: (Monoid r, Monad m) => Fold a a' b b' -> (b -> r) -> StateT a m r
--   
--   
--   Retrieve all the referenced fields from the state and foldMap the
--   results together with f :: b -> r.
--   
--   
--   uses :: Monad m => Getter a a' b b' -> (b -> r) -> StateT a m r
--   
--   
--   Retrieve a field of the state and pass it through the function f
--   :: b -> r.
--   
--   
--   uses l f = f <$> use l
--   
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 .=

-- | 
--   (%%=) :: Monad m => Lens a a b b' -> (b -> (c, b')) -> StateT a m c
--   
--   
--   Modify a field of the state while returning another value.
--   
--   
--   (%%=) :: (Monad m, Monoid c) => Traversal a a b b' -> (b -> (c, b')) -> StateT a m c
--   
--   
--   Modify each field of the state and return the mconcat 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:
--   
--   
--   
- s - The state.
--   
- m - The inner monad.
--   
--   
--   The return function leaves the state unchanged, while
--   >>= 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 w of output to
--   accumulate.
--   
--   The return function produces the output mempty, while
--   >>= combines the outputs of the subcomputations using
--   mappend.
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:
--   
--   
--   
- 
x <> mempty = x

--   
- 
mempty <> x = x

--   
- x <> (y <> z) = (x <>
--   y) <> z (Semigroup law)
--   
- 
mconcat = foldr '(<>)'
--   mempty

--   
--   
--   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
--   newtypes and make those instances of Monoid, e.g.
--   Sum and Product.
--   
--   NOTE: Semigroup is a superclass of Monoid since
--   base-4.11.0.0.
class Semigroup a => Monoid a

module Lens.Family.State

-- | This module is provided for Haskell 98 compatibility. If you are able
--   to use Rank2Types, I advise you to instead use the rank 2
--   aliases
--   
--   
--   
- Lens, Lens'
--   
- Traversal, Traversal'
--   
- Setter, Setter'
--   
- Fold, Fold'
--   
- Getter, Getter'
--   
--   
--   from the lens-family package instead.
--   
--   cloneLens 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 ALens a a' b b' (or
--   ALens' a b). Then, inside a where clause, you
--   use cloneLens to create a Lens type.
--   
--   For example.
--   
--   
--   example :: ALens a a' b b' -> Example
--   example l = ... x^.cl ... cl .~ y ...
--    where
--     cl x = cloneLens l x
--   
--   
--   Note: It is important to eta-expand the definition of
--   cl to avoid the dreaded monomorphism restriction.
--   
--   cloneTraversal, cloneGetter, cloneSetter, and
--   cloneFold provides similar functionality for traversals,
--   getters, setters, and folds respectively.
--   
--   Note: 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
--   
--   
--   
- embed pure expressions (pure), and
--   
- sequence computations and combine their results (<*>
--   and liftA2).
--   
--   
--   A minimal complete definition must include implementations of
--   pure and of either <*> or liftA2. If it
--   defines both, then they must behave the same as their default
--   definitions:
--   
--   
--   (<*>) = liftA2 id
--   
--   
--   
--   liftA2 f x y = f <$> x <*> y
--   
--   
--   Further, any definition must satisfy the following:
--   
--   
--   
- identity 
pure id <*>
--   v = v

--   
- composition 
pure (.) <*> u
--   <*> v <*> w = u <*> (v
--   <*> w)

--   
- homomorphism 
pure f <*>
--   pure x = pure (f x)

--   
- interchange 
u <*> pure y =
--   pure ($ y) <*> u

--   
--   
--   The other methods have the following default definitions, which may be
--   overridden with equivalent specialized implementations:
--   
--   
--   
- 
u *> v = (id <$ u)
--   <*> v

--   
- 
u <* v = liftA2 const u v

--   
--   
--   As a consequence of these laws, the Functor instance for
--   f will satisfy
--   
--   
--   
- 
fmap f x = pure f <*> x

--   
--   
--   It may be useful to note that supposing
--   
--   
--   forall x y. p (q x y) = f x . g y
--   
--   
--   it follows from the above that
--   
--   
--   liftA2 p (liftA2 q u v) = liftA2 f u . liftA2 g v
--   
--   
--   If f is also a Monad, it should satisfy
--   
--   
--   
- 
pure = return

--   
- 
(<*>) = ap

--   
- 
(*>) = (>>)

--   
--   
--   (which implies that pure and <*> 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')
