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


-- | A game engine for playing werewolf within an arbitrary chat client
--   
--   A game engine for playing werewolf within an arbitrary chat client.
--   Werewolf is a well known social party game, commonly also called
--   Mafia. See the <a>Wikipedia article</a> for a rundown on its gameplay
--   and history.
@package werewolf
@version 1.5.2.0


-- | Extra utility functions for working with lenses.
module Control.Lens.Extra

-- | Functors representing data structures that can be traversed from left
--   to right.
--   
--   A definition of <a>traverse</a> must satisfy the following laws:
--   
--   <ul>
--   <li><i><i>naturality</i></i> <tt>t . <a>traverse</a> f =
--   <a>traverse</a> (t . f)</tt> for every applicative transformation
--   <tt>t</tt></li>
--   <li><i><i>identity</i></i> <tt><a>traverse</a> Identity =
--   Identity</tt></li>
--   <li><i><i>composition</i></i> <tt><a>traverse</a> (Compose .
--   <a>fmap</a> g . f) = Compose . <a>fmap</a> (<a>traverse</a> g) .
--   <a>traverse</a> f</tt></li>
--   </ul>
--   
--   A definition of <a>sequenceA</a> must satisfy the following laws:
--   
--   <ul>
--   <li><i><i>naturality</i></i> <tt>t . <a>sequenceA</a> =
--   <a>sequenceA</a> . <a>fmap</a> t</tt> for every applicative
--   transformation <tt>t</tt></li>
--   <li><i><i>identity</i></i> <tt><a>sequenceA</a> . <a>fmap</a> Identity
--   = Identity</tt></li>
--   <li><i><i>composition</i></i> <tt><a>sequenceA</a> . <a>fmap</a>
--   Compose = Compose . <a>fmap</a> <a>sequenceA</a> .
--   <a>sequenceA</a></tt></li>
--   </ul>
--   
--   where an <i>applicative transformation</i> is a function
--   
--   <pre>
--   t :: (Applicative f, Applicative g) =&gt; f a -&gt; g a
--   </pre>
--   
--   preserving the <a>Applicative</a> operations, i.e.
--   
--   <ul>
--   <li><pre>t (<a>pure</a> x) = <a>pure</a> x</pre></li>
--   <li><pre>t (x <a>&lt;*&gt;</a> y) = t x <a>&lt;*&gt;</a> t
--   y</pre></li>
--   </ul>
--   
--   and the identity functor <tt>Identity</tt> and composition of functors
--   <tt>Compose</tt> are defined as
--   
--   <pre>
--   newtype Identity a = Identity a
--   
--   instance Functor Identity where
--     fmap f (Identity x) = Identity (f x)
--   
--   instance Applicative Identity where
--     pure x = Identity x
--     Identity f &lt;*&gt; Identity x = Identity (f x)
--   
--   newtype Compose f g a = Compose (f (g a))
--   
--   instance (Functor f, Functor g) =&gt; Functor (Compose f g) where
--     fmap f (Compose x) = Compose (fmap (fmap f) x)
--   
--   instance (Applicative f, Applicative g) =&gt; Applicative (Compose f g) where
--     pure x = Compose (pure (pure x))
--     Compose f &lt;*&gt; Compose x = Compose ((&lt;*&gt;) &lt;$&gt; f &lt;*&gt; x)
--   </pre>
--   
--   (The naturality law is implied by parametricity.)
--   
--   Instances are similar to <a>Functor</a>, e.g. 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 Traversable Tree where
--      traverse f Empty = pure Empty
--      traverse f (Leaf x) = Leaf &lt;$&gt; f x
--      traverse f (Node l k r) = Node &lt;$&gt; traverse f l &lt;*&gt; f k &lt;*&gt; traverse f r
--   </pre>
--   
--   This is suitable even for abstract types, as the laws for
--   <a>&lt;*&gt;</a> imply a form of associativity.
--   
--   The superclass instances should satisfy the following:
--   
--   <ul>
--   <li>In the <a>Functor</a> instance, <a>fmap</a> should be equivalent
--   to traversal with the identity applicative functor
--   (<a>fmapDefault</a>).</li>
--   <li>In the <a>Foldable</a> instance, <a>foldMap</a> should be
--   equivalent to traversal with a constant applicative functor
--   (<a>foldMapDefault</a>).</li>
--   </ul>
class (Functor t, Foldable t) => Traversable (t :: * -> *)

-- | Map each element of a structure to an action, evaluate these actions
--   from left to right, and collect the results. For a version that
--   ignores the results see <a>traverse_</a>.
traverse :: (Traversable t, Applicative f) => a -> f b -> t a -> f t b

-- | A bifunctor is a type constructor that takes two type arguments and is
--   a functor in <i>both</i> arguments. That is, unlike with
--   <a>Functor</a>, a type constructor such as <a>Either</a> does not need
--   to be partially applied for a <a>Bifunctor</a> instance, and the
--   methods in this class permit mapping functions over the <a>Left</a>
--   value or the <a>Right</a> value, or both at the same time.
--   
--   Formally, the class <a>Bifunctor</a> represents a bifunctor from
--   <tt>Hask</tt> -&gt; <tt>Hask</tt>.
--   
--   Intuitively it is a bifunctor where both the first and second
--   arguments are covariant.
--   
--   You can define a <a>Bifunctor</a> by either defining <a>bimap</a> or
--   by defining both <a>first</a> and <a>second</a>.
--   
--   If you supply <a>bimap</a>, you should ensure that:
--   
--   <pre>
--   <a>bimap</a> <a>id</a> <a>id</a> ≡ <a>id</a>
--   </pre>
--   
--   If you supply <a>first</a> and <a>second</a>, ensure:
--   
--   <pre>
--   <a>first</a> <a>id</a> ≡ <a>id</a>
--   <a>second</a> <a>id</a> ≡ <a>id</a>
--   </pre>
--   
--   If you supply both, you should also ensure:
--   
--   <pre>
--   <a>bimap</a> f g ≡ <a>first</a> f <a>.</a> <a>second</a> g
--   </pre>
--   
--   These ensure by parametricity:
--   
--   <pre>
--   <a>bimap</a>  (f <a>.</a> g) (h <a>.</a> i) ≡ <a>bimap</a> f h <a>.</a> <a>bimap</a> g i
--   <a>first</a>  (f <a>.</a> g) ≡ <a>first</a>  f <a>.</a> <a>first</a>  g
--   <a>second</a> (f <a>.</a> g) ≡ <a>second</a> f <a>.</a> <a>second</a> g
--   </pre>
class Bifunctor (p :: * -> * -> *)

-- | Map over both arguments at the same time.
--   
--   <pre>
--   <a>bimap</a> f g ≡ <a>first</a> f <a>.</a> <a>second</a> g
--   </pre>
--   
--   <h4><b>Examples</b></h4>
--   
--   <pre>
--   &gt;&gt;&gt; bimap toUpper (+1) ('j', 3)
--   ('J',4)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; bimap toUpper (+1) (Left 'j')
--   Left 'J'
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; bimap toUpper (+1) (Right 3)
--   Right 4
--   </pre>
bimap :: Bifunctor p => a -> b -> c -> d -> p a c -> p b d

-- | Identity functor and monad. (a non-strict monad)
newtype Identity a
Identity :: a -> Identity a
[runIdentity] :: Identity a -> a

-- | The <a>Const</a> functor.
newtype Const a (b :: k) :: forall k. () => * -> k -> *
Const :: a -> Const a
[getConst] :: Const a -> a

-- | <a>&amp;</a> is a reverse application operator. This provides
--   notational convenience. Its precedence is one higher than that of the
--   forward application operator <a>$</a>, which allows <a>&amp;</a> to be
--   nested in <a>$</a>.
--   
--   <pre>
--   &gt;&gt;&gt; 5 &amp; (+1) &amp; show
--   "6"
--   </pre>
(&) :: () => a -> a -> b -> b
infixl 1 &

-- | Flipped version of <a>&lt;$&gt;</a>.
--   
--   <pre>
--   (<a>&lt;&amp;&gt;</a>) = <a>flip</a> <a>fmap</a>
--   </pre>
--   
--   <h4><b>Examples</b></h4>
--   
--   Apply <tt>(+1)</tt> to a list, a <a>Just</a> and a <a>Right</a>:
--   
--   <pre>
--   &gt;&gt;&gt; Just 2 &lt;&amp;&gt; (+1)
--   Just 3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [1,2,3] &lt;&amp;&gt; (+1)
--   [2,3,4]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Right 3 &lt;&amp;&gt; (+1)
--   Right 4
--   </pre>
(<&>) :: Functor f => f a -> a -> b -> f b
infixl 1 <&>
defaultFieldRules :: LensRules

-- | Generate overloaded field accessors based on field names which are
--   only prefixed with an underscore (e.g. <tt>_name</tt>), not
--   additionally with the type name (e.g. <tt>_fooName</tt>).
--   
--   This might be the desired behaviour in case the
--   <tt>DuplicateRecordFields</tt> language extension is used in order to
--   get rid of the necessity to prefix each field name with the type name.
--   
--   As an example:
--   
--   <pre>
--   data Foo a  = Foo { _x :: <a>Int</a>, _y :: a }
--   newtype Bar = Bar { _x :: <a>Char</a> }
--   makeFieldsNoPrefix ''Foo
--   makeFieldsNoPrefix ''Bar
--   </pre>
--   
--   will create classes
--   
--   <pre>
--   class HasX s a | s -&gt; a where
--     x :: Lens' s a
--   class HasY s a | s -&gt; a where
--     y :: Lens' s a
--   </pre>
--   
--   together with instances
--   
--   <pre>
--   instance HasX (Foo a) Int
--   instance HasY (Foo a) a where
--   instance HasX Bar Char where
--   </pre>
--   
--   For details, see <a>classUnderscoreNoPrefixFields</a>.
--   
--   <pre>
--   makeFieldsNoPrefix = <a>makeLensesWith</a> <a>classUnderscoreNoPrefixFields</a>
--   </pre>
makeFieldsNoPrefix :: Name -> DecsQ

-- | Generate overloaded field accessors.
--   
--   <i>e.g</i>
--   
--   <pre>
--   data Foo a = Foo { _fooX :: <a>Int</a>, _fooY :: a }
--   newtype Bar = Bar { _barX :: <a>Char</a> }
--   makeFields ''Foo
--   makeFields ''Bar
--   </pre>
--   
--   will create
--   
--   <pre>
--   _fooXLens :: Lens' (Foo a) Int
--   _fooYLens :: Lens (Foo a) (Foo b) a b
--   class HasX s a | s -&gt; a where
--     x :: Lens' s a
--   instance HasX (Foo a) Int where
--     x = _fooXLens
--   class HasY s a | s -&gt; a where
--     y :: Lens' s a
--   instance HasY (Foo a) a where
--     y = _fooYLens
--   _barXLens :: Iso' Bar Char
--   instance HasX Bar Char where
--     x = _barXLens
--   </pre>
--   
--   For details, see <a>camelCaseFields</a>.
--   
--   <pre>
--   makeFields = <a>makeLensesWith</a> <a>defaultFieldRules</a>
--   </pre>
makeFields :: Name -> DecsQ

-- | A <a>FieldNamer</a> for <a>abbreviatedFields</a>.
abbreviatedNamer :: FieldNamer

-- | Field rules fields in the form <tt> prefixFieldname or
--   _prefixFieldname </tt> If you want all fields to be lensed, then there
--   is no reason to use an <tt>_</tt> before the prefix. If any of the
--   record fields leads with an <tt>_</tt> then it is assume a field
--   without an <tt>_</tt> should not have a lens created.
--   
--   Note that <tt>prefix</tt> may be any string of characters that are not
--   uppercase letters. (In particular, it may be arbitrary string of
--   lowercase letters and numbers) This is the behavior that
--   <a>defaultFieldRules</a> had in lens 4.4 and earlier.
abbreviatedFields :: LensRules

-- | A <a>FieldNamer</a> for <a>classUnderscoreNoPrefixFields</a>.
classUnderscoreNoPrefixNamer :: FieldNamer

-- | Field rules for fields in the form <tt> _fieldname </tt> (the leading
--   underscore is mandatory).
--   
--   <b>Note</b>: The primary difference to <a>camelCaseFields</a> is that
--   for <tt>classUnderscoreNoPrefixFields</tt> the field names are not
--   expected to be prefixed with the type name. This might be the desired
--   behaviour when the <tt>DuplicateRecordFields</tt> extension is
--   enabled.
classUnderscoreNoPrefixFields :: LensRules

-- | A <a>FieldNamer</a> for <a>camelCaseFields</a>.
camelCaseNamer :: FieldNamer

-- | Field rules for fields in the form <tt> prefixFieldname or
--   _prefixFieldname </tt> If you want all fields to be lensed, then there
--   is no reason to use an <tt>_</tt> before the prefix. If any of the
--   record fields leads with an <tt>_</tt> then it is assume a field
--   without an <tt>_</tt> should not have a lens created.
--   
--   <b>Note</b>: The <tt>prefix</tt> must be the same as the typename
--   (with the first letter lowercased). This is a change from lens
--   versions before lens 4.5. If you want the old behaviour, use
--   <a>makeLensesWith</a> <a>abbreviatedFields</a>
camelCaseFields :: LensRules

-- | A <a>FieldNamer</a> for <a>underscoreFields</a>.
underscoreNamer :: FieldNamer

-- | Field rules for fields in the form <tt> _prefix_fieldname </tt>
underscoreFields :: LensRules

-- | Build <tt>Wrapped</tt> instance for a given newtype
makeWrapped :: Name -> DecsQ

-- | Declare lenses for each records in the given declarations, using the
--   specified <a>LensRules</a>. Any record syntax in the input will be
--   stripped off.
declareLensesWith :: LensRules -> DecsQ -> DecsQ

-- | <pre>
--   declareFields = <a>declareLensesWith</a> <a>defaultFieldRules</a>
--   </pre>
declareFields :: DecsQ -> DecsQ

-- | Build <a>Wrapped</a> instance for each newtype.
declareWrapped :: DecsQ -> DecsQ

-- | Generate a <a>Prism</a> for each constructor of each data type.
--   
--   <i>e.g.</i>
--   
--   <pre>
--   declarePrisms [d|
--     data Exp = Lit Int | Var String | Lambda{ bound::String, body::Exp }
--     |]
--   </pre>
--   
--   will create
--   
--   <pre>
--   data Exp = Lit Int | Var String | Lambda { bound::String, body::Exp }
--   _Lit :: <tt>Prism'</tt> Exp Int
--   _Var :: <tt>Prism'</tt> Exp String
--   _Lambda :: <tt>Prism'</tt> Exp (String, Exp)
--   </pre>
declarePrisms :: DecsQ -> DecsQ

-- | Similar to <a>makeClassyFor</a>, but takes a declaration quote.
declareClassyFor :: [(String, (String, String))] -> [(String, String)] -> DecsQ -> DecsQ

-- | For each record in the declaration quote, make lenses and traversals
--   for it, and create a class when the type has no arguments. All record
--   syntax in the input will be stripped off.
--   
--   <i>e.g.</i>
--   
--   <pre>
--   declareClassy [d|
--     data Foo = Foo { fooX, fooY :: <a>Int</a> }
--       deriving <a>Show</a>
--     |]
--   </pre>
--   
--   will create
--   
--   <pre>
--   data Foo = Foo <a>Int</a> <a>Int</a> deriving <a>Show</a>
--   class HasFoo t where
--     foo :: <a>Lens'</a> t Foo
--   instance HasFoo Foo where foo = <a>id</a>
--   fooX, fooY :: HasFoo t =&gt; <a>Lens'</a> t <a>Int</a>
--   </pre>
declareClassy :: DecsQ -> DecsQ

-- | Similar to <a>makeLensesFor</a>, but takes a declaration quote.
declareLensesFor :: [(String, String)] -> DecsQ -> DecsQ

-- | Make lenses for all records in the given declaration quote. All record
--   syntax in the input will be stripped off.
--   
--   <i>e.g.</i>
--   
--   <pre>
--   declareLenses [d|
--     data Foo = Foo { fooX, fooY :: <a>Int</a> }
--       deriving <a>Show</a>
--     |]
--   </pre>
--   
--   will create
--   
--   <pre>
--   data Foo = Foo <a>Int</a> <a>Int</a> deriving <a>Show</a>
--   fooX, fooY :: <a>Lens'</a> Foo Int
--   </pre>
declareLenses :: DecsQ -> DecsQ

-- | Build lenses with a custom configuration.
makeLensesWith :: LensRules -> Name -> DecsQ

-- | Derive lenses and traversals, using a named wrapper class, and
--   specifying explicit pairings of <tt>(fieldName, traversalName)</tt>.
--   
--   Example usage:
--   
--   <pre>
--   <a>makeClassyFor</a> "HasFoo" "foo" [("_foo", "fooLens"), ("bar", "lbar")] ''Foo
--   </pre>
makeClassyFor :: String -> String -> [(String, String)] -> Name -> DecsQ

-- | Derive lenses and traversals, specifying explicit pairings of
--   <tt>(fieldName, lensName)</tt>.
--   
--   If you map multiple names to the same label, and it is present in the
--   same constructor then this will generate a <a>Traversal</a>.
--   
--   <i>e.g.</i>
--   
--   <pre>
--   <a>makeLensesFor</a> [("_foo", "fooLens"), ("baz", "lbaz")] ''Foo
--   <a>makeLensesFor</a> [("_barX", "bar"), ("_barY", "bar")] ''Bar
--   </pre>
makeLensesFor :: [(String, String)] -> Name -> DecsQ

-- | Make lenses and traversals for a type, and create a class when the
--   type has no arguments. Works the same as <a>makeClassy</a> except that
--   (a) it expects that record field names do not begin with an
--   underscore, (b) all record fields are made into lenses, and (c) the
--   resulting lens is prefixed with an underscore.
makeClassy_ :: Name -> DecsQ

-- | Make lenses and traversals for a type, and create a class when the
--   type has no arguments.
--   
--   <i>e.g.</i>
--   
--   <pre>
--   data Foo = Foo { _fooX, _fooY :: <a>Int</a> }
--   <a>makeClassy</a> ''Foo
--   </pre>
--   
--   will create
--   
--   <pre>
--   class HasFoo t where
--     foo :: <a>Lens'</a> t Foo
--     fooX :: <a>Lens'</a> t <a>Int</a>
--     fooX = foo . go where go f (Foo x y) = (\x' -&gt; Foo x' y) &lt;$&gt; f x
--     fooY :: <a>Lens'</a> t <a>Int</a>
--     fooY = foo . go where go f (Foo x y) = (\y' -&gt; Foo x y') &lt;$&gt; f y
--   instance HasFoo Foo where
--     foo = id
--   </pre>
--   
--   <pre>
--   <a>makeClassy</a> = <a>makeLensesWith</a> <a>classyRules</a>
--   </pre>
makeClassy :: Name -> DecsQ

-- | Build lenses (and traversals) with a sensible default configuration.
--   
--   <i>e.g.</i>
--   
--   <pre>
--   data FooBar
--     = Foo { _x, _y :: <a>Int</a> }
--     | Bar { _x :: <a>Int</a> }
--   <a>makeLenses</a> ''FooBar
--   </pre>
--   
--   will create
--   
--   <pre>
--   x :: <a>Lens'</a> FooBar <a>Int</a>
--   x f (Foo a b) = (\a' -&gt; Foo a' b) &lt;$&gt; f a
--   x f (Bar a)   = Bar &lt;$&gt; f a
--   y :: <a>Traversal'</a> FooBar <a>Int</a>
--   y f (Foo a b) = (\b' -&gt; Foo a  b') &lt;$&gt; f b
--   y _ c@(Bar _) = pure c
--   </pre>
--   
--   <pre>
--   <a>makeLenses</a> = <a>makeLensesWith</a> <a>lensRules</a>
--   </pre>
makeLenses :: Name -> DecsQ

-- | A <a>LensRules</a> used by <a>makeClassy_</a>.
classyRules_ :: LensRules

-- | Rules for making lenses and traversals that precompose another
--   <a>Lens</a>.
classyRules :: LensRules

-- | Create a <a>FieldNamer</a> from a mapping function. If the function
--   returns <tt>[]</tt>, it creates no lens for the field.
mappingNamer :: String -> [String] -> FieldNamer

-- | Create a <a>FieldNamer</a> from explicit pairings of <tt>(fieldName,
--   lensName)</tt>.
lookingupNamer :: [(String, String)] -> FieldNamer

-- | Construct a <a>LensRules</a> value for generating top-level
--   definitions using the given map from field names to definition names.
lensRulesFor :: [(String, String)] -> LensRules

-- | A <a>FieldNamer</a> that strips the _ off of the field name,
--   lowercases the name, and skips the field if it doesn't start with an
--   '_'.
underscoreNoPrefixNamer :: FieldNamer

-- | Rules for making fairly simple partial lenses, ignoring the special
--   cases for isomorphisms and traversals, and not making any classes. It
--   uses <a>underscoreNoPrefixNamer</a>.
lensRules :: LensRules

-- | <a>Lens'</a> to access the option for naming "classy" lenses.
lensClass :: Lens' LensRules ClassyNamer

-- | <a>Lens'</a> to access the convention for naming fields in our
--   <a>LensRules</a>.
lensField :: Lens' LensRules FieldNamer

-- | Create the class if the constructor is <a>Simple</a> and the
--   <a>lensClass</a> rule matches.
createClass :: Lens' LensRules Bool

-- | Generate optics using lazy pattern matches. This can allow fields of
--   an undefined value to be initialized with lenses:
--   
--   <pre>
--   data Foo = Foo {_x :: Int, _y :: Bool}
--     deriving Show
--   
--   <a>makeLensesWith</a> (<a>lensRules</a> &amp; <a>generateLazyPatterns</a> .~ True) ''Foo
--   </pre>
--   
--   <pre>
--   &gt; undefined &amp; x .~ 8 &amp; y .~ True
--   Foo {_x = 8, _y = True}
--   </pre>
--   
--   The downside of this flag is that it can lead to space-leaks and
--   code-size/compile-time increases when generated for large records. By
--   default this flag is turned off, and strict optics are generated.
--   
--   When using lazy optics the strict optic can be recovered by composing
--   with <a>$!</a>:
--   
--   <pre>
--   strictOptic = ($!) . lazyOptic
--   </pre>
generateLazyPatterns :: Lens' LensRules Bool

-- | Generate "updateable" optics when <a>True</a>. When <a>False</a>,
--   <a>Fold</a>s will be generated instead of <a>Traversal</a>s and
--   <a>Getter</a>s will be generated instead of <a>Lens</a>es. This mode
--   is intended to be used for types with invariants which must be
--   maintained by "smart" constructors.
generateUpdateableOptics :: Lens' LensRules Bool

-- | Indicate whether or not to supply the signatures for the generated
--   lenses.
--   
--   Disabling this can be useful if you want to provide a more restricted
--   type signature or if you want to supply hand-written haddocks.
generateSignatures :: Lens' LensRules Bool

-- | Generate "simple" optics even when type-changing optics are possible.
--   (e.g. <a>Lens'</a> instead of <a>Lens</a>)
simpleLenses :: Lens' LensRules Bool

-- | Rules to construct lenses for data fields.
data LensRules

-- | The rule to create function names of lenses for data fields.
--   
--   Although it's sometimes useful, you won't need the first two arguments
--   most of the time.
type FieldNamer = Name -> [Name] -> Name -> [DefName]

-- | Name to give to generated field optics.
data DefName

-- | Simple top-level definiton name
TopName :: Name -> DefName

-- | makeFields-style class name and method name
MethodName :: Name -> Name -> DefName

-- | The optional rule to create a class and method around a monomorphic
--   data type. If this naming convention is provided, it generates a
--   "classy" lens.
type ClassyNamer = Name -> Maybe (Name, Name)

-- | Generate a <tt>Prism</tt> for each constructor of a data type and
--   combine them into a single class. No Isos are created. Reviews are
--   created for constructors with existentially quantified constructors
--   and GADTs.
--   
--   <i>e.g.</i>
--   
--   <pre>
--   data FooBarBaz a
--     = Foo Int
--     | Bar a
--     | Baz Int Char
--   makeClassyPrisms ''FooBarBaz
--   </pre>
--   
--   will create
--   
--   <pre>
--   class AsFooBarBaz s a | s -&gt; a where
--     _FooBarBaz :: Prism' s (FooBarBaz a)
--     _Foo :: Prism' s Int
--     _Bar :: Prism' s a
--     _Baz :: Prism' s (Int,Char)
--   
--     _Foo = _FooBarBaz . _Foo
--     _Bar = _FooBarBaz . _Bar
--     _Baz = _FooBarBaz . _Baz
--   
--   instance AsFooBarBaz (FooBarBaz a) a
--   </pre>
--   
--   Generate an <a>As</a> class of prisms. Names are selected by prefixing
--   the constructor name with an underscore. Constructors with multiple
--   fields will construct Prisms to tuples of those fields.
makeClassyPrisms :: Name -> DecsQ

-- | Generate a <tt>Prism</tt> for each constructor of a data type. Isos
--   generated when possible. Reviews are created for constructors with
--   existentially quantified constructors and GADTs.
--   
--   <i>e.g.</i>
--   
--   <pre>
--   data FooBarBaz a
--     = Foo Int
--     | Bar a
--     | Baz Int Char
--   makePrisms ''FooBarBaz
--   </pre>
--   
--   will create
--   
--   <pre>
--   _Foo :: Prism' (FooBarBaz a) Int
--   _Bar :: Prism (FooBarBaz a) (FooBarBaz b) a b
--   _Baz :: Prism' (FooBarBaz a) (Int, Char)
--   </pre>
makePrisms :: Name -> DecsQ

-- | An indexed version of <a>at</a>.
--   
--   <pre>
--   &gt;&gt;&gt; Map.fromList [(1,"world")] ^@. iat 1
--   (1,Just "world")
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; iat 1 %@~ (\i x -&gt; if odd i then Just "hello" else Nothing) $ Map.empty
--   fromList [(1,"hello")]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; iat 2 %@~ (\i x -&gt; if odd i then Just "hello" else Nothing) $ Map.empty
--   fromList []
--   </pre>
iat :: At m => Index m -> IndexedLens' Index m m Maybe IxValue m

-- | Delete the value associated with a key in a <a>Map</a>-like container
--   
--   <pre>
--   <a>sans</a> k = <a>at</a> k .~ Nothing
--   </pre>
sans :: At m => Index m -> m -> m

-- | A definition of <a>ix</a> for types with an <a>At</a> instance. This
--   is the default if you don't specify a definition for <a>ix</a>.
ixAt :: At m => Index m -> Traversal' m IxValue m

-- | An indexed version of <a>ix</a>.
--   
--   <pre>
--   &gt;&gt;&gt; Seq.fromList [a,b,c,d] &amp; iix 2 %@~ f'
--   fromList [a,b,f' 2 c,d]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Seq.fromList [a,b,c,d] &amp; iix 2 .@~ h
--   fromList [a,b,h 2,d]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Seq.fromList [a,b,c,d] ^@? iix 2
--   Just (2,c)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Seq.fromList [] ^@? iix 2
--   Nothing
--   </pre>
iix :: Ixed m => Index m -> IndexedTraversal' Index m m IxValue m

-- | An indexed version of <a>contains</a>.
--   
--   <pre>
--   &gt;&gt;&gt; IntSet.fromList [1,2,3,4] ^@. icontains 3
--   (3,True)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; IntSet.fromList [1,2,3,4] ^@. icontains 5
--   (5,False)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; IntSet.fromList [1,2,3,4] &amp; icontains 3 %@~ \i x -&gt; if odd i then not x else x
--   fromList [1,2,4]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; IntSet.fromList [1,2,3,4] &amp; icontains 3 %@~ \i x -&gt; if even i then not x else x
--   fromList [1,2,3,4]
--   </pre>
icontains :: Contains m => Index m -> IndexedLens' Index m m Bool

-- | This class provides a simple <a>Lens</a> that lets you view (and
--   modify) information about whether or not a container contains a given
--   <a>Index</a>.
class Contains m

-- | <pre>
--   &gt;&gt;&gt; IntSet.fromList [1,2,3,4] ^. contains 3
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; IntSet.fromList [1,2,3,4] ^. contains 5
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; IntSet.fromList [1,2,3,4] &amp; contains 3 .~ False
--   fromList [1,2,4]
--   </pre>
contains :: Contains m => Index m -> Lens' m Bool

-- | This provides a common notion of a value at an index that is shared by
--   both <a>Ixed</a> and <a>At</a>.

-- | Provides a simple <a>Traversal</a> lets you <a>traverse</a> the value
--   at a given key in a <a>Map</a> or element at an ordinal position in a
--   list or <a>Seq</a>.
class Ixed m

-- | <i>NB:</i> Setting the value of this <a>Traversal</a> will only set
--   the value in <a>at</a> if it is already present.
--   
--   If you want to be able to insert <i>missing</i> values, you want
--   <a>at</a>.
--   
--   <pre>
--   &gt;&gt;&gt; Seq.fromList [a,b,c,d] &amp; ix 2 %~ f
--   fromList [a,b,f c,d]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Seq.fromList [a,b,c,d] &amp; ix 2 .~ e
--   fromList [a,b,e,d]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Seq.fromList [a,b,c,d] ^? ix 2
--   Just c
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Seq.fromList [] ^? ix 2
--   Nothing
--   </pre>
ix :: Ixed m => Index m -> Traversal' m IxValue m

-- | <a>At</a> provides a <a>Lens</a> that can be used to read, write or
--   delete the value associated with a key in a <a>Map</a>-like container
--   on an ad hoc basis.
--   
--   An instance of <a>At</a> should satisfy:
--   
--   <pre>
--   <a>ix</a> k ≡ <a>at</a> k <a>.</a> <a>traverse</a>
--   </pre>
class Ixed m => At m

-- | <pre>
--   &gt;&gt;&gt; Map.fromList [(1,"world")] ^.at 1
--   Just "world"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; at 1 ?~ "hello" $ Map.empty
--   fromList [(1,"hello")]
--   </pre>
--   
--   <i>Note:</i> <a>Map</a>-like containers form a reasonable instance,
--   but not <a>Array</a>-like ones, where you cannot satisfy the
--   <a>Lens</a> laws.
at :: At m => Index m -> Lens' m Maybe IxValue m

-- | Extract <a>each</a> element of a (potentially monomorphic) container.
--   
--   Notably, when applied to a tuple, this generalizes <a>both</a> to
--   arbitrary homogeneous tuples.
--   
--   <pre>
--   &gt;&gt;&gt; (1,2,3) &amp; each *~ 10
--   (10,20,30)
--   </pre>
--   
--   It can also be used on monomorphic containers like <a>Text</a> or
--   <a>ByteString</a>.
--   
--   <pre>
--   &gt;&gt;&gt; over each Char.toUpper ("hello"^.Text.packed)
--   "HELLO"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; ("hello","world") &amp; each.each %~ Char.toUpper
--   ("HELLO","WORLD")
--   </pre>
class Each s t a b | s -> a, t -> b, s b -> t, t a -> s
each :: Each s t a b => Traversal s t a b

-- | Implement <a>plate</a> operation for a type using its <a>Generic</a>
--   instance.
gplate :: (Generic a, GPlated a Rep a) => Traversal' a a

-- | The original <tt>uniplate</tt> combinator, implemented in terms of
--   <a>Plated</a> as a <a>Lens</a>.
--   
--   <pre>
--   <a>parts</a> ≡ <a>partsOf</a> <a>plate</a>
--   </pre>
--   
--   The resulting <a>Lens</a> is safer to use as it ignores
--   'over-application' and deals gracefully with under-application, but it
--   is only a proper <a>Lens</a> if you don't change the list
--   <a>length</a>!
parts :: Plated a => Lens' a [a]

-- | Fold the immediate children of a <a>Plated</a> container.
--   
--   <pre>
--   <a>composOpFold</a> z c f = <a>foldrOf</a> <a>plate</a> (c <a>.</a> f) z
--   </pre>
composOpFold :: Plated a => b -> b -> b -> b -> a -> b -> a -> b

-- | Perform a fold-like computation on each value, technically a
--   paramorphism.
--   
--   <pre>
--   <a>para</a> ≡ <a>paraOf</a> <a>plate</a>
--   </pre>
para :: Plated a => a -> [r] -> r -> a -> r

-- | Perform a fold-like computation on each value, technically a
--   paramorphism.
--   
--   <pre>
--   <a>paraOf</a> :: <a>Fold</a> a a -&gt; (a -&gt; [r] -&gt; r) -&gt; a -&gt; r
--   </pre>
paraOf :: () => Getting Endo [a] a a -> a -> [r] -> r -> a -> r

-- | Extract one level of <a>holes</a> from a container in a region
--   specified by one <a>Traversal</a>, using another.
--   
--   <pre>
--   <a>holesOnOf</a> b l ≡ <a>holesOf</a> (b <a>.</a> l)
--   </pre>
--   
--   <pre>
--   <a>holesOnOf</a> :: <a>Iso'</a> s a       -&gt; <a>Iso'</a> a a                -&gt; s -&gt; [<a>Pretext</a> (-&gt;) a a s]
--   <a>holesOnOf</a> :: <a>Lens'</a> s a      -&gt; <a>Lens'</a> a a               -&gt; s -&gt; [<a>Pretext</a> (-&gt;) a a s]
--   <a>holesOnOf</a> :: <a>Traversal'</a> s a -&gt; <a>Traversal'</a> a a          -&gt; s -&gt; [<a>Pretext</a> (-&gt;) a a s]
--   <a>holesOnOf</a> :: <a>Lens'</a> s a      -&gt; <a>IndexedLens'</a> i a a      -&gt; s -&gt; [<a>Pretext</a> (<a>Indexed</a> i) a a s]
--   <a>holesOnOf</a> :: <a>Traversal'</a> s a -&gt; <a>IndexedTraversal'</a> i a a -&gt; s -&gt; [<a>Pretext</a> (<a>Indexed</a> i) a a s]
--   </pre>
holesOnOf :: Conjoined p => LensLike Bazaar p r r s t a b -> Over p Bazaar p r r a b r r -> s -> [Pretext p r r t]

-- | An alias for <a>holesOf</a>, provided for consistency with the other
--   combinators.
--   
--   <pre>
--   <a>holesOn</a> ≡ <a>holesOf</a>
--   </pre>
--   
--   <pre>
--   <a>holesOn</a> :: <a>Iso'</a> s a                -&gt; s -&gt; [<a>Pretext</a> (-&gt;) a a s]
--   <a>holesOn</a> :: <a>Lens'</a> s a               -&gt; s -&gt; [<a>Pretext</a> (-&gt;) a a s]
--   <a>holesOn</a> :: <a>Traversal'</a> s a          -&gt; s -&gt; [<a>Pretext</a> (-&gt;) a a s]
--   <a>holesOn</a> :: <a>IndexedLens'</a> i s a      -&gt; s -&gt; [<a>Pretext</a> (<a>Indexed</a> i) a a s]
--   <a>holesOn</a> :: <a>IndexedTraversal'</a> i s a -&gt; s -&gt; [<a>Pretext</a> (<a>Indexed</a> i) a a s]
--   </pre>
holesOn :: Conjoined p => Over p Bazaar p a a s t a a -> s -> [Pretext p a a t]

-- | The one-level version of <a>context</a>. This extracts a list of the
--   immediate children as editable contexts.
--   
--   Given a context you can use <a>pos</a> to see the values, <a>peek</a>
--   at what the structure would be like with an edited result, or simply
--   <a>extract</a> the original structure.
--   
--   <pre>
--   propChildren x = <a>children</a> l x <a>==</a> <a>map</a> <a>pos</a> (<a>holes</a> l x)
--   propId x = <a>all</a> (<a>==</a> x) [<a>extract</a> w | w &lt;- <a>holes</a> l x]
--   </pre>
--   
--   <pre>
--   <a>holes</a> = <a>holesOf</a> <a>plate</a>
--   </pre>
holes :: Plated a => a -> [Pretext ((->) :: * -> * -> *) a a a]

-- | Return a list of all of the editable contexts for every location in
--   the structure in an areas indicated by a user supplied
--   <a>Traversal</a>, recursively using another user-supplied
--   <a>Traversal</a> to walk each layer.
--   
--   <pre>
--   <a>contextsOnOf</a> :: <a>Traversal'</a> s a -&gt; <a>Traversal'</a> a a -&gt; s -&gt; [<a>Context</a> a a s]
--   </pre>
contextsOnOf :: () => ATraversal s t a a -> ATraversal' a a -> s -> [Context a a t]

-- | Return a list of all of the editable contexts for every location in
--   the structure in an areas indicated by a user supplied
--   <a>Traversal</a>, recursively using <a>plate</a>.
--   
--   <pre>
--   <a>contextsOn</a> b ≡ <a>contextsOnOf</a> b <a>plate</a>
--   </pre>
--   
--   <pre>
--   <a>contextsOn</a> :: <a>Plated</a> a =&gt; <a>Traversal'</a> s a -&gt; s -&gt; [<a>Context</a> a a s]
--   </pre>
contextsOn :: Plated a => ATraversal s t a a -> s -> [Context a a t]

-- | Return a list of all of the editable contexts for every location in
--   the structure, recursively, using a user-specified <a>Traversal</a> to
--   walk each layer.
--   
--   <pre>
--   propUniverse l x = <a>universeOf</a> l x <a>==</a> <a>map</a> <a>pos</a> (<a>contextsOf</a> l x)
--   propId l x = <a>all</a> (<a>==</a> x) [<a>extract</a> w | w &lt;- <a>contextsOf</a> l x]
--   </pre>
--   
--   <pre>
--   <a>contextsOf</a> :: <a>Traversal'</a> a a -&gt; a -&gt; [<a>Context</a> a a a]
--   </pre>
contextsOf :: () => ATraversal' a a -> a -> [Context a a a]

-- | Return a list of all of the editable contexts for every location in
--   the structure, recursively.
--   
--   <pre>
--   propUniverse x = <a>universe</a> x <a>==</a> <a>map</a> <a>pos</a> (<a>contexts</a> x)
--   propId x = <a>all</a> (<a>==</a> x) [<a>extract</a> w | w &lt;- <a>contexts</a> x]
--   </pre>
--   
--   <pre>
--   <a>contexts</a> ≡ <a>contextsOf</a> <a>plate</a>
--   </pre>
contexts :: Plated a => a -> [Context a a a]

-- | Transform every element in a tree that lies in a region indicated by a
--   supplied <a>Traversal</a>, walking with a user supplied
--   <a>Traversal</a> in a bottom-up manner with a monadic effect.
--   
--   <pre>
--   <a>transformMOnOf</a> :: <a>Monad</a> m =&gt; <a>Traversal'</a> s a -&gt; <a>Traversal'</a> a a -&gt; (a -&gt; m a) -&gt; s -&gt; m s
--   </pre>
transformMOnOf :: Monad m => LensLike WrappedMonad m s t a b -> LensLike WrappedMonad m a b a b -> b -> m b -> s -> m t

-- | Transform every element in a tree using a user supplied
--   <a>Traversal</a> in a bottom-up manner with a monadic effect.
--   
--   <pre>
--   <a>transformMOf</a> :: <a>Monad</a> m =&gt; <a>Traversal'</a> a a -&gt; (a -&gt; m a) -&gt; a -&gt; m a
--   </pre>
transformMOf :: Monad m => LensLike WrappedMonad m a b a b -> b -> m b -> a -> m b

-- | Transform every element in the tree in a region indicated by a
--   supplied <a>Traversal</a>, in a bottom-up manner, monadically.
--   
--   <pre>
--   <a>transformMOn</a> :: (<a>Monad</a> m, <a>Plated</a> a) =&gt; <a>Traversal'</a> s a -&gt; (a -&gt; m a) -&gt; s -&gt; m s
--   </pre>
transformMOn :: (Monad m, Plated a) => LensLike WrappedMonad m s t a a -> a -> m a -> s -> m t

-- | Transform every element in the tree, in a bottom-up manner,
--   monadically.
transformM :: (Monad m, Plated a) => a -> m a -> a -> m a

-- | Transform every element in a region indicated by a <a>Setter</a> by
--   recursively applying another <a>Setter</a> in a bottom-up manner.
--   
--   <pre>
--   <a>transformOnOf</a> :: <a>Setter'</a> s a -&gt; <a>Traversal'</a> a a -&gt; (a -&gt; a) -&gt; s -&gt; s
--   <a>transformOnOf</a> :: <a>Setter'</a> s a -&gt; <a>Setter'</a> a a    -&gt; (a -&gt; a) -&gt; s -&gt; s
--   </pre>
transformOnOf :: () => ASetter s t a b -> ASetter a b a b -> b -> b -> s -> t

-- | Transform every element by recursively applying a given <a>Setter</a>
--   in a bottom-up manner.
--   
--   <pre>
--   <a>transformOf</a> :: <a>Traversal'</a> a a -&gt; (a -&gt; a) -&gt; a -&gt; a
--   <a>transformOf</a> :: <a>Setter'</a> a a    -&gt; (a -&gt; a) -&gt; a -&gt; a
--   </pre>
transformOf :: () => ASetter a b a b -> b -> b -> a -> b

-- | Transform every element in the tree in a bottom-up manner over a
--   region indicated by a <a>Setter</a>.
--   
--   <pre>
--   <a>transformOn</a> :: <a>Plated</a> a =&gt; <a>Traversal'</a> s a -&gt; (a -&gt; a) -&gt; s -&gt; s
--   <a>transformOn</a> :: <a>Plated</a> a =&gt; <a>Setter'</a> s a    -&gt; (a -&gt; a) -&gt; s -&gt; s
--   </pre>
transformOn :: Plated a => ASetter s t a a -> a -> a -> s -> t

-- | Transform every element in the tree, in a bottom-up manner.
--   
--   For example, replacing negative literals with literals:
--   
--   <pre>
--   negLits = <a>transform</a> $ \x -&gt; case x of
--     Neg (Lit i) -&gt; Lit (<a>negate</a> i)
--     _           -&gt; x
--   </pre>
transform :: Plated a => a -> a -> a -> a

-- | Given a <a>Fold</a> that knows how to locate immediate children, fold
--   all of the transitive descendants of a node, including itself that lie
--   in a region indicated by another <a>Fold</a>.
--   
--   <pre>
--   <a>cosmosOnOf</a> :: <a>Fold</a> s a -&gt; <a>Fold</a> a a -&gt; <a>Fold</a> s a
--   </pre>
cosmosOnOf :: (Applicative f, Contravariant f) => LensLike' f s a -> LensLike' f a a -> LensLike' f s a

-- | Given a <a>Fold</a> that knows how to find <a>Plated</a> parts of a
--   container fold them and all of their descendants, recursively.
--   
--   <pre>
--   <a>cosmosOn</a> :: <a>Plated</a> a =&gt; <a>Fold</a> s a -&gt; <a>Fold</a> s a
--   </pre>
cosmosOn :: (Applicative f, Contravariant f, Plated a) => LensLike' f s a -> LensLike' f s a

-- | Given a <a>Fold</a> that knows how to locate immediate children, fold
--   all of the transitive descendants of a node, including itself.
--   
--   <pre>
--   <a>cosmosOf</a> :: <a>Fold</a> a a -&gt; <a>Fold</a> a a
--   </pre>
cosmosOf :: (Applicative f, Contravariant f) => LensLike' f a a -> LensLike' f a a

-- | Fold over all transitive descendants of a <a>Plated</a> container,
--   including itself.
cosmos :: Plated a => Fold a a

-- | Given a <a>Fold</a> that knows how to locate immediate children,
--   retrieve all of the transitive descendants of a node, including itself
--   that lie in a region indicated by another <a>Fold</a>.
--   
--   <pre>
--   <a>toListOf</a> l ≡ <a>universeOnOf</a> l <a>ignored</a>
--   </pre>
universeOnOf :: () => Getting [a] s a -> Getting [a] a a -> s -> [a]

-- | Given a <a>Fold</a> that knows how to find <a>Plated</a> parts of a
--   container retrieve them and all of their descendants, recursively.
universeOn :: Plated a => Getting [a] s a -> s -> [a]

-- | Given a <a>Fold</a> that knows how to locate immediate children,
--   retrieve all of the transitive descendants of a node, including
--   itself.
--   
--   <pre>
--   <a>universeOf</a> :: <a>Fold</a> a a -&gt; a -&gt; [a]
--   </pre>
universeOf :: () => Getting [a] a a -> a -> [a]

-- | Retrieve all of the transitive descendants of a <a>Plated</a>
--   container, including itself.
universe :: Plated a => a -> [a]

-- | Rewrite by applying a monadic rule everywhere inside of a structure
--   located by a user-specified <a>Traversal</a>, using a user-specified
--   <a>Traversal</a> for recursion. Ensures that the rule cannot be
--   applied anywhere in the result.
rewriteMOnOf :: Monad m => LensLike WrappedMonad m s t a b -> LensLike WrappedMonad m a b a b -> b -> m Maybe a -> s -> m t

-- | Rewrite by applying a monadic rule everywhere inside of a structure
--   located by a user-specified <a>Traversal</a>. Ensures that the rule
--   cannot be applied anywhere in the result.
rewriteMOn :: (Monad m, Plated a) => LensLike WrappedMonad m s t a a -> a -> m Maybe a -> s -> m t

-- | Rewrite by applying a monadic rule everywhere you recursing with a
--   user-specified <a>Traversal</a>. Ensures that the rule cannot be
--   applied anywhere in the result.
rewriteMOf :: Monad m => LensLike WrappedMonad m a b a b -> b -> m Maybe a -> a -> m b

-- | Rewrite by applying a monadic rule everywhere you can. Ensures that
--   the rule cannot be applied anywhere in the result.
rewriteM :: (Monad m, Plated a) => a -> m Maybe a -> a -> m a

-- | Rewrite recursively over part of a larger structure using a specified
--   <a>Setter</a>.
--   
--   <pre>
--   <a>rewriteOnOf</a> :: <a>Iso'</a> s a       -&gt; <a>Iso'</a> a a       -&gt; (a -&gt; <a>Maybe</a> a) -&gt; s -&gt; s
--   <a>rewriteOnOf</a> :: <a>Lens'</a> s a      -&gt; <a>Lens'</a> a a      -&gt; (a -&gt; <a>Maybe</a> a) -&gt; s -&gt; s
--   <a>rewriteOnOf</a> :: <a>Traversal'</a> s a -&gt; <a>Traversal'</a> a a -&gt; (a -&gt; <a>Maybe</a> a) -&gt; s -&gt; s
--   <a>rewriteOnOf</a> :: <a>Setter'</a> s a    -&gt; <a>Setter'</a> a a    -&gt; (a -&gt; <a>Maybe</a> a) -&gt; s -&gt; s
--   </pre>
rewriteOnOf :: () => ASetter s t a b -> ASetter a b a b -> b -> Maybe a -> s -> t

-- | Rewrite recursively over part of a larger structure.
--   
--   <pre>
--   <a>rewriteOn</a> :: <a>Plated</a> a =&gt; <a>Iso'</a> s a       -&gt; (a -&gt; <a>Maybe</a> a) -&gt; s -&gt; s
--   <a>rewriteOn</a> :: <a>Plated</a> a =&gt; <a>Lens'</a> s a      -&gt; (a -&gt; <a>Maybe</a> a) -&gt; s -&gt; s
--   <a>rewriteOn</a> :: <a>Plated</a> a =&gt; <a>Traversal'</a> s a -&gt; (a -&gt; <a>Maybe</a> a) -&gt; s -&gt; s
--   <a>rewriteOn</a> :: <a>Plated</a> a =&gt; <a>ASetter'</a> s a   -&gt; (a -&gt; <a>Maybe</a> a) -&gt; s -&gt; s
--   </pre>
rewriteOn :: Plated a => ASetter s t a a -> a -> Maybe a -> s -> t

-- | Rewrite by applying a rule everywhere you can. Ensures that the rule
--   cannot be applied anywhere in the result:
--   
--   <pre>
--   propRewriteOf l r x = <a>all</a> (<a>isNothing</a> <a>.</a> r) (<a>universeOf</a> l (<a>rewriteOf</a> l r x))
--   </pre>
--   
--   Usually <a>transformOf</a> is more appropriate, but <a>rewriteOf</a>
--   can give better compositionality. Given two single transformations
--   <tt>f</tt> and <tt>g</tt>, you can construct <tt>a -&gt; f a
--   <tt>mplus</tt> g a</tt> which performs both rewrites until a fixed
--   point.
--   
--   <pre>
--   <a>rewriteOf</a> :: <a>Iso'</a> a a       -&gt; (a -&gt; <a>Maybe</a> a) -&gt; a -&gt; a
--   <a>rewriteOf</a> :: <a>Lens'</a> a a      -&gt; (a -&gt; <a>Maybe</a> a) -&gt; a -&gt; a
--   <a>rewriteOf</a> :: <a>Traversal'</a> a a -&gt; (a -&gt; <a>Maybe</a> a) -&gt; a -&gt; a
--   <a>rewriteOf</a> :: <a>Setter'</a> a a    -&gt; (a -&gt; <a>Maybe</a> a) -&gt; a -&gt; a
--   </pre>
rewriteOf :: () => ASetter a b a b -> b -> Maybe a -> a -> b

-- | Rewrite by applying a rule everywhere you can. Ensures that the rule
--   cannot be applied anywhere in the result:
--   
--   <pre>
--   propRewrite r x = <a>all</a> (<a>isNothing</a> <a>.</a> r) (<a>universe</a> (<a>rewrite</a> r x))
--   </pre>
--   
--   Usually <a>transform</a> is more appropriate, but <a>rewrite</a> can
--   give better compositionality. Given two single transformations
--   <tt>f</tt> and <tt>g</tt>, you can construct <tt>a -&gt; f a
--   <tt>mplus</tt> g a</tt> which performs both rewrites until a fixed
--   point.
rewrite :: Plated a => a -> Maybe a -> a -> a

-- | Extract the immediate descendants of a <a>Plated</a> container.
--   
--   <pre>
--   <a>children</a> ≡ <a>toListOf</a> <a>plate</a>
--   </pre>
children :: Plated a => a -> [a]

-- | Try to apply a traversal to all transitive descendants of a
--   <a>Plated</a> container, but do not recurse through matching
--   descendants.
--   
--   <pre>
--   <a>deep</a> :: <a>Plated</a> s =&gt; <a>Fold</a> s a                 -&gt; <a>Fold</a> s a
--   <a>deep</a> :: <a>Plated</a> s =&gt; <a>IndexedFold</a> s a          -&gt; <a>IndexedFold</a> s a
--   <a>deep</a> :: <a>Plated</a> s =&gt; <a>Traversal</a> s s a b        -&gt; <a>Traversal</a> s s a b
--   <a>deep</a> :: <a>Plated</a> s =&gt; <a>IndexedTraversal</a> s s a b -&gt; <a>IndexedTraversal</a> s s a b
--   </pre>
deep :: (Conjoined p, Applicative f, Plated s) => Traversing p f s s a b -> Over p f s s a b

-- | Compose through a plate
(...) :: (Applicative f, Plated c) => LensLike f s t c c -> Over p f c c a b -> Over p f s t a b
infixr 9 ...

-- | A <a>Plated</a> type is one where we know how to extract its immediate
--   self-similar children.
--   
--   <i>Example 1</i>:
--   
--   <pre>
--   import Control.Applicative
--   import Control.Lens
--   import Control.Lens.Plated
--   import Data.Data
--   import Data.Data.Lens (<a>uniplate</a>)
--   </pre>
--   
--   <pre>
--   data Expr
--     = Val <a>Int</a>
--     | Neg Expr
--     | Add Expr Expr
--     deriving (<a>Eq</a>,<a>Ord</a>,<a>Show</a>,<a>Read</a>,<a>Data</a>,<a>Typeable</a>)
--   </pre>
--   
--   <pre>
--   instance <a>Plated</a> Expr where
--     <a>plate</a> f (Neg e) = Neg <a>&lt;$&gt;</a> f e
--     <a>plate</a> f (Add a b) = Add <a>&lt;$&gt;</a> f a <a>&lt;*&gt;</a> f b
--     <a>plate</a> _ a = <a>pure</a> a
--   </pre>
--   
--   <i>or</i>
--   
--   <pre>
--   instance <a>Plated</a> Expr where
--     <a>plate</a> = <a>uniplate</a>
--   </pre>
--   
--   <i>Example 2</i>:
--   
--   <pre>
--   import Control.Applicative
--   import Control.Lens
--   import Control.Lens.Plated
--   import Data.Data
--   import Data.Data.Lens (<a>uniplate</a>)
--   </pre>
--   
--   <pre>
--   data Tree a
--     = Bin (Tree a) (Tree a)
--     | Tip a
--     deriving (<a>Eq</a>,<a>Ord</a>,<a>Show</a>,<a>Read</a>,<a>Data</a>,<a>Typeable</a>)
--   </pre>
--   
--   <pre>
--   instance <a>Plated</a> (Tree a) where
--     <a>plate</a> f (Bin l r) = Bin <a>&lt;$&gt;</a> f l <a>&lt;*&gt;</a> f r
--     <a>plate</a> _ t = <a>pure</a> t
--   </pre>
--   
--   <i>or</i>
--   
--   <pre>
--   instance <a>Data</a> a =&gt; <a>Plated</a> (Tree a) where
--     <a>plate</a> = <a>uniplate</a>
--   </pre>
--   
--   Note the big distinction between these two implementations.
--   
--   The former will only treat children directly in this tree as
--   descendents, the latter will treat trees contained in the values under
--   the tips also as descendants!
--   
--   When in doubt, pick a <a>Traversal</a> and just use the various
--   <tt>...Of</tt> combinators rather than pollute <a>Plated</a> with
--   orphan instances!
--   
--   If you want to find something unplated and non-recursive with
--   <a>biplate</a> use the <tt>...OnOf</tt> variant with <a>ignored</a>,
--   though those usecases are much better served in most cases by using
--   the existing <a>Lens</a> combinators! e.g.
--   
--   <pre>
--   <a>toListOf</a> <a>biplate</a> ≡ <a>universeOnOf</a> <a>biplate</a> <a>ignored</a>
--   </pre>
--   
--   This same ability to explicitly pass the <a>Traversal</a> in question
--   is why there is no analogue to uniplate's <tt>Biplate</tt>.
--   
--   Moreover, since we can allow custom traversals, we implement
--   reasonable defaults for polymorphic data types, that only
--   <a>traverse</a> into themselves, and <i>not</i> their polymorphic
--   arguments.
class Plated a

-- | <a>Traversal</a> of the immediate children of this structure.
--   
--   If you're using GHC 7.2 or newer and your type has a <a>Data</a>
--   instance, <a>plate</a> will default to <a>uniplate</a> and you can
--   choose to not override it with your own definition.
plate :: Plated a => Traversal' a a
class GPlated a (g :: * -> *)

-- | This type family is used by <a>Zoom</a> to describe the common effect
--   type.

-- | This type family is used by <a>Magnify</a> to describe the common
--   effect type.

-- | This class allows us to use <a>zoom</a> in, changing the <a>State</a>
--   supplied by many different <a>Monad</a> transformers, potentially
--   quite deep in a <a>Monad</a> transformer stack.
class (MonadState s m, MonadState t n) => Zoom (m :: * -> *) (n :: * -> *) s t | m -> s, n -> t, m t -> n, n s -> m

-- | Run a monadic action in a larger <a>State</a> than it was defined in,
--   using a <a>Lens'</a> or <a>Traversal'</a>.
--   
--   This is commonly used to lift actions in a simpler <a>State</a>
--   <a>Monad</a> into a <a>State</a> <a>Monad</a> with a larger
--   <a>State</a> type.
--   
--   When applied to a <a>Traversal'</a> over multiple values, the actions
--   for each target are executed sequentially and the results are
--   aggregated.
--   
--   This can be used to edit pretty much any <a>Monad</a> transformer
--   stack with a <a>State</a> in it!
--   
--   <pre>
--   &gt;&gt;&gt; flip State.evalState (a,b) $ zoom _1 $ use id
--   a
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; flip State.execState (a,b) $ zoom _1 $ id .= c
--   (c,b)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; flip State.execState [(a,b),(c,d)] $ zoom traverse $ _2 %= f
--   [(a,f b),(c,f d)]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; flip State.runState [(a,b),(c,d)] $ zoom traverse $ _2 &lt;%= f
--   (f b &lt;&gt; f d &lt;&gt; mempty,[(a,f b),(c,f d)])
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; flip State.evalState (a,b) $ zoom both (use id)
--   a &lt;&gt; b
--   </pre>
--   
--   <pre>
--   <a>zoom</a> :: <a>Monad</a> m             =&gt; <a>Lens'</a> s t      -&gt; <a>StateT</a> t m a -&gt; <a>StateT</a> s m a
--   <a>zoom</a> :: (<a>Monad</a> m, <a>Monoid</a> c) =&gt; <a>Traversal'</a> s t -&gt; <a>StateT</a> t m c -&gt; <a>StateT</a> s m c
--   <a>zoom</a> :: (<a>Monad</a> m, <a>Monoid</a> w)             =&gt; <a>Lens'</a> s t      -&gt; <a>RWST</a> r w t m c -&gt; <a>RWST</a> r w s m c
--   <a>zoom</a> :: (<a>Monad</a> m, <a>Monoid</a> w, <a>Monoid</a> c) =&gt; <a>Traversal'</a> s t -&gt; <a>RWST</a> r w t m c -&gt; <a>RWST</a> r w s m c
--   <a>zoom</a> :: (<a>Monad</a> m, <a>Monoid</a> w, <a>Error</a> e)  =&gt; <a>Lens'</a> s t      -&gt; <a>ErrorT</a> e (<a>RWST</a> r w t m) c -&gt; <a>ErrorT</a> e (<a>RWST</a> r w s m) c
--   <a>zoom</a> :: (<a>Monad</a> m, <a>Monoid</a> w, <a>Monoid</a> c, <a>Error</a> e) =&gt; <a>Traversal'</a> s t -&gt; <a>ErrorT</a> e (<a>RWST</a> r w t m) c -&gt; <a>ErrorT</a> e (<a>RWST</a> r w s m) c
--   ...
--   </pre>
zoom :: Zoom m n s t => LensLike' Zoomed m c t s -> m c -> n c

-- | This class allows us to use <a>magnify</a> part of the environment,
--   changing the environment supplied by many different <a>Monad</a>
--   transformers. Unlike <a>zoom</a> this can change the environment of a
--   deeply nested <a>Monad</a> transformer.
--   
--   Also, unlike <a>zoom</a>, this can be used with any valid
--   <a>Getter</a>, but cannot be used with a <a>Traversal</a> or
--   <a>Fold</a>.
class (Magnified m ~ Magnified n, MonadReader b m, MonadReader a n) => Magnify (m :: * -> *) (n :: * -> *) b a | m -> b, n -> a, m a -> n, n b -> m

-- | Run a monadic action in a larger environment than it was defined in,
--   using a <a>Getter</a>.
--   
--   This acts like <a>local</a>, but can in many cases change the type of
--   the environment as well.
--   
--   This is commonly used to lift actions in a simpler <a>Reader</a>
--   <a>Monad</a> into a <a>Monad</a> with a larger environment type.
--   
--   This can be used to edit pretty much any <a>Monad</a> transformer
--   stack with an environment in it:
--   
--   <pre>
--   &gt;&gt;&gt; (1,2) &amp; magnify _2 (+1)
--   3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; flip Reader.runReader (1,2) $ magnify _1 Reader.ask
--   1
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; flip Reader.runReader (1,2,[10..20]) $ magnify (_3._tail) Reader.ask
--   [11,12,13,14,15,16,17,18,19,20]
--   </pre>
--   
--   <pre>
--   <a>magnify</a> :: <a>Getter</a> s a -&gt; (a -&gt; r) -&gt; s -&gt; r
--   <a>magnify</a> :: <a>Monoid</a> r =&gt; <a>Fold</a> s a   -&gt; (a -&gt; r) -&gt; s -&gt; r
--   </pre>
--   
--   <pre>
--   <a>magnify</a> :: <a>Monoid</a> w                 =&gt; <a>Getter</a> s t -&gt; <a>RWS</a> t w st c -&gt; <a>RWS</a> s w st c
--   <a>magnify</a> :: (<a>Monoid</a> w, <a>Monoid</a> c) =&gt; <a>Fold</a> s a   -&gt; <a>RWS</a> a w st c -&gt; <a>RWS</a> s w st c
--   ...
--   </pre>
magnify :: Magnify m n b a => LensLike' Magnified m c a b -> m c -> n c

-- | This combinator is based on <tt>ala'</tt> from Conor McBride's work on
--   Epigram.
--   
--   As with <a>_Wrapping</a>, the user supplied function for the newtype
--   is <i>ignored</i>.
--   
--   <pre>
--   alaf :: Rewrapping s t =&gt; (Unwrapped s -&gt; s) -&gt; ((r -&gt;  t) -&gt; e -&gt; s) -&gt; (r -&gt; Unwrapped t) -&gt; e -&gt; Unwrapped s
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; alaf Sum foldMap Prelude.length ["hello","world"]
--   10
--   </pre>
alaf :: (Functor f, Functor g, Rewrapping s t) => Unwrapped s -> s -> f t -> g s -> f Unwrapped t -> g Unwrapped s

-- | This combinator is based on <tt>ala</tt> from Conor McBride's work on
--   Epigram.
--   
--   As with <a>_Wrapping</a>, the user supplied function for the newtype
--   is <i>ignored</i>.
--   
--   <pre>
--   &gt;&gt;&gt; ala Sum foldMap [1,2,3,4]
--   10
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; ala All foldMap [True,True]
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; ala All foldMap [True,False]
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; ala Any foldMap [False,False]
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; ala Any foldMap [True,False]
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; ala Product foldMap [1,2,3,4]
--   24
--   </pre>
--   
--   You may want to think of this combinator as having the following,
--   simpler, type.
--   
--   <pre>
--   ala :: Rewrapping s t =&gt; (Unwrapped s -&gt; s) -&gt; ((Unwrapped t -&gt; t) -&gt; e -&gt; s) -&gt; e -&gt; Unwrapped s
--   </pre>
ala :: (Functor f, Rewrapping s t) => Unwrapped s -> s -> Unwrapped t -> t -> f s -> f Unwrapped s

-- | This is a convenient version of <a>_Unwrapped</a> with an argument
--   that's ignored.
--   
--   The user supplied function is <i>ignored</i>, merely its types are
--   used.
_Unwrapping :: Rewrapping s t => Unwrapped s -> s -> Iso Unwrapped t Unwrapped s t s

-- | This is a convenient version of <a>_Wrapped</a> with an argument
--   that's ignored.
--   
--   The user supplied function is <i>ignored</i>, merely its types are
--   used.
_Wrapping :: Rewrapping s t => Unwrapped s -> s -> Iso s t Unwrapped s Unwrapped t

-- | This is a convenient version of <a>_Wrapped</a> with an argument
--   that's ignored.
--   
--   The user supplied function is <i>ignored</i>, merely its type is used.
_Unwrapping' :: Wrapped s => Unwrapped s -> s -> Iso' Unwrapped s s

-- | This is a convenient version of <a>_Wrapped</a> with an argument
--   that's ignored.
--   
--   The user supplied function is <i>ignored</i>, merely its type is used.
_Wrapping' :: Wrapped s => Unwrapped s -> s -> Iso' s Unwrapped s

-- | Given the constructor for a <a>Wrapped</a> type, return a
--   deconstructor that is its inverse.
--   
--   Assuming the <a>Wrapped</a> instance is legal, these laws hold:
--   
--   <pre>
--   <a>op</a> f <a>.</a> f ≡ <a>id</a>
--   f <a>.</a> <a>op</a> f ≡ <a>id</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; op Identity (Identity 4)
--   4
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; op Const (Const "hello")
--   "hello"
--   </pre>
op :: Wrapped s => Unwrapped s -> s -> s -> Unwrapped s
_Unwrapped :: Rewrapping s t => Iso Unwrapped t Unwrapped s t s

-- | Work under a newtype wrapper.
--   
--   <pre>
--   &gt;&gt;&gt; Const "hello" &amp; _Wrapped %~ Prelude.length &amp; getConst
--   5
--   </pre>
--   
--   <pre>
--   <a>_Wrapped</a>   ≡ <a>from</a> <a>_Unwrapped</a>
--   <a>_Unwrapped</a> ≡ <a>from</a> <a>_Wrapped</a>
--   </pre>
_Wrapped :: Rewrapping s t => Iso s t Unwrapped s Unwrapped t
_Unwrapped' :: Wrapped s => Iso' Unwrapped s s

-- | Implement the <a>_Wrapped</a> operation for a type using its
--   <a>Generic</a> instance.
_GWrapped' :: (Generic s, D1 d C1 c S1 s' Rec0 a ~ Rep s, Unwrapped s ~ GUnwrapped Rep s) => Iso' s Unwrapped s

-- | <a>Wrapped</a> provides isomorphisms to wrap and unwrap newtypes or
--   data types with one constructor.
class Wrapped s where {
    type family Unwrapped s :: *;
}

-- | An isomorphism between <tt>s</tt> and <tt>a</tt>.
--   
--   If your type has a <a>Generic</a> instance, <a>_Wrapped'</a> will
--   default to <a>_GWrapped'</a>, and you can choose to not override it
--   with your own definition.
_Wrapped' :: Wrapped s => Iso' s Unwrapped s
class Wrapped s => Rewrapped s t
class (Rewrapped s t, Rewrapped t s) => Rewrapping s t

-- | Attempt to extract the right-most element from a container, and a
--   version of the container without that element.
--   
--   <pre>
--   &gt;&gt;&gt; unsnoc (LazyT.pack "hello!")
--   Just ("hello",'!')
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; unsnoc (LazyT.pack "")
--   Nothing
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; unsnoc (Seq.fromList [b,c,a])
--   Just (fromList [b,c],a)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; unsnoc (Seq.fromList [])
--   Nothing
--   </pre>
unsnoc :: Snoc s s a a => s -> Maybe (s, a)

-- | <a>snoc</a> an element onto the end of a container.
--   
--   <pre>
--   &gt;&gt;&gt; snoc (Seq.fromList []) a
--   fromList [a]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; snoc (Seq.fromList [b, c]) a
--   fromList [b,c,a]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; snoc (LazyT.pack "hello") '!'
--   "hello!"
--   </pre>
snoc :: Snoc s s a a => s -> a -> s
infixl 5 `snoc`

-- | <a>snoc</a> an element onto the end of a container.
--   
--   This is an infix alias for <a>snoc</a>.
--   
--   <pre>
--   &gt;&gt;&gt; Seq.fromList [] |&gt; a
--   fromList [a]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Seq.fromList [b, c] |&gt; a
--   fromList [b,c,a]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; LazyT.pack "hello" |&gt; '!'
--   "hello!"
--   </pre>
(|>) :: Snoc s s a a => s -> a -> s
infixl 5 |>

-- | A <a>Traversal</a> reading and writing to the last element of a
--   <i>non-empty</i> container.
--   
--   <pre>
--   &gt;&gt;&gt; [a,b,c]^?!_last
--   c
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; []^?_last
--   Nothing
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [a,b,c] &amp; _last %~ f
--   [a,b,f c]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [1,2]^?_last
--   Just 2
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [] &amp; _last .~ 1
--   []
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [0] &amp; _last .~ 2
--   [2]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [0,1] &amp; _last .~ 2
--   [0,2]
--   </pre>
--   
--   This <a>Traversal</a> is not limited to lists, however. We can also
--   work with other containers, such as a <a>Vector</a>.
--   
--   <pre>
--   &gt;&gt;&gt; Vector.fromList "abcde" ^? _last
--   Just 'e'
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Vector.empty ^? _last
--   Nothing
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (Vector.fromList "abcde" &amp; _last .~ 'Q') == Vector.fromList "abcdQ"
--   True
--   </pre>
--   
--   <pre>
--   <a>_last</a> :: <a>Traversal'</a> [a] a
--   <a>_last</a> :: <a>Traversal'</a> (<a>Seq</a> a) a
--   <a>_last</a> :: <a>Traversal'</a> (<a>Vector</a> a) a
--   </pre>
_last :: Snoc s s a a => Traversal' s a

-- | A <a>Traversal</a> reading and replacing all but the a last element of
--   a <i>non-empty</i> container.
--   
--   <pre>
--   &gt;&gt;&gt; [a,b,c,d]^?_init
--   Just [a,b,c]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; []^?_init
--   Nothing
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [a,b] &amp; _init .~ [c,d,e]
--   [c,d,e,b]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [] &amp; _init .~ [a,b]
--   []
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [a,b,c,d] &amp; _init.traverse %~ f
--   [f a,f b,f c,d]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [1,2,3]^?_init
--   Just [1,2]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [1,2,3,4]^?!_init
--   [1,2,3]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; "hello"^._init
--   "hell"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; ""^._init
--   ""
--   </pre>
--   
--   <pre>
--   <a>_init</a> :: <a>Traversal'</a> [a] [a]
--   <a>_init</a> :: <a>Traversal'</a> (<a>Seq</a> a) (<a>Seq</a> a)
--   <a>_init</a> :: <a>Traversal'</a> (<a>Vector</a> a) (<a>Vector</a> a)
--   </pre>
_init :: Snoc s s a a => Traversal' s s

-- | A <a>Traversal</a> reading and writing to the <a>tail</a> of a
--   <i>non-empty</i> container.
--   
--   <pre>
--   &gt;&gt;&gt; [a,b] &amp; _tail .~ [c,d,e]
--   [a,c,d,e]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [] &amp; _tail .~ [a,b]
--   []
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [a,b,c,d,e] &amp; _tail.traverse %~ f
--   [a,f b,f c,f d,f e]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [1,2] &amp; _tail .~ [3,4,5]
--   [1,3,4,5]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [] &amp; _tail .~ [1,2]
--   []
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [a,b,c]^?_tail
--   Just [b,c]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [1,2]^?!_tail
--   [2]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; "hello"^._tail
--   "ello"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; ""^._tail
--   ""
--   </pre>
--   
--   This isn't limited to lists. For instance you can also <a>traverse</a>
--   the tail of a <a>Seq</a>.
--   
--   <pre>
--   &gt;&gt;&gt; Seq.fromList [a,b] &amp; _tail .~ Seq.fromList [c,d,e]
--   fromList [a,c,d,e]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Seq.fromList [a,b,c] ^? _tail
--   Just (fromList [b,c])
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Seq.fromList [] ^? _tail
--   Nothing
--   </pre>
--   
--   <pre>
--   <a>_tail</a> :: <a>Traversal'</a> [a] [a]
--   <a>_tail</a> :: <a>Traversal'</a> (<a>Seq</a> a) (<a>Seq</a> a)
--   <a>_tail</a> :: <a>Traversal'</a> (<a>Vector</a> a) (<a>Vector</a> a)
--   </pre>
_tail :: Cons s s a a => Traversal' s s

-- | A <a>Traversal</a> reading and writing to the <a>head</a> of a
--   <i>non-empty</i> container.
--   
--   <pre>
--   &gt;&gt;&gt; [a,b,c]^? _head
--   Just a
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [a,b,c] &amp; _head .~ d
--   [d,b,c]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [a,b,c] &amp; _head %~ f
--   [f a,b,c]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [] &amp; _head %~ f
--   []
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [1,2,3]^?!_head
--   1
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; []^?_head
--   Nothing
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [1,2]^?_head
--   Just 1
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [] &amp; _head .~ 1
--   []
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [0] &amp; _head .~ 2
--   [2]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [0,1] &amp; _head .~ 2
--   [2,1]
--   </pre>
--   
--   This isn't limited to lists.
--   
--   For instance you can also <a>traverse</a> the head of a <a>Seq</a>:
--   
--   <pre>
--   &gt;&gt;&gt; Seq.fromList [a,b,c,d] &amp; _head %~ f
--   fromList [f a,b,c,d]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Seq.fromList [] ^? _head
--   Nothing
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Seq.fromList [a,b,c,d] ^? _head
--   Just a
--   </pre>
--   
--   <pre>
--   <a>_head</a> :: <a>Traversal'</a> [a] a
--   <a>_head</a> :: <a>Traversal'</a> (<a>Seq</a> a) a
--   <a>_head</a> :: <a>Traversal'</a> (<a>Vector</a> a) a
--   </pre>
_head :: Cons s s a a => Traversal' s a

-- | Attempt to extract the left-most element from a container, and a
--   version of the container without that element.
--   
--   <pre>
--   &gt;&gt;&gt; uncons []
--   Nothing
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; uncons [a, b, c]
--   Just (a,[b,c])
--   </pre>
uncons :: Cons s s a a => s -> Maybe (a, s)

-- | <a>cons</a> an element onto a container.
--   
--   <pre>
--   &gt;&gt;&gt; cons a []
--   [a]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; cons a [b, c]
--   [a,b,c]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; cons a (Seq.fromList [])
--   fromList [a]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; cons a (Seq.fromList [b, c])
--   fromList [a,b,c]
--   </pre>
cons :: Cons s s a a => a -> s -> s
infixr 5 `cons`

-- | <a>cons</a> an element onto a container.
--   
--   This is an infix alias for <a>cons</a>.
--   
--   <pre>
--   &gt;&gt;&gt; a &lt;| []
--   [a]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; a &lt;| [b, c]
--   [a,b,c]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; a &lt;| Seq.fromList []
--   fromList [a]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; a &lt;| Seq.fromList [b, c]
--   fromList [a,b,c]
--   </pre>
(<|) :: Cons s s a a => a -> s -> s
infixr 5 <|
infixr 5 :<
infixl 5 :>

-- | This class provides a way to attach or detach elements on the left
--   side of a structure in a flexible manner.
class Cons s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | <pre>
--   <a>_Cons</a> :: <a>Prism</a> [a] [b] (a, [a]) (b, [b])
--   <a>_Cons</a> :: <a>Prism</a> (<a>Seq</a> a) (<a>Seq</a> b) (a, <a>Seq</a> a) (b, <a>Seq</a> b)
--   <a>_Cons</a> :: <a>Prism</a> (<a>Vector</a> a) (<a>Vector</a> b) (a, <a>Vector</a> a) (b, <a>Vector</a> b)
--   <a>_Cons</a> :: <a>Prism'</a> <a>String</a> (<a>Char</a>, <a>String</a>)
--   <a>_Cons</a> :: <a>Prism'</a> <a>Text</a> (<a>Char</a>, <a>Text</a>)
--   <a>_Cons</a> :: <a>Prism'</a> <a>ByteString</a> (<a>Word8</a>, <a>ByteString</a>)
--   </pre>
_Cons :: Cons s t a b => Prism s t (a, s) (b, t)

-- | This class provides a way to attach or detach elements on the right
--   side of a structure in a flexible manner.
class Snoc s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | <pre>
--   <a>_Snoc</a> :: <a>Prism</a> [a] [b] ([a], a) ([b], b)
--   <a>_Snoc</a> :: <a>Prism</a> (<a>Seq</a> a) (<a>Seq</a> b) (<a>Seq</a> a, a) (<a>Seq</a> b, b)
--   <a>_Snoc</a> :: <a>Prism</a> (<a>Vector</a> a) (<a>Vector</a> b) (<a>Vector</a> a, a) (<a>Vector</a> b, b)
--   <a>_Snoc</a> :: <a>Prism'</a> <a>String</a> (<a>String</a>, <a>Char</a>)
--   <a>_Snoc</a> :: <a>Prism'</a> <a>Text</a> (<a>Text</a>, <a>Char</a>)
--   <a>_Snoc</a> :: <a>Prism'</a> <a>ByteString</a> (<a>ByteString</a>, <a>Word8</a>)
--   </pre>
_Snoc :: Snoc s t a b => Prism s t (s, a) (t, b)
class AsEmpty a

-- | <pre>
--   &gt;&gt;&gt; isn't _Empty [1,2,3]
--   True
--   </pre>
_Empty :: AsEmpty a => Prism' a ()

-- | Data types that are representationally equal are isomorphic.
--   
--   This is only available on GHC 7.8+
coerced :: (Coercible s a, Coercible t b) => Iso s t a b

-- | Lift an <a>Iso</a> into the second argument of a <a>Bifunctor</a>.
--   This is essentially the same as <a>mapping</a>, but it takes a
--   'Bifunctor p' constraint instead of a 'Functor (p a)' one.
--   
--   <pre>
--   seconding :: <a>Bifunctor</a> p =&gt; <a>Iso</a> s t a b -&gt; <a>Iso</a> (p x s) (p y t) (p x a) (p y b)
--   seconding :: <a>Bifunctor</a> p =&gt; <a>Iso'</a> s a -&gt; <a>Iso'</a> (p x s) (p x a)
--   </pre>
seconding :: (Bifunctor f, Bifunctor g) => AnIso s t a b -> Iso f x s g y t f x a g y b

-- | Lift an <a>Iso</a> into the first argument of a <a>Bifunctor</a>.
--   
--   <pre>
--   firsting :: <a>Bifunctor</a> p =&gt; <a>Iso</a> s t a b -&gt; <a>Iso</a> (p s x) (p t y) (p a x) (p b y)
--   firsting :: <a>Bifunctor</a> p =&gt; <a>Iso'</a> s a -&gt; <a>Iso'</a> (p s x) (p a x)
--   </pre>
firsting :: (Bifunctor f, Bifunctor g) => AnIso s t a b -> Iso f s x g t y f a x g b y

-- | Lift two <a>Iso</a>s into both arguments of a <a>Bifunctor</a>.
--   
--   <pre>
--   bimapping :: <a>Bifunctor</a> p =&gt; <a>Iso</a> s t a b -&gt; <a>Iso</a> s' t' a' b' -&gt; <a>Iso</a> (p s s') (p t t') (p a a') (p b b')
--   bimapping :: <a>Bifunctor</a> p =&gt; <a>Iso'</a> s a -&gt; <a>Iso'</a> s' a' -&gt; <a>Iso'</a> (p s s') (p a a')
--   </pre>
bimapping :: (Bifunctor f, Bifunctor g) => AnIso s t a b -> AnIso s' t' a' b' -> Iso f s s' g t t' f a a' g b b'

-- | Lift an <a>Iso</a> covariantly into the right argument of a
--   <a>Profunctor</a>.
--   
--   <pre>
--   rmapping :: <a>Profunctor</a> p =&gt; <a>Iso</a> s t a b -&gt; <a>Iso</a> (p x s) (p y t) (p x a) (p y b)
--   rmapping :: <a>Profunctor</a> p =&gt; <a>Iso'</a> s a -&gt; <a>Iso'</a> (p x s) (p x a)
--   </pre>
rmapping :: (Profunctor p, Profunctor q) => AnIso s t a b -> Iso p x s q y t p x a q y b

-- | Lift an <a>Iso</a> contravariantly into the left argument of a
--   <a>Profunctor</a>.
--   
--   <pre>
--   lmapping :: <a>Profunctor</a> p =&gt; <a>Iso</a> s t a b -&gt; <a>Iso</a> (p a x) (p b y) (p s x) (p t y)
--   lmapping :: <a>Profunctor</a> p =&gt; <a>Iso'</a> s a -&gt; <a>Iso'</a> (p a x) (p s x)
--   </pre>
lmapping :: (Profunctor p, Profunctor q) => AnIso s t a b -> Iso p a x q b y p s x q t y

-- | Lift two <a>Iso</a>s into both arguments of a <a>Profunctor</a>
--   simultaneously.
--   
--   <pre>
--   dimapping :: <a>Profunctor</a> p =&gt; <a>Iso</a> s t a b -&gt; <a>Iso</a> s' t' a' b' -&gt; <a>Iso</a> (p a s') (p b t') (p s a') (p t b')
--   dimapping :: <a>Profunctor</a> p =&gt; <a>Iso'</a> s a -&gt; <a>Iso'</a> s' a' -&gt; <a>Iso'</a> (p a s') (p s a')
--   </pre>
dimapping :: (Profunctor p, Profunctor q) => AnIso s t a b -> AnIso s' t' a' b' -> Iso p a s' q b t' p s a' q t b'

-- | Lift an <a>Iso</a> into a <a>Contravariant</a> functor.
--   
--   <pre>
--   contramapping :: <a>Contravariant</a> f =&gt; <a>Iso</a> s t a b -&gt; <a>Iso</a> (f a) (f b) (f s) (f t)
--   contramapping :: <a>Contravariant</a> f =&gt; <a>Iso'</a> s a -&gt; <a>Iso'</a> (f a) (f s)
--   </pre>
contramapping :: Contravariant f => AnIso s t a b -> Iso f a f b f s f t

-- | This isomorphism can be used to inspect an <a>IndexedTraversal</a> to
--   see how it associates the structure and it can also be used to bake
--   the <a>IndexedTraversal</a> into a <a>Magma</a> so that you can
--   traverse over it multiple times with access to the original indices.
imagma :: () => Over Indexed i Molten i a b s t a b -> Iso s t' Magma i t b a Magma j t' c c

-- | This isomorphism can be used to inspect a <a>Traversal</a> to see how
--   it associates the structure and it can also be used to bake the
--   <a>Traversal</a> into a <a>Magma</a> so that you can traverse over it
--   multiple times.
magma :: () => LensLike Mafic a b s t a b -> Iso s u Magma Int t b a Magma j u c c

-- | Given a function that is its own inverse, this gives you an <a>Iso</a>
--   using it in both directions.
--   
--   <pre>
--   <a>involuted</a> ≡ <a>join</a> <a>iso</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; "live" ^. involuted reverse
--   "evil"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; "live" &amp; involuted reverse %~ ('d':)
--   "lived"
--   </pre>
involuted :: () => a -> a -> Iso' a a

-- | An <a>Iso</a> between a list, <a>ByteString</a>, <a>Text</a> fragment,
--   etc. and its reversal.
--   
--   <pre>
--   &gt;&gt;&gt; "live" ^. reversed
--   "evil"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; "live" &amp; reversed %~ ('d':)
--   "lived"
--   </pre>
reversed :: Reversing a => Iso' a a

-- | An <a>Iso</a> between the strict variant of a structure and its lazy
--   counterpart.
--   
--   <pre>
--   <a>lazy</a> = <a>from</a> <a>strict</a>
--   </pre>
--   
--   See <a>http://hackage.haskell.org/package/strict-base-types</a> for an
--   example use.
lazy :: Strict lazy strict => Iso' strict lazy

-- | The isomorphism for flipping a function.
--   
--   <pre>
--   &gt;&gt;&gt; ((,)^.flipped) 1 2
--   (2,1)
--   </pre>
flipped :: (Profunctor p, Functor f) => p b -> a -> c f b' -> a' -> c' -> p a -> b -> c f a' -> b' -> c'

-- | The canonical isomorphism for uncurrying and currying a function.
--   
--   <pre>
--   <a>uncurried</a> = <a>iso</a> <a>uncurry</a> <a>curry</a>
--   </pre>
--   
--   <pre>
--   <a>uncurried</a> = <a>from</a> <a>curried</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; ((+)^.uncurried) (1,2)
--   3
--   </pre>
uncurried :: (Profunctor p, Functor f) => p (a, b) -> c f (d, e) -> f -> p a -> b -> c f d -> e -> f

-- | The canonical isomorphism for currying and uncurrying a function.
--   
--   <pre>
--   <a>curried</a> = <a>iso</a> <a>curry</a> <a>uncurry</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (fst^.curried) 3 4
--   3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; view curried fst 3 4
--   3
--   </pre>
curried :: (Profunctor p, Functor f) => p a -> b -> c f d -> e -> f -> p (a, b) -> c f (d, e) -> f

-- | <tt><a>anon</a> a p</tt> generalizes <tt><a>non</a> a</tt> to take any
--   value and a predicate.
--   
--   This function assumes that <tt>p a</tt> holds <tt><a>True</a></tt> and
--   generates an isomorphism between <tt><a>Maybe</a> (a | <a>not</a> (p
--   a))</tt> and <tt>a</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; Map.empty &amp; at "hello" . anon Map.empty Map.null . at "world" ?~ "!!!"
--   fromList [("hello",fromList [("world","!!!")])]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; fromList [("hello",fromList [("world","!!!")])] &amp; at "hello" . anon Map.empty Map.null . at "world" .~ Nothing
--   fromList []
--   </pre>
anon :: () => a -> a -> Bool -> Iso' Maybe a a

-- | <tt><a>non'</a> p</tt> generalizes <tt><a>non</a> (p # ())</tt> to
--   take any unit <a>Prism</a>
--   
--   This function generates an isomorphism between <tt><a>Maybe</a> (a |
--   <a>isn't</a> p a)</tt> and <tt>a</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; Map.singleton "hello" Map.empty &amp; at "hello" . non' _Empty . at "world" ?~ "!!!"
--   fromList [("hello",fromList [("world","!!!")])]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; fromList [("hello",fromList [("world","!!!")])] &amp; at "hello" . non' _Empty . at "world" .~ Nothing
--   fromList []
--   </pre>
non' :: () => APrism' a () -> Iso' Maybe a a

-- | If <tt>v</tt> is an element of a type <tt>a</tt>, and <tt>a'</tt> is
--   <tt>a</tt> sans the element <tt>v</tt>, then <tt><a>non</a> v</tt> is
--   an isomorphism from <tt><a>Maybe</a> a'</tt> to <tt>a</tt>.
--   
--   <pre>
--   <a>non</a> ≡ <a>non'</a> <a>.</a> <a>only</a>
--   </pre>
--   
--   Keep in mind this is only a real isomorphism if you treat the domain
--   as being <tt><a>Maybe</a> (a sans v)</tt>.
--   
--   This is practically quite useful when you want to have a <a>Map</a>
--   where all the entries should have non-zero values.
--   
--   <pre>
--   &gt;&gt;&gt; Map.fromList [("hello",1)] &amp; at "hello" . non 0 +~ 2
--   fromList [("hello",3)]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Map.fromList [("hello",1)] &amp; at "hello" . non 0 -~ 1
--   fromList []
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Map.fromList [("hello",1)] ^. at "hello" . non 0
--   1
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Map.fromList [] ^. at "hello" . non 0
--   0
--   </pre>
--   
--   This combinator is also particularly useful when working with nested
--   maps.
--   
--   <i>e.g.</i> When you want to create the nested <a>Map</a> when it is
--   missing:
--   
--   <pre>
--   &gt;&gt;&gt; Map.empty &amp; at "hello" . non Map.empty . at "world" ?~ "!!!"
--   fromList [("hello",fromList [("world","!!!")])]
--   </pre>
--   
--   and when have deleting the last entry from the nested <a>Map</a> mean
--   that we should delete its entry from the surrounding one:
--   
--   <pre>
--   &gt;&gt;&gt; fromList [("hello",fromList [("world","!!!")])] &amp; at "hello" . non Map.empty . at "world" .~ Nothing
--   fromList []
--   </pre>
--   
--   It can also be used in reverse to exclude a given value:
--   
--   <pre>
--   &gt;&gt;&gt; non 0 # rem 10 4
--   Just 2
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; non 0 # rem 10 5
--   Nothing
--   </pre>
non :: Eq a => a -> Iso' Maybe a a

-- | This can be used to lift any <a>Iso</a> into an arbitrary
--   <a>Functor</a>.
mapping :: (Functor f, Functor g) => AnIso s t a b -> Iso f s g t f a g b

-- | This isomorphism can be used to convert to or from an instance of
--   <a>Enum</a>.
--   
--   <pre>
--   &gt;&gt;&gt; LT^.from enum
--   0
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 97^.enum :: Char
--   'a'
--   </pre>
--   
--   Note: this is only an isomorphism from the numeric range actually used
--   and it is a bit of a pleasant fiction, since there are questionable
--   <a>Enum</a> instances for <a>Double</a>, and <a>Float</a> that exist
--   solely for <tt>[1.0 .. 4.0]</tt> sugar and the instances for those and
--   <a>Integer</a> don't cover all values in their range.
enum :: Enum a => Iso' Int a

-- | The opposite of working <a>over</a> a <a>Setter</a> is working
--   <a>under</a> an isomorphism.
--   
--   <pre>
--   <a>under</a> ≡ <a>over</a> <a>.</a> <a>from</a>
--   </pre>
--   
--   <pre>
--   <a>under</a> :: <a>Iso</a> s t a b -&gt; (t -&gt; s) -&gt; b -&gt; a
--   </pre>
under :: () => AnIso s t a b -> t -> s -> b -> a

-- | Based on <tt>ala'</tt> from Conor McBride's work on Epigram.
--   
--   This version is generalized to accept any <a>Iso</a>, not just a
--   <tt>newtype</tt>.
--   
--   For a version you pass the name of the <tt>newtype</tt> constructor
--   to, see <a>alaf</a>.
--   
--   <pre>
--   &gt;&gt;&gt; auf (_Unwrapping Sum) (foldMapOf both) Prelude.length ("hello","world")
--   10
--   </pre>
--   
--   Mnemonically, the German <i>auf</i> plays a similar role to <i>à
--   la</i>, and the combinator is <a>au</a> with an extra function
--   argument:
--   
--   <pre>
--   <a>auf</a> :: <a>Iso</a> s t a b -&gt; ((r -&gt;  a) -&gt; e -&gt; b) -&gt; (r -&gt; s) -&gt; e -&gt; t
--   </pre>
--   
--   but the signature is general.
auf :: () => Optic Costar f g s t a b -> f a -> g b -> f s -> g t

-- | Based on <a>ala</a> from Conor McBride's work on Epigram.
--   
--   This version is generalized to accept any <a>Iso</a>, not just a
--   <tt>newtype</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; au (_Wrapping Sum) foldMap [1,2,3,4]
--   10
--   </pre>
--   
--   You may want to think of this combinator as having the following,
--   simpler type:
--   
--   <pre>
--   au :: AnIso s t a b -&gt; ((b -&gt; t) -&gt; e -&gt; s) -&gt; e -&gt; a
--   </pre>
au :: Functor f => AnIso s t a b -> b -> t -> f s -> f a

-- | Convert from <a>AnIso</a> back to any <a>Iso</a>.
--   
--   This is useful when you need to store an isomorphism as a data type
--   inside a container and later reconstitute it as an overloaded
--   function.
--   
--   See <a>cloneLens</a> or <a>cloneTraversal</a> for more information on
--   why you might want to do this.
cloneIso :: () => AnIso s t a b -> Iso s t a b

-- | Extract the two functions, one from <tt>s -&gt; a</tt> and one from
--   <tt>b -&gt; t</tt> that characterize an <a>Iso</a>.
withIso :: () => AnIso s t a b -> s -> a -> b -> t -> r -> r

-- | Invert an isomorphism.
--   
--   <pre>
--   <a>from</a> (<a>from</a> l) ≡ l
--   </pre>
from :: () => AnIso s t a b -> Iso b a t s

-- | Build a simple isomorphism from a pair of inverse functions.
--   
--   <pre>
--   <a>view</a> (<a>iso</a> f g) ≡ f
--   <a>view</a> (<a>from</a> (<a>iso</a> f g)) ≡ g
--   <a>over</a> (<a>iso</a> f g) h ≡ g <a>.</a> h <a>.</a> f
--   <a>over</a> (<a>from</a> (<a>iso</a> f g)) h ≡ f <a>.</a> h <a>.</a> g
--   </pre>
iso :: () => s -> a -> b -> t -> Iso s t a b

-- | When you see this as an argument to a function, it expects an
--   <a>Iso</a>.
type AnIso s t a b = Exchange a b a Identity b -> Exchange a b s Identity t

-- | A <a>Simple</a> <a>AnIso</a>.
type AnIso' s a = AnIso s s a a

-- | This class provides for symmetric bifunctors.
class Bifunctor p => Swapped (p :: * -> * -> *)

-- | <pre>
--   <a>swapped</a> <a>.</a> <a>swapped</a> ≡ <a>id</a>
--   <a>first</a> f <a>.</a> <a>swapped</a> = <a>swapped</a> <a>.</a> <a>second</a> f
--   <a>second</a> g <a>.</a> <a>swapped</a> = <a>swapped</a> <a>.</a> <a>first</a> g
--   <a>bimap</a> f g <a>.</a> <a>swapped</a> = <a>swapped</a> <a>.</a> <a>bimap</a> g f
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (1,2)^.swapped
--   (2,1)
--   </pre>
swapped :: (Swapped p, Profunctor p, Functor f) => p p b a f p d c -> p p a b f p c d

-- | Ad hoc conversion between "strict" and "lazy" versions of a structure,
--   such as <a>Text</a> or <a>ByteString</a>.
class Strict lazy strict | lazy -> strict, strict -> lazy
strict :: Strict lazy strict => Iso' lazy strict

-- | Composition with this isomorphism is occasionally useful when your
--   <a>Lens</a>, <a>Traversal</a> or <a>Iso</a> has a constraint on an
--   unused argument to force that argument to agree with the type of a
--   used argument and avoid <tt>ScopedTypeVariables</tt> or other
--   ugliness.
simple :: () => p a f a -> p a f a

-- | This is an adverb that can be used to modify many other <a>Lens</a>
--   combinators to make them require simple lenses, simple traversals,
--   simple prisms or simple isos as input.
simply :: () => Optic' p f s a -> r -> Optic' p f s a -> r

-- | <a>Equality</a> is symmetric.
fromEq :: () => AnEquality s t a b -> Equality b a t s

-- | We can use <a>Equality</a> to do substitution into anything.
mapEq :: () => AnEquality s t a b -> f s -> f a

-- | Substituting types with <a>Equality</a>.
substEq :: () => AnEquality s t a b -> s ~ a -> t ~ b -> r -> r

-- | Extract a witness of type <a>Equality</a>.
runEq :: () => AnEquality s t a b -> Identical s t a b

-- | Provides witness that <tt>(s ~ a, b ~ t)</tt> holds.
data Identical (a :: k) (b :: k1) (s :: k) (t :: k1) :: forall k k1. () => k -> k1 -> k -> k1 -> *
[Identical] :: Identical a b a b

-- | When you see this as an argument to a function, it expects an
--   <a>Equality</a>.
type AnEquality (s :: k1) (t :: k2) (a :: k1) (b :: k2) = Identical a Proxy b a Proxy b -> Identical a Proxy b s Proxy t

-- | A <a>Simple</a> <a>AnEquality</a>.
type AnEquality' (s :: k2) (a :: k2) = AnEquality s s a a
itraverseByOf :: () => IndexedTraversal i s t a b -> forall x. () => x -> f x -> forall x y. () => f x -> y -> f x -> f y -> i -> a -> f b -> s -> f t
itraverseBy :: TraversableWithIndex i t => forall x. () => x -> f x -> forall x y. () => f x -> y -> f x -> f y -> i -> a -> f b -> t a -> f t b
ifoldMapByOf :: () => IndexedFold i t a -> r -> r -> r -> r -> i -> a -> r -> t -> r
ifoldMapBy :: FoldableWithIndex i t => r -> r -> r -> r -> i -> a -> r -> t a -> r

-- | Generalizes <a>mapAccumL</a> to add access to the index.
--   
--   <a>imapAccumLOf</a> accumulates state from left to right.
--   
--   <pre>
--   <a>mapAccumLOf</a> ≡ <a>imapAccumL</a> <a>.</a> <a>const</a>
--   </pre>
imapAccumL :: TraversableWithIndex i t => i -> s -> a -> (s, b) -> s -> t a -> (s, t b)

-- | Generalizes <a>mapAccumR</a> to add access to the index.
--   
--   <a>imapAccumROf</a> accumulates state from right to left.
--   
--   <pre>
--   <a>mapAccumR</a> ≡ <a>imapAccumR</a> <a>.</a> <a>const</a>
--   </pre>
imapAccumR :: TraversableWithIndex i t => i -> s -> a -> (s, b) -> s -> t a -> (s, t b)

-- | Map each element of a structure to a monadic action, evaluate these
--   actions from left to right, and collect the results, with access its
--   position (and the arguments flipped).
--   
--   <pre>
--   <tt>forM</tt> a ≡ <a>iforM</a> a <a>.</a> <a>const</a>
--   <a>iforM</a> ≡ <a>flip</a> <a>imapM</a>
--   </pre>
iforM :: (TraversableWithIndex i t, Monad m) => t a -> i -> a -> m b -> m t b

-- | Map each element of a structure to a monadic action, evaluate these
--   actions from left to right, and collect the results, with access the
--   index.
--   
--   When you don't need access to the index <a>mapM</a> is more liberal in
--   what it can accept.
--   
--   <pre>
--   <a>mapM</a> ≡ <a>imapM</a> <a>.</a> <a>const</a>
--   </pre>
imapM :: (TraversableWithIndex i t, Monad m) => i -> a -> m b -> t a -> m t b

-- | Traverse with an index (and the arguments flipped).
--   
--   <pre>
--   <tt>for</tt> a ≡ <a>ifor</a> a <a>.</a> <a>const</a>
--   <a>ifor</a> ≡ <a>flip</a> <a>itraverse</a>
--   </pre>
ifor :: (TraversableWithIndex i t, Applicative f) => t a -> i -> a -> f b -> f t b

-- | Extract the key-value pairs from a structure.
--   
--   When you don't need access to the indices in the result, then
--   <a>toList</a> is more flexible in what it accepts.
--   
--   <pre>
--   <a>toList</a> ≡ <a>map</a> <a>snd</a> <a>.</a> <a>itoList</a>
--   </pre>
itoList :: FoldableWithIndex i f => f a -> [(i, a)]

-- | Monadic fold over the elements of a structure with an index,
--   associating to the left.
--   
--   When you don't need access to the index then <a>foldlM</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>foldlM</a> ≡ <a>ifoldlM</a> <a>.</a> <a>const</a>
--   </pre>
ifoldlM :: (FoldableWithIndex i f, Monad m) => i -> b -> a -> m b -> b -> f a -> m b

-- | Monadic fold right over the elements of a structure with an index.
--   
--   When you don't need access to the index then <a>foldrM</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>foldrM</a> ≡ <a>ifoldrM</a> <a>.</a> <a>const</a>
--   </pre>
ifoldrM :: (FoldableWithIndex i f, Monad m) => i -> a -> b -> m b -> b -> f a -> m b

-- | Searches a container with a predicate that is also supplied the index,
--   returning the left-most element of the structure matching the
--   predicate, or <a>Nothing</a> if there is no such element.
--   
--   When you don't need access to the index then <a>find</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>find</a> ≡ <a>ifind</a> <a>.</a> <a>const</a>
--   </pre>
ifind :: FoldableWithIndex i f => i -> a -> Bool -> f a -> Maybe (i, a)

-- | Concatenate the results of a function of the elements of an indexed
--   container with access to the index.
--   
--   When you don't need access to the index then <a>concatMap</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>concatMap</a> ≡ <a>iconcatMap</a> <a>.</a> <a>const</a>
--   <a>iconcatMap</a> ≡ <a>ifoldMap</a>
--   </pre>
iconcatMap :: FoldableWithIndex i f => i -> a -> [b] -> f a -> [b]

-- | Run monadic actions for each target of an <a>IndexedFold</a> or
--   <a>IndexedTraversal</a> with access to the index, discarding the
--   results (with the arguments flipped).
--   
--   <pre>
--   <a>iforM_</a> ≡ <a>flip</a> <a>imapM_</a>
--   </pre>
--   
--   When you don't need access to the index then <a>forMOf_</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>forMOf_</a> l a ≡ <a>iforMOf</a> l a <a>.</a> <a>const</a>
--   </pre>
iforM_ :: (FoldableWithIndex i t, Monad m) => t a -> i -> a -> m b -> m ()

-- | Run monadic actions for each target of an <a>IndexedFold</a> or
--   <a>IndexedTraversal</a> with access to the index, discarding the
--   results.
--   
--   When you don't need access to the index then <a>mapMOf_</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>mapM_</a> ≡ <a>imapM</a> <a>.</a> <a>const</a>
--   </pre>
imapM_ :: (FoldableWithIndex i t, Monad m) => i -> a -> m b -> t a -> m ()

-- | Traverse elements with access to the index <tt>i</tt>, discarding the
--   results (with the arguments flipped).
--   
--   <pre>
--   <a>ifor_</a> ≡ <a>flip</a> <a>itraverse_</a>
--   </pre>
--   
--   When you don't need access to the index then <a>for_</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>for_</a> a ≡ <a>ifor_</a> a <a>.</a> <a>const</a>
--   </pre>
ifor_ :: (FoldableWithIndex i t, Applicative f) => t a -> i -> a -> f b -> f ()

-- | Traverse elements with access to the index <tt>i</tt>, discarding the
--   results.
--   
--   When you don't need access to the index then <a>traverse_</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>traverse_</a> l = <a>itraverse</a> <a>.</a> <a>const</a>
--   </pre>
itraverse_ :: (FoldableWithIndex i t, Applicative f) => i -> a -> f b -> t a -> f ()

-- | Determines whether no elements of the structure satisfy the predicate.
--   
--   <pre>
--   <a>none</a> f ≡ <a>not</a> <a>.</a> <a>any</a> f
--   </pre>
none :: Foldable f => a -> Bool -> f a -> Bool

-- | Return whether or not none of the elements in a container satisfy a
--   predicate, with access to the index <tt>i</tt>.
--   
--   When you don't need access to the index then <a>none</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>none</a> ≡ <a>inone</a> <a>.</a> <a>const</a>
--   <a>inone</a> f ≡ <a>not</a> <a>.</a> <a>iany</a> f
--   </pre>
inone :: FoldableWithIndex i f => i -> a -> Bool -> f a -> Bool

-- | Return whether or not all elements in a container satisfy a predicate,
--   with access to the index <tt>i</tt>.
--   
--   When you don't need access to the index then <a>all</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>all</a> ≡ <a>iall</a> <a>.</a> <a>const</a>
--   </pre>
iall :: FoldableWithIndex i f => i -> a -> Bool -> f a -> Bool

-- | Return whether or not any element in a container satisfies a
--   predicate, with access to the index <tt>i</tt>.
--   
--   When you don't need access to the index then <a>any</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>any</a> ≡ <a>iany</a> <a>.</a> <a>const</a>
--   </pre>
iany :: FoldableWithIndex i f => i -> a -> Bool -> f a -> Bool

-- | This allows you to filter an <a>IndexedFold</a>, <a>IndexedGetter</a>,
--   <a>IndexedTraversal</a> or <a>IndexedLens</a> based on an index.
--   
--   <pre>
--   &gt;&gt;&gt; ["hello","the","world","!!!"]^?traversed.index 2
--   Just "world"
--   </pre>
index :: (Indexable i p, Eq i, Applicative f) => i -> Optical' p Indexed i f a a

-- | This allows you to filter an <a>IndexedFold</a>, <a>IndexedGetter</a>,
--   <a>IndexedTraversal</a> or <a>IndexedLens</a> based on a predicate on
--   the indices.
--   
--   <pre>
--   &gt;&gt;&gt; ["hello","the","world","!!!"]^..traversed.indices even
--   ["hello","world"]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; over (traversed.indices (&gt;0)) Prelude.reverse $ ["He","was","stressed","o_O"]
--   ["He","saw","desserts","O_o"]
--   </pre>
indices :: (Indexable i p, Applicative f) => i -> Bool -> Optical' p Indexed i f a a

-- | Composition of <a>Indexed</a> functions with a user supplied function
--   for combining indices.
icompose :: Indexable p c => i -> j -> p -> Indexed i s t -> r -> Indexed j a b -> s -> t -> c a b -> r

-- | Composition of <a>Indexed</a> functions.
--   
--   Mnemonically, the <tt>&lt;</tt> and <tt>&gt;</tt> points to the fact
--   that we want to preserve the indices.
--   
--   <pre>
--   &gt;&gt;&gt; let nestedMap = (fmap Map.fromList . Map.fromList) [(1, [(10, "one,ten"), (20, "one,twenty")]), (2, [(30, "two,thirty"), (40,"two,forty")])]
--   
--   &gt;&gt;&gt; nestedMap^..(itraversed&lt;.&gt;itraversed).withIndex
--   [((1,10),"one,ten"),((1,20),"one,twenty"),((2,30),"two,thirty"),((2,40),"two,forty")]
--   </pre>
(<.>) :: Indexable (i, j) p => Indexed i s t -> r -> Indexed j a b -> s -> t -> p a b -> r
infixr 9 <.>

-- | Remap the index.
reindexed :: Indexable j p => i -> j -> Indexed i a b -> r -> p a b -> r

-- | Use a value itself as its own index. This is essentially an indexed
--   version of <a>id</a>.
--   
--   Note: When used to modify the value, this can break the index
--   requirements assumed by <a>indices</a> and similar, so this is only
--   properly an <a>IndexedGetter</a>, but it can be used as more.
--   
--   <pre>
--   <a>selfIndex</a> :: <a>IndexedGetter</a> a a b
--   </pre>
selfIndex :: Indexable a p => p a fb -> a -> fb

-- | Compose a non-indexed function with an <a>Indexed</a> function.
--   
--   Mnemonically, the <tt>&gt;</tt> points to the indexing we want to
--   preserve.
--   
--   This is the same as <tt>(<a>.</a>)</tt>.
--   
--   <tt>f <a>.</a> g</tt> (and <tt>f <a>.&gt;</a> g</tt>) gives you the
--   index of <tt>g</tt> unless <tt>g</tt> is index-preserving, like a
--   <a>Prism</a>, <a>Iso</a> or <a>Equality</a>, in which case it'll pass
--   through the index of <tt>f</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; let nestedMap = (fmap Map.fromList . Map.fromList) [(1, [(10, "one,ten"), (20, "one,twenty")]), (2, [(30, "two,thirty"), (40,"two,forty")])]
--   
--   &gt;&gt;&gt; nestedMap^..(itraversed.&gt;itraversed).withIndex
--   [(10,"one,ten"),(20,"one,twenty"),(30,"two,thirty"),(40,"two,forty")]
--   </pre>
(.>) :: () => st -> r -> kab -> st -> kab -> r
infixr 9 .>

-- | Compose an <a>Indexed</a> function with a non-indexed function.
--   
--   Mnemonically, the <tt>&lt;</tt> points to the indexing we want to
--   preserve.
--   
--   <pre>
--   &gt;&gt;&gt; let nestedMap = (fmap Map.fromList . Map.fromList) [(1, [(10, "one,ten"), (20, "one,twenty")]), (2, [(30, "two,thirty"), (40,"two,forty")])]
--   
--   &gt;&gt;&gt; nestedMap^..(itraversed&lt;.itraversed).withIndex
--   [(1,"one,ten"),(1,"one,twenty"),(2,"two,thirty"),(2,"two,forty")]
--   </pre>
(<.) :: Indexable i p => Indexed i s t -> r -> a -> b -> s -> t -> p a b -> r
infixr 9 <.

-- | A <a>Functor</a> with an additional index.
--   
--   Instances must satisfy a modified form of the <a>Functor</a> laws:
--   
--   <pre>
--   <a>imap</a> f <a>.</a> <a>imap</a> g ≡ <a>imap</a> (\i -&gt; f i <a>.</a> g i)
--   <a>imap</a> (\_ a -&gt; a) ≡ <a>id</a>
--   </pre>
class Functor f => FunctorWithIndex i (f :: * -> *) | f -> i

-- | Map with access to the index.
imap :: FunctorWithIndex i f => i -> a -> b -> f a -> f b

-- | The <a>IndexedSetter</a> for a <a>FunctorWithIndex</a>.
--   
--   If you don't need access to the index, then <a>mapped</a> is more
--   flexible in what it accepts.
imapped :: (FunctorWithIndex i f, Indexable i p, Settable f) => p a f b -> f a -> f f b

-- | A container that supports folding with an additional index.
class Foldable f => FoldableWithIndex i (f :: * -> *) | f -> i

-- | Fold a container by mapping value to an arbitrary <a>Monoid</a> with
--   access to the index <tt>i</tt>.
--   
--   When you don't need access to the index then <a>foldMap</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>foldMap</a> ≡ <a>ifoldMap</a> <a>.</a> <a>const</a>
--   </pre>
ifoldMap :: (FoldableWithIndex i f, Monoid m) => i -> a -> m -> f a -> m

-- | The <a>IndexedFold</a> of a <a>FoldableWithIndex</a> container.
--   
--   <tt><a>ifolded</a> <a>.</a> <a>asIndex</a></tt> is a fold over the
--   keys of a <a>FoldableWithIndex</a>.
--   
--   <pre>
--   &gt;&gt;&gt; Data.Map.fromList [(2, "hello"), (1, "world")]^..ifolded.asIndex
--   [1,2]
--   </pre>
ifolded :: (FoldableWithIndex i f, Indexable i p, Contravariant f, Applicative f) => p a f a -> f a -> f f a

-- | Right-associative fold of an indexed container with access to the
--   index <tt>i</tt>.
--   
--   When you don't need access to the index then <a>foldr</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>foldr</a> ≡ <a>ifoldr</a> <a>.</a> <a>const</a>
--   </pre>
ifoldr :: FoldableWithIndex i f => i -> a -> b -> b -> b -> f a -> b

-- | Left-associative fold of an indexed container with access to the index
--   <tt>i</tt>.
--   
--   When you don't need access to the index then <a>foldl</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>foldl</a> ≡ <a>ifoldl</a> <a>.</a> <a>const</a>
--   </pre>
ifoldl :: FoldableWithIndex i f => i -> b -> a -> b -> b -> f a -> b

-- | <i>Strictly</i> fold right over the elements of a structure with
--   access to the index <tt>i</tt>.
--   
--   When you don't need access to the index then <a>foldr'</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>foldr'</a> ≡ <a>ifoldr'</a> <a>.</a> <a>const</a>
--   </pre>
ifoldr' :: FoldableWithIndex i f => i -> a -> b -> b -> b -> f a -> b

-- | Fold over the elements of a structure with an index, associating to
--   the left, but <i>strictly</i>.
--   
--   When you don't need access to the index then <a>foldlOf'</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>foldlOf'</a> l ≡ <a>ifoldlOf'</a> l <a>.</a> <a>const</a>
--   </pre>
ifoldl' :: FoldableWithIndex i f => i -> b -> a -> b -> b -> f a -> b

-- | A <a>Traversable</a> with an additional index.
--   
--   An instance must satisfy a (modified) form of the <a>Traversable</a>
--   laws:
--   
--   <pre>
--   <a>itraverse</a> (<a>const</a> <a>Identity</a>) ≡ <a>Identity</a>
--   <a>fmap</a> (<a>itraverse</a> f) <a>.</a> <a>itraverse</a> g ≡ <a>getCompose</a> <a>.</a> <a>itraverse</a> (\i -&gt; <a>Compose</a> <a>.</a> <a>fmap</a> (f i) <a>.</a> g i)
--   </pre>
class (FunctorWithIndex i t, FoldableWithIndex i t, Traversable t) => TraversableWithIndex i (t :: * -> *) | t -> i

-- | Traverse an indexed container.
--   
--   <pre>
--   <a>itraverse</a> ≡ <a>itraverseOf</a> <a>itraversed</a>
--   </pre>
itraverse :: (TraversableWithIndex i t, Applicative f) => i -> a -> f b -> t a -> f t b

-- | The <a>IndexedTraversal</a> of a <a>TraversableWithIndex</a>
--   container.
itraversed :: (TraversableWithIndex i t, Indexable i p, Applicative f) => p a f b -> t a -> f t b

-- | Reify a <a>Lens</a> so it can be stored safely in a container.
newtype ReifiedLens s t a b
Lens :: Lens s t a b -> ReifiedLens s t a b
[runLens] :: ReifiedLens s t a b -> Lens s t a b

-- | <pre>
--   type <a>ReifiedLens'</a> = <a>Simple</a> <a>ReifiedLens</a>
--   </pre>
type ReifiedLens' s a = ReifiedLens s s a a

-- | Reify an <a>IndexedLens</a> so it can be stored safely in a container.
newtype ReifiedIndexedLens i s t a b
IndexedLens :: IndexedLens i s t a b -> ReifiedIndexedLens i s t a b
[runIndexedLens] :: ReifiedIndexedLens i s t a b -> IndexedLens i s t a b

-- | <pre>
--   type <a>ReifiedIndexedLens'</a> i = <a>Simple</a> (<a>ReifiedIndexedLens</a> i)
--   </pre>
type ReifiedIndexedLens' i s a = ReifiedIndexedLens i s s a a

-- | Reify an <a>IndexedTraversal</a> so it can be stored safely in a
--   container.
newtype ReifiedIndexedTraversal i s t a b
IndexedTraversal :: IndexedTraversal i s t a b -> ReifiedIndexedTraversal i s t a b
[runIndexedTraversal] :: ReifiedIndexedTraversal i s t a b -> IndexedTraversal i s t a b

-- | <pre>
--   type <a>ReifiedIndexedTraversal'</a> i = <a>Simple</a> (<a>ReifiedIndexedTraversal</a> i)
--   </pre>
type ReifiedIndexedTraversal' i s a = ReifiedIndexedTraversal i s s a a

-- | A form of <a>Traversal</a> that can be stored monomorphically in a
--   container.
newtype ReifiedTraversal s t a b
Traversal :: Traversal s t a b -> ReifiedTraversal s t a b
[runTraversal] :: ReifiedTraversal s t a b -> Traversal s t a b

-- | <pre>
--   type <a>ReifiedTraversal'</a> = <a>Simple</a> <a>ReifiedTraversal</a>
--   </pre>
type ReifiedTraversal' s a = ReifiedTraversal s s a a

-- | Reify a <a>Getter</a> so it can be stored safely in a container.
--   
--   This can also be useful when combining getters in novel ways, as
--   <a>ReifiedGetter</a> is isomorphic to '(-&gt;)' and provides similar
--   instances.
--   
--   <pre>
--   &gt;&gt;&gt; ("hello","world","!!!")^.runGetter ((,) &lt;$&gt; Getter _2 &lt;*&gt; Getter (_1.to length))
--   ("world",5)
--   </pre>
newtype ReifiedGetter s a
Getter :: Getter s a -> ReifiedGetter s a
[runGetter] :: ReifiedGetter s a -> Getter s a

-- | Reify an <a>IndexedGetter</a> so it can be stored safely in a
--   container.
newtype ReifiedIndexedGetter i s a
IndexedGetter :: IndexedGetter i s a -> ReifiedIndexedGetter i s a
[runIndexedGetter] :: ReifiedIndexedGetter i s a -> IndexedGetter i s a

-- | Reify a <a>Fold</a> so it can be stored safely in a container.
--   
--   This can also be useful for creatively combining folds as
--   <tt><a>ReifiedFold</a> s</tt> is isomorphic to <tt>ReaderT s []</tt>
--   and provides similar instances.
--   
--   <pre>
--   &gt;&gt;&gt; ("hello","world")^..runFold ((,) &lt;$&gt; Fold _2 &lt;*&gt; Fold both)
--   [("world","hello"),("world","world")]
--   </pre>
newtype ReifiedFold s a
Fold :: Fold s a -> ReifiedFold s a
[runFold] :: ReifiedFold s a -> Fold s a
newtype ReifiedIndexedFold i s a
IndexedFold :: IndexedFold i s a -> ReifiedIndexedFold i s a
[runIndexedFold] :: ReifiedIndexedFold i s a -> IndexedFold i s a

-- | Reify a <a>Setter</a> so it can be stored safely in a container.
newtype ReifiedSetter s t a b
Setter :: Setter s t a b -> ReifiedSetter s t a b
[runSetter] :: ReifiedSetter s t a b -> Setter s t a b

-- | <pre>
--   type <a>ReifiedSetter'</a> = <a>Simple</a> <a>ReifiedSetter</a>
--   </pre>
type ReifiedSetter' s a = ReifiedSetter s s a a

-- | Reify an <a>IndexedSetter</a> so it can be stored safely in a
--   container.
newtype ReifiedIndexedSetter i s t a b
IndexedSetter :: IndexedSetter i s t a b -> ReifiedIndexedSetter i s t a b
[runIndexedSetter] :: ReifiedIndexedSetter i s t a b -> IndexedSetter i s t a b

-- | <pre>
--   type <a>ReifiedIndexedSetter'</a> i = <a>Simple</a> (<a>ReifiedIndexedSetter</a> i)
--   </pre>
type ReifiedIndexedSetter' i s a = ReifiedIndexedSetter i s s a a

-- | Reify an <a>Iso</a> so it can be stored safely in a container.
newtype ReifiedIso s t a b
Iso :: Iso s t a b -> ReifiedIso s t a b
[runIso] :: ReifiedIso s t a b -> Iso s t a b

-- | <pre>
--   type <a>ReifiedIso'</a> = <a>Simple</a> <a>ReifiedIso</a>
--   </pre>
type ReifiedIso' s a = ReifiedIso s s a a

-- | Reify a <a>Prism</a> so it can be stored safely in a container.
newtype ReifiedPrism s t a b
Prism :: Prism s t a b -> ReifiedPrism s t a b
[runPrism] :: ReifiedPrism s t a b -> Prism s t a b

-- | <pre>
--   type <a>ReifiedPrism'</a> = <a>Simple</a> <a>ReifiedPrism</a>
--   </pre>
type ReifiedPrism' s a = ReifiedPrism s s a a

-- | This provides a breadth-first <a>Traversal</a> or <a>Fold</a> of the
--   individual levels of any other <a>Traversal</a> or <a>Fold</a> via
--   iterative deepening depth-first search. The levels are returned to you
--   in a compressed format.
--   
--   This is similar to <a>levels</a>, but retains the index of the
--   original <a>IndexedTraversal</a>, so you can access it when traversing
--   the levels later on.
--   
--   <pre>
--   &gt;&gt;&gt; ["dog","cat"]^@..ilevels (traversed&lt;.&gt;traversed).itraversed
--   [((0,0),'d'),((0,1),'o'),((1,0),'c'),((0,2),'g'),((1,1),'a'),((1,2),'t')]
--   </pre>
--   
--   The resulting <a>Traversal</a> of the levels which is indexed by the
--   depth of each <a>Level</a>.
--   
--   <pre>
--   &gt;&gt;&gt; ["dog","cat"]^@..ilevels (traversed&lt;.&gt;traversed)&lt;.&gt;itraversed
--   [((2,(0,0)),'d'),((3,(0,1)),'o'),((3,(1,0)),'c'),((4,(0,2)),'g'),((4,(1,1)),'a'),((5,(1,2)),'t')]
--   </pre>
--   
--   <pre>
--   <a>ilevels</a> :: <a>IndexedTraversal</a> i s t a b      -&gt; <a>IndexedTraversal</a> <a>Int</a> s t (<a>Level</a> i a) (<a>Level</a> i b)
--   <a>ilevels</a> :: <a>IndexedFold</a> i s a               -&gt; <a>IndexedFold</a> <a>Int</a> s (<a>Level</a> i a)
--   </pre>
--   
--   <i>Note:</i> Internally this is implemented by using an illegal
--   <a>Applicative</a>, as it extracts information in an order that
--   violates the <a>Applicative</a> laws.
ilevels :: Applicative f => Traversing Indexed i f s t a b -> IndexedLensLike Int f s t Level i a Level j b

-- | This provides a breadth-first <a>Traversal</a> or <a>Fold</a> of the
--   individual <a>levels</a> of any other <a>Traversal</a> or <a>Fold</a>
--   via iterative deepening depth-first search. The levels are returned to
--   you in a compressed format.
--   
--   This can permit us to extract the <a>levels</a> directly:
--   
--   <pre>
--   &gt;&gt;&gt; ["hello","world"]^..levels (traverse.traverse)
--   [Zero,Zero,One () 'h',Two 0 (One () 'e') (One () 'w'),Two 0 (One () 'l') (One () 'o'),Two 0 (One () 'l') (One () 'r'),Two 0 (One () 'o') (One () 'l'),One () 'd']
--   </pre>
--   
--   But we can also traverse them in turn:
--   
--   <pre>
--   &gt;&gt;&gt; ["hello","world"]^..levels (traverse.traverse).traverse
--   "hewlolrold"
--   </pre>
--   
--   We can use this to traverse to a fixed depth in the tree of
--   (<a>&lt;*&gt;</a>) used in the <a>Traversal</a>:
--   
--   <pre>
--   &gt;&gt;&gt; ["hello","world"] &amp; taking 4 (levels (traverse.traverse)).traverse %~ toUpper
--   ["HEllo","World"]
--   </pre>
--   
--   Or we can use it to traverse the first <tt>n</tt> elements in found in
--   that <a>Traversal</a> regardless of the depth at which they were
--   found.
--   
--   <pre>
--   &gt;&gt;&gt; ["hello","world"] &amp; taking 4 (levels (traverse.traverse).traverse) %~ toUpper
--   ["HELlo","World"]
--   </pre>
--   
--   The resulting <a>Traversal</a> of the <a>levels</a> which is indexed
--   by the depth of each <a>Level</a>.
--   
--   <pre>
--   &gt;&gt;&gt; ["dog","cat"]^@..levels (traverse.traverse) &lt;. traverse
--   [(2,'d'),(3,'o'),(3,'c'),(4,'g'),(4,'a'),(5,'t')]
--   </pre>
--   
--   <pre>
--   <a>levels</a> :: <a>Traversal</a> s t a b      -&gt; <a>IndexedTraversal</a> <a>Int</a> s t (<a>Level</a> () a) (<a>Level</a> () b)
--   <a>levels</a> :: <a>Fold</a> s a               -&gt; <a>IndexedFold</a> <a>Int</a> s (<a>Level</a> () a)
--   </pre>
--   
--   <i>Note:</i> Internally this is implemented by using an illegal
--   <a>Applicative</a>, as it extracts information in an order that
--   violates the <a>Applicative</a> laws.
levels :: Applicative f => Traversing ((->) :: * -> * -> *) f s t a b -> IndexedLensLike Int f s t Level () a Level () b

-- | Sequence a container using a specified <a>Applicative</a>.
--   
--   This is like <a>traverseBy</a> where the <a>Traversable</a> instance
--   can be specified by any <a>Traversal</a>
--   
--   <pre>
--   <a>sequenceByOf</a> <a>traverse</a> ≡ <a>sequenceBy</a>
--   </pre>
sequenceByOf :: () => Traversal s t f b b -> forall x. () => x -> f x -> forall x y. () => f x -> y -> f x -> f y -> s -> f t

-- | Traverse a container using a specified <a>Applicative</a>.
--   
--   This is like <a>traverseBy</a> where the <a>Traversable</a> instance
--   can be specified by any <a>Traversal</a>
--   
--   <pre>
--   <a>traverseByOf</a> <a>traverse</a> ≡ <a>traverseBy</a>
--   </pre>
traverseByOf :: () => Traversal s t a b -> forall x. () => x -> f x -> forall x y. () => f x -> y -> f x -> f y -> a -> f b -> s -> f t

-- | <a>Fuse</a> a <a>Traversal</a> by reassociating all of the
--   <a>&lt;*&gt;</a> operations to the left and fusing all of the
--   <a>fmap</a> calls into one. This is particularly useful when
--   constructing a <a>Traversal</a> using operations from
--   <a>GHC.Generics</a>.
--   
--   Given a pair of <a>Traversal</a>s <tt>foo</tt> and <tt>bar</tt>,
--   
--   <pre>
--   <a>confusing</a> (foo.bar) = foo.bar
--   </pre>
--   
--   However, <tt>foo</tt> and <tt>bar</tt> are each going to use the
--   <a>Applicative</a> they are given.
--   
--   <a>confusing</a> exploits the <a>Yoneda</a> lemma to merge their
--   separate uses of <a>fmap</a> into a single <a>fmap</a>. and it further
--   exploits an interesting property of the right Kan lift (or
--   <a>Curried</a>) to left associate all of the uses of '(<a>*</a>)' to
--   make it possible to fuse together more fmaps.
--   
--   This is particularly effective when the choice of functor <tt>f</tt>
--   is unknown at compile time or when the <a>Traversal</a>
--   <tt>foo.bar</tt> in the above description is recursive or complex
--   enough to prevent inlining.
--   
--   <a>fusing</a> is a version of this combinator suitable for fusing
--   lenses.
--   
--   <pre>
--   <a>confusing</a> :: <a>Traversal</a> s t a b -&gt; <a>Traversal</a> s t a b
--   </pre>
confusing :: Applicative f => LensLike Curried Yoneda f Yoneda f s t a b -> LensLike f s t a b

-- | Try the second traversal. If it returns no entries, try again with all
--   entries from the first traversal, recursively.
--   
--   <pre>
--   <a>deepOf</a> :: <a>Fold</a> s s          -&gt; <a>Fold</a> s a                   -&gt; <a>Fold</a> s a
--   <a>deepOf</a> :: <a>Traversal'</a> s s    -&gt; <a>Traversal'</a> s a             -&gt; <a>Traversal'</a> s a
--   <a>deepOf</a> :: <a>Traversal</a> s t s t -&gt; <a>Traversal</a> s t a b          -&gt; <a>Traversal</a> s t a b
--   <a>deepOf</a> :: <a>Fold</a> s s          -&gt; <a>IndexedFold</a> i s a          -&gt; <a>IndexedFold</a> i s a
--   <a>deepOf</a> :: <a>Traversal</a> s t s t -&gt; <a>IndexedTraversal</a> i s t a b -&gt; <a>IndexedTraversal</a> i s t a b
--   </pre>
deepOf :: (Conjoined p, Applicative f) => LensLike f s t s t -> Traversing p f s t a b -> Over p f s t a b

-- | Try the first <a>Traversal</a> (or <a>Fold</a>), falling back on the
--   second <a>Traversal</a> (or <a>Fold</a>) if it returns no entries.
--   
--   This is only a valid <a>Traversal</a> if the second <a>Traversal</a>
--   is disjoint from the result of the first or returns exactly the same
--   results. These conditions are trivially met when given a <a>Lens</a>,
--   <a>Iso</a>, <a>Getter</a>, <a>Prism</a> or "affine" Traversal -- one
--   that has 0 or 1 target.
--   
--   Mutatis mutandis for <a>Fold</a>.
--   
--   <pre>
--   &gt;&gt;&gt; [0,1,2,3] ^? failing (ix 1) (ix 2)
--   Just 1
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [0,1,2,3] ^? failing (ix 42) (ix 2)
--   Just 2
--   </pre>
--   
--   <pre>
--   <a>failing</a> :: <a>Traversal</a> s t a b -&gt; <a>Traversal</a> s t a b -&gt; <a>Traversal</a> s t a b
--   <a>failing</a> :: <a>Prism</a> s t a b     -&gt; <a>Prism</a> s t a b     -&gt; <a>Traversal</a> s t a b
--   <a>failing</a> :: <a>Fold</a> s a          -&gt; <a>Fold</a> s a          -&gt; <a>Fold</a> s a
--   </pre>
--   
--   These cases are also supported, trivially, but are boring, because the
--   left hand side always succeeds.
--   
--   <pre>
--   <a>failing</a> :: <a>Lens</a> s t a b      -&gt; <a>Traversal</a> s t a b -&gt; <a>Traversal</a> s t a b
--   <a>failing</a> :: <a>Iso</a> s t a b       -&gt; <a>Traversal</a> s t a b -&gt; <a>Traversal</a> s t a b
--   <a>failing</a> :: <a>Equality</a> s t a b  -&gt; <a>Traversal</a> s t a b -&gt; <a>Traversal</a> s t a b
--   <a>failing</a> :: <a>Getter</a> s a        -&gt; <a>Fold</a> s a          -&gt; <a>Fold</a> s a
--   </pre>
--   
--   If both of the inputs are indexed, the result is also indexed, so you
--   can apply this to a pair of indexed traversals or indexed folds,
--   obtaining an indexed traversal or indexed fold.
--   
--   <pre>
--   <a>failing</a> :: <a>IndexedTraversal</a> i s t a b -&gt; <a>IndexedTraversal</a> i s t a b -&gt; <a>IndexedTraversal</a> i s t a b
--   <a>failing</a> :: <a>IndexedFold</a> i s a          -&gt; <a>IndexedFold</a> i s a          -&gt; <a>IndexedFold</a> i s a
--   </pre>
--   
--   These cases are also supported, trivially, but are boring, because the
--   left hand side always succeeds.
--   
--   <pre>
--   <a>failing</a> :: <a>IndexedLens</a> i s t a b      -&gt; <a>IndexedTraversal</a> i s t a b -&gt; <a>IndexedTraversal</a> i s t a b
--   <a>failing</a> :: <a>IndexedGetter</a> i s a        -&gt; <a>IndexedGetter</a> i s a        -&gt; <a>IndexedFold</a> i s a
--   </pre>
failing :: (Conjoined p, Applicative f) => Traversing p f s t a b -> Over p f s t a b -> Over p f s t a b
infixl 5 `failing`

-- | Try to map a function which uses the index over this
--   <a>IndexedTraversal</a>, failing if the <a>IndexedTraversal</a> has no
--   targets.
--   
--   <pre>
--   <a>ifailover</a> :: Alternative m =&gt; IndexedTraversal i s t a b -&gt; (i -&gt; a -&gt; b) -&gt; s -&gt; m t
--   </pre>
ifailover :: Alternative m => Over Indexed i (,) Any s t a b -> i -> a -> b -> s -> m t

-- | Try to map a function over this <a>Traversal</a>, failing if the
--   <a>Traversal</a> has no targets.
--   
--   <pre>
--   &gt;&gt;&gt; failover (element 3) (*2) [1,2] :: Maybe [Int]
--   Nothing
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; failover _Left (*2) (Right 4) :: Maybe (Either Int Int)
--   Nothing
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; failover _Right (*2) (Right 4) :: Maybe (Either Int Int)
--   Just (Right 8)
--   </pre>
--   
--   <pre>
--   <a>failover</a> :: Alternative m =&gt; Traversal s t a b -&gt; (a -&gt; b) -&gt; s -&gt; m t
--   </pre>
failover :: Alternative m => LensLike (,) Any s t a b -> a -> b -> s -> m t

-- | Traverse elements of a <a>Traversable</a> container where their
--   ordinal positions match a predicate.
--   
--   <pre>
--   <a>elements</a> ≡ <a>elementsOf</a> <a>traverse</a>
--   </pre>
elements :: Traversable t => Int -> Bool -> IndexedTraversal' Int t a a

-- | Traverse (or fold) selected elements of a <a>Traversal</a> (or
--   <a>Fold</a>) where their ordinal positions match a predicate.
--   
--   <pre>
--   <a>elementsOf</a> :: <a>Traversal'</a> s a -&gt; (<a>Int</a> -&gt; <a>Bool</a>) -&gt; <a>IndexedTraversal'</a> <a>Int</a> s a
--   <a>elementsOf</a> :: <a>Fold</a> s a       -&gt; (<a>Int</a> -&gt; <a>Bool</a>) -&gt; <a>IndexedFold</a> <a>Int</a> s a
--   </pre>
elementsOf :: Applicative f => LensLike Indexing f s t a a -> Int -> Bool -> IndexedLensLike Int f s t a a

-- | Traverse the <i>nth</i> element of a <a>Traversable</a> container.
--   
--   <pre>
--   <a>element</a> ≡ <a>elementOf</a> <a>traverse</a>
--   </pre>
element :: Traversable t => Int -> IndexedTraversal' Int t a a

-- | Traverse the <i>nth</i> <a>elementOf</a> a <a>Traversal</a>,
--   <a>Lens</a> or <a>Iso</a> if it exists.
--   
--   <pre>
--   &gt;&gt;&gt; [[1],[3,4]] &amp; elementOf (traverse.traverse) 1 .~ 5
--   [[1],[5,4]]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [[1],[3,4]] ^? elementOf (folded.folded) 1
--   Just 3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; timingOut $ ['a'..] ^?! elementOf folded 5
--   'f'
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; timingOut $ take 10 $ elementOf traverse 3 .~ 16 $ [0..]
--   [0,1,2,16,4,5,6,7,8,9]
--   </pre>
--   
--   <pre>
--   <a>elementOf</a> :: <a>Traversal'</a> s a -&gt; <a>Int</a> -&gt; <a>IndexedTraversal'</a> <a>Int</a> s a
--   <a>elementOf</a> :: <a>Fold</a> s a       -&gt; <a>Int</a> -&gt; <a>IndexedFold</a> <a>Int</a> s a
--   </pre>
elementOf :: Applicative f => LensLike Indexing f s t a a -> Int -> IndexedLensLike Int f s t a a

-- | This is the trivial empty <a>Traversal</a>.
--   
--   <pre>
--   <a>ignored</a> :: <a>IndexedTraversal</a> i s s a b
--   </pre>
--   
--   <pre>
--   <a>ignored</a> ≡ <a>const</a> <a>pure</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 6 &amp; ignored %~ absurd
--   6
--   </pre>
ignored :: Applicative f => pafb -> s -> f s

-- | Traverse any <a>Traversable</a> container. This is an
--   <a>IndexedTraversal</a> that is indexed by ordinal position.
traversed64 :: Traversable f => IndexedTraversal Int64 f a f b a b

-- | Traverse any <a>Traversable1</a> container. This is an
--   <a>IndexedTraversal1</a> that is indexed by ordinal position.
traversed1 :: Traversable1 f => IndexedTraversal1 Int f a f b a b

-- | Traverse any <a>Traversable</a> container. This is an
--   <a>IndexedTraversal</a> that is indexed by ordinal position.
traversed :: Traversable f => IndexedTraversal Int f a f b a b

-- | Generalizes <a>mapAccumL</a> to an arbitrary <a>IndexedTraversal</a>
--   with access to the index.
--   
--   <a>imapAccumLOf</a> accumulates state from left to right.
--   
--   <pre>
--   <a>mapAccumLOf</a> l ≡ <a>imapAccumLOf</a> l <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>imapAccumLOf</a> :: <a>IndexedLens</a> i s t a b      -&gt; (i -&gt; acc -&gt; a -&gt; (acc, b)) -&gt; acc -&gt; s -&gt; (acc, t)
--   <a>imapAccumLOf</a> :: <a>IndexedTraversal</a> i s t a b -&gt; (i -&gt; acc -&gt; a -&gt; (acc, b)) -&gt; acc -&gt; s -&gt; (acc, t)
--   </pre>
imapAccumLOf :: () => Over Indexed i State acc s t a b -> i -> acc -> a -> (acc, b) -> acc -> s -> (acc, t)

-- | Generalizes <a>mapAccumR</a> to an arbitrary <a>IndexedTraversal</a>
--   with access to the index.
--   
--   <a>imapAccumROf</a> accumulates state from right to left.
--   
--   <pre>
--   <a>mapAccumROf</a> l ≡ <a>imapAccumROf</a> l <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>imapAccumROf</a> :: <a>IndexedLens</a> i s t a b      -&gt; (i -&gt; acc -&gt; a -&gt; (acc, b)) -&gt; acc -&gt; s -&gt; (acc, t)
--   <a>imapAccumROf</a> :: <a>IndexedTraversal</a> i s t a b -&gt; (i -&gt; acc -&gt; a -&gt; (acc, b)) -&gt; acc -&gt; s -&gt; (acc, t)
--   </pre>
imapAccumROf :: () => Over Indexed i Backwards State acc s t a b -> i -> acc -> a -> (acc, b) -> acc -> s -> (acc, t)

-- | Map each element of a structure targeted by a <a>Lens</a> to a monadic
--   action, evaluate these actions from left to right, and collect the
--   results, with access its position (and the arguments flipped).
--   
--   <pre>
--   <a>forMOf</a> l a ≡ <a>iforMOf</a> l a <a>.</a> <a>const</a>
--   <a>iforMOf</a> ≡ <a>flip</a> <a>.</a> <a>imapMOf</a>
--   </pre>
--   
--   <pre>
--   <a>iforMOf</a> :: <a>Monad</a> m =&gt; <a>IndexedLens</a> i s t a b      -&gt; s -&gt; (i -&gt; a -&gt; m b) -&gt; m t
--   <a>iforMOf</a> :: <a>Monad</a> m =&gt; <a>IndexedTraversal</a> i s t a b -&gt; s -&gt; (i -&gt; a -&gt; m b) -&gt; m t
--   </pre>
iforMOf :: () => Indexed i a WrappedMonad m b -> s -> WrappedMonad m t -> s -> i -> a -> m b -> m t

-- | Map each element of a structure targeted by a <a>Lens</a> to a monadic
--   action, evaluate these actions from left to right, and collect the
--   results, with access its position.
--   
--   When you don't need access to the index <a>mapMOf</a> is more liberal
--   in what it can accept.
--   
--   <pre>
--   <a>mapMOf</a> l ≡ <a>imapMOf</a> l <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>imapMOf</a> :: <a>Monad</a> m =&gt; <a>IndexedLens</a>       i s t a b -&gt; (i -&gt; a -&gt; m b) -&gt; s -&gt; m t
--   <a>imapMOf</a> :: <a>Monad</a> m =&gt; <a>IndexedTraversal</a>  i s t a b -&gt; (i -&gt; a -&gt; m b) -&gt; s -&gt; m t
--   <a>imapMOf</a> :: <tt>Bind</tt>  m =&gt; <a>IndexedTraversal1</a> i s t a b -&gt; (i -&gt; a -&gt; m b) -&gt; s -&gt; m t
--   </pre>
imapMOf :: () => Over Indexed i WrappedMonad m s t a b -> i -> a -> m b -> s -> m t

-- | Traverse with an index (and the arguments flipped).
--   
--   <pre>
--   <a>forOf</a> l a ≡ <a>iforOf</a> l a <a>.</a> <a>const</a>
--   <a>iforOf</a> ≡ <a>flip</a> <a>.</a> <a>itraverseOf</a>
--   </pre>
--   
--   <pre>
--   <a>iforOf</a> :: <a>Functor</a> f     =&gt; <a>IndexedLens</a> i s t a b       -&gt; s -&gt; (i -&gt; a -&gt; f b) -&gt; f t
--   <a>iforOf</a> :: <a>Applicative</a> f =&gt; <a>IndexedTraversal</a> i s t a b  -&gt; s -&gt; (i -&gt; a -&gt; f b) -&gt; f t
--   <a>iforOf</a> :: <tt>Apply</tt> f       =&gt; <a>IndexedTraversal1</a> i s t a b -&gt; s -&gt; (i -&gt; a -&gt; f b) -&gt; f t
--   </pre>
iforOf :: () => Indexed i a f b -> s -> f t -> s -> i -> a -> f b -> f t

-- | Traversal with an index.
--   
--   <i>NB:</i> When you don't need access to the index then you can just
--   apply your <a>IndexedTraversal</a> directly as a function!
--   
--   <pre>
--   <a>itraverseOf</a> ≡ <a>withIndex</a>
--   <a>traverseOf</a> l = <a>itraverseOf</a> l <a>.</a> <a>const</a> = <a>id</a>
--   </pre>
--   
--   <pre>
--   <a>itraverseOf</a> :: <a>Functor</a> f     =&gt; <a>IndexedLens</a> i s t a b       -&gt; (i -&gt; a -&gt; f b) -&gt; s -&gt; f t
--   <a>itraverseOf</a> :: <a>Applicative</a> f =&gt; <a>IndexedTraversal</a> i s t a b  -&gt; (i -&gt; a -&gt; f b) -&gt; s -&gt; f t
--   <a>itraverseOf</a> :: <tt>Apply</tt> f       =&gt; <a>IndexedTraversal1</a> i s t a b -&gt; (i -&gt; a -&gt; f b) -&gt; s -&gt; f t
--   </pre>
itraverseOf :: () => Indexed i a f b -> s -> f t -> i -> a -> f b -> s -> f t

-- | Clone an <a>IndexedTraversal1</a> yielding an <a>IndexedTraversal1</a>
--   with the same index.
cloneIndexedTraversal1 :: () => AnIndexedTraversal1 i s t a b -> IndexedTraversal1 i s t a b

-- | Clone a <a>Traversal1</a> yielding an <a>IndexPreservingTraversal1</a>
--   that passes through whatever index it is composed with.
cloneIndexPreservingTraversal1 :: () => ATraversal1 s t a b -> IndexPreservingTraversal1 s t a b

-- | A <a>Traversal1</a> is completely characterized by its behavior on a
--   <a>Bazaar1</a>.
cloneTraversal1 :: () => ATraversal1 s t a b -> Traversal1 s t a b

-- | Clone an <a>IndexedTraversal</a> yielding an <a>IndexedTraversal</a>
--   with the same index.
cloneIndexedTraversal :: () => AnIndexedTraversal i s t a b -> IndexedTraversal i s t a b

-- | Clone a <a>Traversal</a> yielding an <a>IndexPreservingTraversal</a>
--   that passes through whatever index it is composed with.
cloneIndexPreservingTraversal :: () => ATraversal s t a b -> IndexPreservingTraversal s t a b

-- | A <a>Traversal</a> is completely characterized by its behavior on a
--   <a>Bazaar</a>.
--   
--   Cloning a <a>Traversal</a> is one way to make sure you aren't given
--   something weaker, such as a <a>Fold</a> and can be used as a way to
--   pass around traversals that have to be monomorphic in <tt>f</tt>.
--   
--   Note: This only accepts a proper <a>Traversal</a> (or <a>Lens</a>). To
--   clone a <a>Lens</a> as such, use <a>cloneLens</a>.
--   
--   Note: It is usually better to use <a>ReifiedTraversal</a> and
--   <a>runTraversal</a> than to <a>cloneTraversal</a>. The former can
--   execute at full speed, while the latter needs to round trip through
--   the <a>Bazaar</a>.
--   
--   <pre>
--   &gt;&gt;&gt; let foo l a = (view (getting (cloneTraversal l)) a, set (cloneTraversal l) 10 a)
--   
--   &gt;&gt;&gt; foo both ("hello","world")
--   ("helloworld",(10,10))
--   </pre>
--   
--   <pre>
--   <a>cloneTraversal</a> :: <a>LensLike</a> (<a>Bazaar</a> (-&gt;) a b) s t a b -&gt; <a>Traversal</a> s t a b
--   </pre>
cloneTraversal :: () => ATraversal s t a b -> Traversal s t a b

-- | Visit all but the first <i>n</i> targets of a <a>Traversal</a>,
--   <a>Fold</a>, <a>Getter</a> or <a>Lens</a>.
--   
--   <pre>
--   &gt;&gt;&gt; ("hello","world") ^? dropping 1 both
--   Just "world"
--   </pre>
--   
--   Dropping works on infinite traversals as well:
--   
--   <pre>
--   &gt;&gt;&gt; [1..] ^? dropping 1 folded
--   Just 2
--   </pre>
--   
--   <pre>
--   <a>dropping</a> :: <a>Int</a> -&gt; <a>Traversal'</a> s a                   -&gt; <a>Traversal'</a> s a
--   <a>dropping</a> :: <a>Int</a> -&gt; <a>Lens'</a> s a                        -&gt; <a>Traversal'</a> s a
--   <a>dropping</a> :: <a>Int</a> -&gt; <a>Iso'</a> s a                         -&gt; <a>Traversal'</a> s a
--   <a>dropping</a> :: <a>Int</a> -&gt; <a>Prism'</a> s a                       -&gt; <a>Traversal'</a> s a
--   <a>dropping</a> :: <a>Int</a> -&gt; <a>Getter</a> s a                       -&gt; <a>Fold</a> s a
--   <a>dropping</a> :: <a>Int</a> -&gt; <a>Fold</a> s a                         -&gt; <a>Fold</a> s a
--   <a>dropping</a> :: <a>Int</a> -&gt; <a>IndexedTraversal'</a> i s a          -&gt; <a>IndexedTraversal'</a> i s a
--   <a>dropping</a> :: <a>Int</a> -&gt; <a>IndexedLens'</a> i s a               -&gt; <a>IndexedTraversal'</a> i s a
--   <a>dropping</a> :: <a>Int</a> -&gt; <a>IndexedGetter</a> i s a              -&gt; <a>IndexedFold</a> i s a
--   <a>dropping</a> :: <a>Int</a> -&gt; <a>IndexedFold</a> i s a                -&gt; <a>IndexedFold</a> i s a
--   </pre>
dropping :: (Conjoined p, Applicative f) => Int -> Over p Indexing f s t a a -> Over p f s t a a

-- | Visit the first <i>n</i> targets of a <a>Traversal</a>, <a>Fold</a>,
--   <a>Getter</a> or <a>Lens</a>.
--   
--   <pre>
--   &gt;&gt;&gt; [("hello","world"),("!!!","!!!")]^.. taking 2 (traverse.both)
--   ["hello","world"]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; timingOut $ [1..] ^.. taking 3 traverse
--   [1,2,3]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; over (taking 5 traverse) succ "hello world"
--   "ifmmp world"
--   </pre>
--   
--   <pre>
--   <a>taking</a> :: <a>Int</a> -&gt; <a>Traversal'</a> s a                   -&gt; <a>Traversal'</a> s a
--   <a>taking</a> :: <a>Int</a> -&gt; <a>Lens'</a> s a                        -&gt; <a>Traversal'</a> s a
--   <a>taking</a> :: <a>Int</a> -&gt; <a>Iso'</a> s a                         -&gt; <a>Traversal'</a> s a
--   <a>taking</a> :: <a>Int</a> -&gt; <a>Prism'</a> s a                       -&gt; <a>Traversal'</a> s a
--   <a>taking</a> :: <a>Int</a> -&gt; <a>Getter</a> s a                       -&gt; <a>Fold</a> s a
--   <a>taking</a> :: <a>Int</a> -&gt; <a>Fold</a> s a                         -&gt; <a>Fold</a> s a
--   <a>taking</a> :: <a>Int</a> -&gt; <a>IndexedTraversal'</a> i s a          -&gt; <a>IndexedTraversal'</a> i s a
--   <a>taking</a> :: <a>Int</a> -&gt; <a>IndexedLens'</a> i s a               -&gt; <a>IndexedTraversal'</a> i s a
--   <a>taking</a> :: <a>Int</a> -&gt; <a>IndexedGetter</a> i s a              -&gt; <a>IndexedFold</a> i s a
--   <a>taking</a> :: <a>Int</a> -&gt; <a>IndexedFold</a> i s a                -&gt; <a>IndexedFold</a> i s a
--   </pre>
taking :: (Conjoined p, Applicative f) => Int -> Traversing p f s t a a -> Over p f s t a a

-- | Apply a different <a>Traversal</a> or <a>Fold</a> to each side of a
--   <a>Bitraversable</a> container.
--   
--   <pre>
--   <a>beside</a> :: <a>Traversal</a> s t a b                -&gt; <a>Traversal</a> s' t' a b                -&gt; <a>Traversal</a> (r s s') (r t t') a b
--   <a>beside</a> :: <a>IndexedTraversal</a> i s t a b       -&gt; <a>IndexedTraversal</a> i s' t' a b       -&gt; <a>IndexedTraversal</a> i (r s s') (r t t') a b
--   <a>beside</a> :: <a>IndexPreservingTraversal</a> s t a b -&gt; <a>IndexPreservingTraversal</a> s' t' a b -&gt; <a>IndexPreservingTraversal</a> (r s s') (r t t') a b
--   </pre>
--   
--   <pre>
--   <a>beside</a> :: <a>Traversal</a> s t a b                -&gt; <a>Traversal</a> s' t' a b                -&gt; <a>Traversal</a> (s,s') (t,t') a b
--   <a>beside</a> :: <a>Lens</a> s t a b                     -&gt; <a>Lens</a> s' t' a b                     -&gt; <a>Traversal</a> (s,s') (t,t') a b
--   <a>beside</a> :: <a>Fold</a> s a                         -&gt; <a>Fold</a> s' a                          -&gt; <a>Fold</a> (s,s') a
--   <a>beside</a> :: <a>Getter</a> s a                       -&gt; <a>Getter</a> s' a                        -&gt; <a>Fold</a> (s,s') a
--   </pre>
--   
--   <pre>
--   <a>beside</a> :: <a>IndexedTraversal</a> i s t a b       -&gt; <a>IndexedTraversal</a> i s' t' a b       -&gt; <a>IndexedTraversal</a> i (s,s') (t,t') a b
--   <a>beside</a> :: <a>IndexedLens</a> i s t a b            -&gt; <a>IndexedLens</a> i s' t' a b            -&gt; <a>IndexedTraversal</a> i (s,s') (t,t') a b
--   <a>beside</a> :: <a>IndexedFold</a> i s a                -&gt; <a>IndexedFold</a> i s' a                 -&gt; <a>IndexedFold</a> i (s,s') a
--   <a>beside</a> :: <a>IndexedGetter</a> i s a              -&gt; <a>IndexedGetter</a> i s' a               -&gt; <a>IndexedFold</a> i (s,s') a
--   </pre>
--   
--   <pre>
--   <a>beside</a> :: <a>IndexPreservingTraversal</a> s t a b -&gt; <a>IndexPreservingTraversal</a> s' t' a b -&gt; <a>IndexPreservingTraversal</a> (s,s') (t,t') a b
--   <a>beside</a> :: <a>IndexPreservingLens</a> s t a b      -&gt; <a>IndexPreservingLens</a> s' t' a b      -&gt; <a>IndexPreservingTraversal</a> (s,s') (t,t') a b
--   <a>beside</a> :: <a>IndexPreservingFold</a> s a          -&gt; <a>IndexPreservingFold</a> s' a           -&gt; <a>IndexPreservingFold</a> (s,s') a
--   <a>beside</a> :: <a>IndexPreservingGetter</a> s a        -&gt; <a>IndexPreservingGetter</a> s' a         -&gt; <a>IndexPreservingFold</a> (s,s') a
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; ("hello",["world","!!!"])^..beside id traverse
--   ["hello","world","!!!"]
--   </pre>
beside :: (Representable q, Applicative Rep q, Applicative f, Bitraversable r) => Optical p q f s t a b -> Optical p q f s' t' a b -> Optical p q f r s s' r t t' a b

-- | Traverse both parts of a <a>Bitraversable1</a> container with matching
--   types.
--   
--   Usually that type will be a pair.
--   
--   <pre>
--   <a>both1</a> :: <a>Traversal1</a> (a, a)       (b, b)       a b
--   <a>both1</a> :: <a>Traversal1</a> (<a>Either</a> a a) (<a>Either</a> b b) a b
--   </pre>
both1 :: Bitraversable1 r => Traversal1 r a a r b b a b

-- | Traverse both parts of a <a>Bitraversable</a> container with matching
--   types.
--   
--   Usually that type will be a pair.
--   
--   <pre>
--   &gt;&gt;&gt; (1,2) &amp; both *~ 10
--   (10,20)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; over both length ("hello","world")
--   (5,5)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; ("hello","world")^.both
--   "helloworld"
--   </pre>
--   
--   <pre>
--   <a>both</a> :: <a>Traversal</a> (a, a)       (b, b)       a b
--   <a>both</a> :: <a>Traversal</a> (<a>Either</a> a a) (<a>Either</a> b b) a b
--   </pre>
both :: Bitraversable r => Traversal r a a r b b a b

-- | The one-level version of <a>contextsOf</a>. This extracts a list of
--   the immediate children according to a given <a>Traversal</a> as
--   editable contexts.
--   
--   Given a context you can use <a>pos</a> to see the values, <a>peek</a>
--   at what the structure would be like with an edited result, or simply
--   <a>extract</a> the original structure.
--   
--   <pre>
--   propChildren l x = <a>toListOf</a> l x <a>==</a> <a>map</a> <a>pos</a> (<a>holesOf</a> l x)
--   propId l x = <a>all</a> (<a>==</a> x) [<a>extract</a> w | w &lt;- <a>holesOf</a> l x]
--   </pre>
--   
--   <pre>
--   <a>holesOf</a> :: <a>Iso'</a> s a                -&gt; s -&gt; [<a>Pretext'</a> (-&gt;) a s]
--   <a>holesOf</a> :: <a>Lens'</a> s a               -&gt; s -&gt; [<a>Pretext'</a> (-&gt;) a s]
--   <a>holesOf</a> :: <a>Traversal'</a> s a          -&gt; s -&gt; [<a>Pretext'</a> (-&gt;) a s]
--   <a>holesOf</a> :: <a>IndexedLens'</a> i s a      -&gt; s -&gt; [<a>Pretext'</a> (<a>Indexed</a> i) a s]
--   <a>holesOf</a> :: <a>IndexedTraversal'</a> i s a -&gt; s -&gt; [<a>Pretext'</a> (<a>Indexed</a> i) a s]
--   </pre>
holesOf :: Conjoined p => Over p Bazaar p a a s t a a -> s -> [Pretext p a a t]

-- | This converts a <a>Traversal</a> that you "know" will target only one
--   element to a <a>Lens</a>. It can also be used to transform a
--   <a>Fold</a> into a <a>Getter</a>.
--   
--   The resulting <a>Lens</a> or <a>Getter</a> will be partial if the
--   <a>Traversal</a> targets nothing or more than one element.
--   
--   <pre>
--   &gt;&gt;&gt; Left (ErrorCall "unsafeSingular: empty traversal") &lt;- try (evaluate ([] &amp; unsafeSingular traverse .~ 0)) :: IO (Either ErrorCall [Integer])
--   </pre>
--   
--   <pre>
--   <a>unsafeSingular</a> :: <a>Traversal</a> s t a b          -&gt; <a>Lens</a> s t a b
--   <a>unsafeSingular</a> :: <a>Fold</a> s a                   -&gt; <a>Getter</a> s a
--   <a>unsafeSingular</a> :: <a>IndexedTraversal</a> i s t a b -&gt; <a>IndexedLens</a> i s t a b
--   <a>unsafeSingular</a> :: <a>IndexedFold</a> i s a          -&gt; <a>IndexedGetter</a> i s a
--   </pre>
unsafeSingular :: (HasCallStack, Conjoined p, Functor f) => Traversing p f s t a b -> Over p f s t a b

-- | This converts a <a>Traversal</a> that you "know" will target one or
--   more elements to a <a>Lens</a>. It can also be used to transform a
--   non-empty <a>Fold</a> into a <a>Getter</a>.
--   
--   The resulting <a>Lens</a> or <a>Getter</a> will be partial if the
--   supplied <a>Traversal</a> returns no results.
--   
--   <pre>
--   &gt;&gt;&gt; [1,2,3] ^. singular _head
--   1
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Left (ErrorCall "singular: empty traversal") &lt;- try (evaluate ([] ^. singular _head)) :: IO (Either ErrorCall ())
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Left 4 ^. singular _Left
--   4
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [1..10] ^. singular (ix 7)
--   8
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [] &amp; singular traverse .~ 0
--   []
--   </pre>
--   
--   <pre>
--   <a>singular</a> :: <a>Traversal</a> s t a a          -&gt; <a>Lens</a> s t a a
--   <a>singular</a> :: <a>Fold</a> s a                   -&gt; <a>Getter</a> s a
--   <a>singular</a> :: <a>IndexedTraversal</a> i s t a a -&gt; <a>IndexedLens</a> i s t a a
--   <a>singular</a> :: <a>IndexedFold</a> i s a          -&gt; <a>IndexedGetter</a> i s a
--   </pre>
singular :: (HasCallStack, Conjoined p, Functor f) => Traversing p f s t a a -> Over p f s t a a
iunsafePartsOf' :: () => Over Indexed i Bazaar Indexed i a b s t a b -> IndexedLens [i] s t [a] [b]
unsafePartsOf' :: () => ATraversal s t a b -> Lens s t [a] [b]

-- | An indexed version of <a>unsafePartsOf</a> that receives the entire
--   list of indices as its index.
iunsafePartsOf :: (Indexable [i] p, Functor f) => Traversing Indexed i f s t a b -> Over p f s t [a] [b]

-- | <a>unsafePartsOf</a> turns a <a>Traversal</a> into a <a>uniplate</a>
--   (or <a>biplate</a>) family.
--   
--   If you do not need the types of <tt>s</tt> and <tt>t</tt> to be
--   different, it is recommended that you use <a>partsOf</a>.
--   
--   It is generally safer to traverse with the <a>Bazaar</a> rather than
--   use this combinator. However, it is sometimes convenient.
--   
--   This is unsafe because if you don't supply at least as many
--   <tt>b</tt>'s as you were given <tt>a</tt>'s, then the reconstruction
--   of <tt>t</tt> <i>will</i> result in an error!
--   
--   When applied to a <a>Fold</a> the result is merely a <a>Getter</a>
--   (and becomes safe).
--   
--   <pre>
--   <a>unsafePartsOf</a> :: <a>Iso</a> s t a b       -&gt; <a>Lens</a> s t [a] [b]
--   <a>unsafePartsOf</a> :: <a>Lens</a> s t a b      -&gt; <a>Lens</a> s t [a] [b]
--   <a>unsafePartsOf</a> :: <a>Traversal</a> s t a b -&gt; <a>Lens</a> s t [a] [b]
--   <a>unsafePartsOf</a> :: <a>Fold</a> s a          -&gt; <a>Getter</a> s [a]
--   <a>unsafePartsOf</a> :: <a>Getter</a> s a        -&gt; <a>Getter</a> s [a]
--   </pre>
unsafePartsOf :: Functor f => Traversing ((->) :: * -> * -> *) f s t a b -> LensLike f s t [a] [b]

-- | A type-restricted version of <a>ipartsOf</a> that can only be used
--   with an <a>IndexedTraversal</a>.
ipartsOf' :: (Indexable [i] p, Functor f) => Over Indexed i Bazaar' Indexed i a s t a a -> Over p f s t [a] [a]

-- | A type-restricted version of <a>partsOf</a> that can only be used with
--   a <a>Traversal</a>.
partsOf' :: () => ATraversal s t a a -> Lens s t [a] [a]

-- | An indexed version of <a>partsOf</a> that receives the entire list of
--   indices as its index.
ipartsOf :: (Indexable [i] p, Functor f) => Traversing Indexed i f s t a a -> Over p f s t [a] [a]

-- | <a>partsOf</a> turns a <a>Traversal</a> into a <a>Lens</a> that
--   resembles an early version of the <a>uniplate</a> (or <a>biplate</a>)
--   type.
--   
--   <i>Note:</i> You should really try to maintain the invariant of the
--   number of children in the list.
--   
--   <pre>
--   &gt;&gt;&gt; (a,b,c) &amp; partsOf each .~ [x,y,z]
--   (x,y,z)
--   </pre>
--   
--   Any extras will be lost. If you do not supply enough, then the
--   remainder will come from the original structure.
--   
--   <pre>
--   &gt;&gt;&gt; (a,b,c) &amp; partsOf each .~ [w,x,y,z]
--   (w,x,y)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (a,b,c) &amp; partsOf each .~ [x,y]
--   (x,y,c)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; ('b', 'a', 'd', 'c') &amp; partsOf each %~ sort
--   ('a','b','c','d')
--   </pre>
--   
--   So technically, this is only a <a>Lens</a> if you do not change the
--   number of results it returns.
--   
--   When applied to a <a>Fold</a> the result is merely a <a>Getter</a>.
--   
--   <pre>
--   <a>partsOf</a> :: <a>Iso'</a> s a       -&gt; <a>Lens'</a> s [a]
--   <a>partsOf</a> :: <a>Lens'</a> s a      -&gt; <a>Lens'</a> s [a]
--   <a>partsOf</a> :: <a>Traversal'</a> s a -&gt; <a>Lens'</a> s [a]
--   <a>partsOf</a> :: <a>Fold</a> s a       -&gt; <a>Getter</a> s [a]
--   <a>partsOf</a> :: <a>Getter</a> s a     -&gt; <a>Getter</a> s [a]
--   </pre>
partsOf :: Functor f => Traversing ((->) :: * -> * -> *) f s t a a -> LensLike f s t [a] [a]

-- | This <a>IndexedTraversal</a> allows you to <a>traverse</a> the
--   individual stores in a <a>Bazaar</a> with access to their indices.
iloci :: (Indexable i p, Applicative f) => p a f b -> Bazaar Indexed i a c s -> f Bazaar Indexed i b c s

-- | This <a>Traversal</a> allows you to <a>traverse</a> the individual
--   stores in a <a>Bazaar</a>.
loci :: Applicative f => a -> f b -> Bazaar ((->) :: * -> * -> *) a c s -> f Bazaar ((->) :: * -> * -> *) b c s

-- | This permits the use of <a>scanl1</a> over an arbitrary
--   <a>Traversal</a> or <a>Lens</a>.
--   
--   <pre>
--   <a>scanl1</a> ≡ <a>scanl1Of</a> <a>traverse</a>
--   </pre>
--   
--   <pre>
--   <a>scanl1Of</a> :: <a>Iso</a> s t a a       -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; t
--   <a>scanl1Of</a> :: <a>Lens</a> s t a a      -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; t
--   <a>scanl1Of</a> :: <a>Traversal</a> s t a a -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; t
--   </pre>
scanl1Of :: () => LensLike State Maybe a s t a a -> a -> a -> a -> s -> t

-- | This permits the use of <a>scanr1</a> over an arbitrary
--   <a>Traversal</a> or <a>Lens</a>.
--   
--   <pre>
--   <a>scanr1</a> ≡ <a>scanr1Of</a> <a>traverse</a>
--   </pre>
--   
--   <pre>
--   <a>scanr1Of</a> :: <a>Iso</a> s t a a       -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; t
--   <a>scanr1Of</a> :: <a>Lens</a> s t a a      -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; t
--   <a>scanr1Of</a> :: <a>Traversal</a> s t a a -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; t
--   </pre>
scanr1Of :: () => LensLike Backwards State Maybe a s t a a -> a -> a -> a -> s -> t

-- | This generalizes <a>mapAccumL</a> to an arbitrary <a>Traversal</a>.
--   
--   <pre>
--   <a>mapAccumL</a> ≡ <a>mapAccumLOf</a> <a>traverse</a>
--   </pre>
--   
--   <a>mapAccumLOf</a> accumulates <a>State</a> from left to right.
--   
--   <pre>
--   <a>mapAccumLOf</a> :: <a>Iso</a> s t a b       -&gt; (acc -&gt; a -&gt; (acc, b)) -&gt; acc -&gt; s -&gt; (acc, t)
--   <a>mapAccumLOf</a> :: <a>Lens</a> s t a b      -&gt; (acc -&gt; a -&gt; (acc, b)) -&gt; acc -&gt; s -&gt; (acc, t)
--   <a>mapAccumLOf</a> :: <a>Traversal</a> s t a b -&gt; (acc -&gt; a -&gt; (acc, b)) -&gt; acc -&gt; s -&gt; (acc, t)
--   </pre>
--   
--   <pre>
--   <a>mapAccumLOf</a> :: <a>LensLike</a> (<a>State</a> acc) s t a b -&gt; (acc -&gt; a -&gt; (acc, b)) -&gt; acc -&gt; s -&gt; (acc, t)
--   <a>mapAccumLOf</a> l f acc0 s = <a>swap</a> (<a>runState</a> (l (a -&gt; <a>state</a> (acc -&gt; <a>swap</a> (f acc a))) s) acc0)
--   </pre>
mapAccumLOf :: () => LensLike State acc s t a b -> acc -> a -> (acc, b) -> acc -> s -> (acc, t)

-- | This generalizes <a>mapAccumR</a> to an arbitrary <a>Traversal</a>.
--   
--   <pre>
--   <a>mapAccumR</a> ≡ <a>mapAccumROf</a> <a>traverse</a>
--   </pre>
--   
--   <a>mapAccumROf</a> accumulates <a>State</a> from right to left.
--   
--   <pre>
--   <a>mapAccumROf</a> :: <a>Iso</a> s t a b       -&gt; (acc -&gt; a -&gt; (acc, b)) -&gt; acc -&gt; s -&gt; (acc, t)
--   <a>mapAccumROf</a> :: <a>Lens</a> s t a b      -&gt; (acc -&gt; a -&gt; (acc, b)) -&gt; acc -&gt; s -&gt; (acc, t)
--   <a>mapAccumROf</a> :: <a>Traversal</a> s t a b -&gt; (acc -&gt; a -&gt; (acc, b)) -&gt; acc -&gt; s -&gt; (acc, t)
--   </pre>
--   
--   <pre>
--   <a>mapAccumROf</a> :: <a>LensLike</a> (<a>Backwards</a> (<a>State</a> acc)) s t a b -&gt; (acc -&gt; a -&gt; (acc, b)) -&gt; acc -&gt; s -&gt; (acc, t)
--   </pre>
mapAccumROf :: () => LensLike Backwards State acc s t a b -> acc -> a -> (acc, b) -> acc -> s -> (acc, t)

-- | This generalizes <a>transpose</a> to an arbitrary <a>Traversal</a>.
--   
--   Note: <a>transpose</a> handles ragged inputs more intelligently, but
--   for non-ragged inputs:
--   
--   <pre>
--   &gt;&gt;&gt; transposeOf traverse [[1,2,3],[4,5,6]]
--   [[1,4],[2,5],[3,6]]
--   </pre>
--   
--   <pre>
--   <a>transpose</a> ≡ <a>transposeOf</a> <a>traverse</a>
--   </pre>
--   
--   Since every <a>Lens</a> is a <a>Traversal</a>, we can use this as a
--   form of monadic strength as well:
--   
--   <pre>
--   <a>transposeOf</a> <a>_2</a> :: (b, [a]) -&gt; [(b, a)]
--   </pre>
transposeOf :: () => LensLike ZipList s t [a] a -> s -> [t]

-- | Sequence the (monadic) effects targeted by a <a>Lens</a> in a
--   container from left to right.
--   
--   <pre>
--   &gt;&gt;&gt; sequenceOf each ([1,2],[3,4],[5,6])
--   [(1,3,5),(1,3,6),(1,4,5),(1,4,6),(2,3,5),(2,3,6),(2,4,5),(2,4,6)]
--   </pre>
--   
--   <pre>
--   <a>sequence</a> ≡ <a>sequenceOf</a> <a>traverse</a>
--   <a>sequenceOf</a> l ≡ <a>mapMOf</a> l <a>id</a>
--   <a>sequenceOf</a> l ≡ <a>unwrapMonad</a> <a>.</a> l <a>WrapMonad</a>
--   </pre>
--   
--   <pre>
--   <a>sequenceOf</a> :: <a>Monad</a> m =&gt; <a>Iso</a> s t (m b) b       -&gt; s -&gt; m t
--   <a>sequenceOf</a> :: <a>Monad</a> m =&gt; <a>Lens</a> s t (m b) b      -&gt; s -&gt; m t
--   <a>sequenceOf</a> :: <a>Monad</a> m =&gt; <a>Traversal</a> s t (m b) b -&gt; s -&gt; m t
--   </pre>
sequenceOf :: () => LensLike WrappedMonad m s t m b b -> s -> m t

-- | <a>forMOf</a> is a flipped version of <a>mapMOf</a>, consistent with
--   the definition of <a>forM</a>.
--   
--   <pre>
--   &gt;&gt;&gt; forMOf both (1,3) $ \x -&gt; [x, x + 1]
--   [(1,3),(1,4),(2,3),(2,4)]
--   </pre>
--   
--   <pre>
--   <a>forM</a> ≡ <a>forMOf</a> <a>traverse</a>
--   <a>forMOf</a> l ≡ <a>flip</a> (<a>mapMOf</a> l)
--   <a>iforMOf</a> l s ≡ <a>forM</a> l s <a>.</a> <a>Indexed</a>
--   </pre>
--   
--   <pre>
--   <a>forMOf</a> :: <a>Monad</a> m =&gt; <a>Iso</a> s t a b       -&gt; s -&gt; (a -&gt; m b) -&gt; m t
--   <a>forMOf</a> :: <a>Monad</a> m =&gt; <a>Lens</a> s t a b      -&gt; s -&gt; (a -&gt; m b) -&gt; m t
--   <a>forMOf</a> :: <a>Monad</a> m =&gt; <a>Traversal</a> s t a b -&gt; s -&gt; (a -&gt; m b) -&gt; m t
--   </pre>
forMOf :: () => LensLike WrappedMonad m s t a b -> s -> a -> m b -> m t

-- | Map each element of a structure targeted by a <a>Lens</a> to a monadic
--   action, evaluate these actions from left to right, and collect the
--   results.
--   
--   <pre>
--   &gt;&gt;&gt; mapMOf both (\x -&gt; [x, x + 1]) (1,3)
--   [(1,3),(1,4),(2,3),(2,4)]
--   </pre>
--   
--   <pre>
--   <a>mapM</a> ≡ <a>mapMOf</a> <a>traverse</a>
--   <a>imapMOf</a> l ≡ <a>forM</a> l <a>.</a> <a>Indexed</a>
--   </pre>
--   
--   <pre>
--   <a>mapMOf</a> :: <a>Monad</a> m =&gt; <a>Iso</a> s t a b       -&gt; (a -&gt; m b) -&gt; s -&gt; m t
--   <a>mapMOf</a> :: <a>Monad</a> m =&gt; <a>Lens</a> s t a b      -&gt; (a -&gt; m b) -&gt; s -&gt; m t
--   <a>mapMOf</a> :: <a>Monad</a> m =&gt; <a>Traversal</a> s t a b -&gt; (a -&gt; m b) -&gt; s -&gt; m t
--   </pre>
mapMOf :: () => LensLike WrappedMonad m s t a b -> a -> m b -> s -> m t

-- | Evaluate each action in the structure from left to right, and collect
--   the results.
--   
--   <pre>
--   &gt;&gt;&gt; sequenceAOf both ([1,2],[3,4])
--   [(1,3),(1,4),(2,3),(2,4)]
--   </pre>
--   
--   <pre>
--   <a>sequenceA</a> ≡ <a>sequenceAOf</a> <a>traverse</a> ≡ <a>traverse</a> <a>id</a>
--   <a>sequenceAOf</a> l ≡ <a>traverseOf</a> l <a>id</a> ≡ l <a>id</a>
--   </pre>
--   
--   <pre>
--   <a>sequenceAOf</a> :: <a>Functor</a> f =&gt; <a>Iso</a> s t (f b) b       -&gt; s -&gt; f t
--   <a>sequenceAOf</a> :: <a>Functor</a> f =&gt; <a>Lens</a> s t (f b) b      -&gt; s -&gt; f t
--   <a>sequenceAOf</a> :: <a>Applicative</a> f =&gt; <a>Traversal</a> s t (f b) b -&gt; s -&gt; f t
--   </pre>
sequenceAOf :: () => LensLike f s t f b b -> s -> f t

-- | A version of <a>traverseOf</a> with the arguments flipped, such that:
--   
--   <pre>
--   &gt;&gt;&gt; forOf each (1,2,3) print
--   1
--   2
--   3
--   ((),(),())
--   </pre>
--   
--   This function is only provided for consistency, <a>flip</a> is
--   strictly more general.
--   
--   <pre>
--   <a>forOf</a> ≡ <a>flip</a>
--   <a>forOf</a> ≡ <a>flip</a> . <a>traverseOf</a>
--   </pre>
--   
--   <pre>
--   <a>for</a> ≡ <a>forOf</a> <a>traverse</a>
--   <a>ifor</a> l s ≡ <a>for</a> l s <a>.</a> <a>Indexed</a>
--   </pre>
--   
--   <pre>
--   <a>forOf</a> :: <a>Functor</a> f =&gt; <a>Iso</a> s t a b -&gt; s -&gt; (a -&gt; f b) -&gt; f t
--   <a>forOf</a> :: <a>Functor</a> f =&gt; <a>Lens</a> s t a b -&gt; s -&gt; (a -&gt; f b) -&gt; f t
--   <a>forOf</a> :: <a>Applicative</a> f =&gt; <a>Traversal</a> s t a b -&gt; s -&gt; (a -&gt; f b) -&gt; f t
--   </pre>
forOf :: () => LensLike f s t a b -> s -> a -> f b -> f t

-- | Map each element of a structure targeted by a <a>Lens</a> or
--   <a>Traversal</a>, evaluate these actions from left to right, and
--   collect the results.
--   
--   This function is only provided for consistency, <a>id</a> is strictly
--   more general.
--   
--   <pre>
--   &gt;&gt;&gt; traverseOf each print (1,2,3)
--   1
--   2
--   3
--   ((),(),())
--   </pre>
--   
--   <pre>
--   <a>traverseOf</a> ≡ <a>id</a>
--   <a>itraverseOf</a> l ≡ <a>traverseOf</a> l <a>.</a> <a>Indexed</a>
--   <a>itraverseOf</a> <tt>itraversed</tt> ≡ <tt>itraverse</tt>
--   </pre>
--   
--   This yields the obvious law:
--   
--   <pre>
--   <a>traverse</a> ≡ <a>traverseOf</a> <a>traverse</a>
--   </pre>
--   
--   <pre>
--   <a>traverseOf</a> :: <a>Functor</a> f     =&gt; <a>Iso</a> s t a b        -&gt; (a -&gt; f b) -&gt; s -&gt; f t
--   <a>traverseOf</a> :: <a>Functor</a> f     =&gt; <a>Lens</a> s t a b       -&gt; (a -&gt; f b) -&gt; s -&gt; f t
--   <a>traverseOf</a> :: <tt>Apply</tt> f       =&gt; <a>Traversal1</a> s t a b -&gt; (a -&gt; f b) -&gt; s -&gt; f t
--   <a>traverseOf</a> :: <a>Applicative</a> f =&gt; <a>Traversal</a> s t a b  -&gt; (a -&gt; f b) -&gt; s -&gt; f t
--   </pre>
traverseOf :: () => LensLike f s t a b -> a -> f b -> s -> f t

-- | When you see this as an argument to a function, it expects a
--   <a>Traversal</a>.
type ATraversal s t a b = LensLike Bazaar ((->) :: * -> * -> *) a b s t a b

-- | <pre>
--   type <a>ATraversal'</a> = <a>Simple</a> <a>ATraversal</a>
--   </pre>
type ATraversal' s a = ATraversal s s a a

-- | When you see this as an argument to a function, it expects a
--   <a>Traversal1</a>.
type ATraversal1 s t a b = LensLike Bazaar1 ((->) :: * -> * -> *) a b s t a b

-- | <pre>
--   type <a>ATraversal1'</a> = <a>Simple</a> <a>ATraversal1</a>
--   </pre>
type ATraversal1' s a = ATraversal1 s s a a

-- | When you see this as an argument to a function, it expects an
--   <a>IndexedTraversal</a>.
type AnIndexedTraversal i s t a b = Over Indexed i Bazaar Indexed i a b s t a b

-- | When you see this as an argument to a function, it expects an
--   <a>IndexedTraversal1</a>.
type AnIndexedTraversal1 i s t a b = Over Indexed i Bazaar1 Indexed i a b s t a b

-- | <pre>
--   type <a>AnIndexedTraversal'</a> = <a>Simple</a> (<a>AnIndexedTraversal</a> i)
--   </pre>
type AnIndexedTraversal' i s a = AnIndexedTraversal i s s a a

-- | <pre>
--   type <a>AnIndexedTraversal1'</a> = <a>Simple</a> (<a>AnIndexedTraversal1</a> i)
--   </pre>
type AnIndexedTraversal1' i s a = AnIndexedTraversal1 i s s a a

-- | When you see this as an argument to a function, it expects
--   
--   <ul>
--   <li>to be indexed if <tt>p</tt> is an instance of <a>Indexed</a>
--   i,</li>
--   <li>to be unindexed if <tt>p</tt> is <tt>(-&gt;)</tt>,</li>
--   <li>a <a>Traversal</a> if <tt>f</tt> is <a>Applicative</a>,</li>
--   <li>a <a>Getter</a> if <tt>f</tt> is only a <a>Functor</a> and
--   <a>Contravariant</a>,</li>
--   <li>a <a>Lens</a> if <tt>f</tt> is only a <a>Functor</a>,</li>
--   <li>a <a>Fold</a> if <tt>f</tt> is <a>Applicative</a> and
--   <a>Contravariant</a>.</li>
--   </ul>
type Traversing (p :: * -> * -> *) (f :: * -> *) s t a b = Over p BazaarT p f a b s t a b
type Traversing1 (p :: * -> * -> *) (f :: * -> *) s t a b = Over p BazaarT1 p f a b s t a b

-- | <pre>
--   type <a>Traversing'</a> f = <a>Simple</a> (<a>Traversing</a> f)
--   </pre>
type Traversing' (p :: * -> * -> *) (f :: * -> *) s a = Traversing p f s s a a
type Traversing1' (p :: * -> * -> *) (f :: * -> *) s a = Traversing1 p f s s a a

-- | Allows <a>IndexedTraversal</a> the value at the smallest index.
class Ord k => TraverseMin k (m :: * -> *) | m -> k

-- | <a>IndexedTraversal</a> of the element with the smallest index.
traverseMin :: (TraverseMin k m, Indexable k p, Applicative f) => p v f v -> m v -> f m v

-- | Allows <a>IndexedTraversal</a> of the value at the largest index.
class Ord k => TraverseMax k (m :: * -> *) | m -> k

-- | <a>IndexedTraversal</a> of the element at the largest index.
traverseMax :: (TraverseMax k m, Indexable k p, Applicative f) => p v f v -> m v -> f m v

-- | Fold a value using a specified <a>Fold</a> and <a>Monoid</a>
--   operations. This is like <a>foldMapBy</a> where the <a>Foldable</a>
--   instance can be manually specified.
--   
--   <pre>
--   <a>foldMapByOf</a> <a>folded</a> ≡ <a>foldMapBy</a>
--   </pre>
--   
--   <pre>
--   <a>foldMapByOf</a> :: <a>Getter</a> s a     -&gt; (r -&gt; r -&gt; r) -&gt; r -&gt; (a -&gt; r) -&gt; s -&gt; r
--   <a>foldMapByOf</a> :: <a>Fold</a> s a       -&gt; (r -&gt; r -&gt; r) -&gt; r -&gt; (a -&gt; r) -&gt; s -&gt; r
--   <a>foldMapByOf</a> :: <a>Traversal'</a> s a -&gt; (r -&gt; r -&gt; r) -&gt; r -&gt; (a -&gt; r) -&gt; s -&gt; r
--   <a>foldMapByOf</a> :: <a>Lens'</a> s a      -&gt; (r -&gt; r -&gt; r) -&gt; r -&gt; (a -&gt; r) -&gt; s -&gt; r
--   <a>foldMapByOf</a> :: <a>Iso'</a> s a       -&gt; (r -&gt; r -&gt; r) -&gt; r -&gt; (a -&gt; r) -&gt; s -&gt; r
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; foldMapByOf both (+) 0 length ("hello","world")
--   10
--   </pre>
foldMapByOf :: () => Fold s a -> r -> r -> r -> r -> a -> r -> s -> r

-- | Fold a value using a specified <a>Fold</a> and <a>Monoid</a>
--   operations. This is like <a>foldBy</a> where the <a>Foldable</a>
--   instance can be manually specified.
--   
--   <pre>
--   <a>foldByOf</a> <a>folded</a> ≡ <a>foldBy</a>
--   </pre>
--   
--   <pre>
--   <a>foldByOf</a> :: <a>Getter</a> s a     -&gt; (a -&gt; a -&gt; a) -&gt; a -&gt; s -&gt; a
--   <a>foldByOf</a> :: <a>Fold</a> s a       -&gt; (a -&gt; a -&gt; a) -&gt; a -&gt; s -&gt; a
--   <a>foldByOf</a> :: <a>Lens'</a> s a      -&gt; (a -&gt; a -&gt; a) -&gt; a -&gt; s -&gt; a
--   <a>foldByOf</a> :: <a>Traversal'</a> s a -&gt; (a -&gt; a -&gt; a) -&gt; a -&gt; s -&gt; a
--   <a>foldByOf</a> :: <a>Iso'</a> s a       -&gt; (a -&gt; a -&gt; a) -&gt; a -&gt; s -&gt; a
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; foldByOf both (++) [] ("hello","world")
--   "helloworld"
--   </pre>
foldByOf :: () => Fold s a -> a -> a -> a -> a -> s -> a

-- | Obtain an <a>IndexedFold</a> by dropping elements from another
--   <a>IndexedFold</a>, <a>IndexedLens</a>, <a>IndexedGetter</a> or
--   <a>IndexedTraversal</a> while a predicate holds.
--   
--   <pre>
--   <a>idroppingWhile</a> :: (i -&gt; a -&gt; <a>Bool</a>) -&gt; <a>IndexedFold</a> i s a          -&gt; <a>IndexedFold</a> i s a
--   <a>idroppingWhile</a> :: (i -&gt; a -&gt; <a>Bool</a>) -&gt; <a>IndexedTraversal'</a> i s a    -&gt; <a>IndexedFold</a> i s a -- see notes
--   <a>idroppingWhile</a> :: (i -&gt; a -&gt; <a>Bool</a>) -&gt; <a>IndexedLens'</a> i s a         -&gt; <a>IndexedFold</a> i s a -- see notes
--   <a>idroppingWhile</a> :: (i -&gt; a -&gt; <a>Bool</a>) -&gt; <a>IndexedGetter</a> i s a        -&gt; <a>IndexedFold</a> i s a
--   </pre>
--   
--   Note: As with <a>droppingWhile</a> applying <a>idroppingWhile</a> to
--   an <a>IndexedLens</a> or <a>IndexedTraversal</a> will still allow you
--   to use it as a pseudo-<a>IndexedTraversal</a>, but if you change the
--   value of the first target to one where the predicate returns
--   <a>True</a>, then you will break the <a>Traversal</a> laws and
--   <a>Traversal</a> fusion will no longer be sound.
idroppingWhile :: (Indexable i p, Profunctor q, Applicative f) => i -> a -> Bool -> Optical Indexed i q Compose State Bool f s t a a -> Optical p q f s t a a

-- | Obtain an <a>IndexedFold</a> by taking elements from another
--   <a>IndexedFold</a>, <a>IndexedLens</a>, <a>IndexedGetter</a> or
--   <a>IndexedTraversal</a> while a predicate holds.
--   
--   <pre>
--   <a>itakingWhile</a> :: (i -&gt; a -&gt; <a>Bool</a>) -&gt; <a>IndexedFold</a> i s a          -&gt; <a>IndexedFold</a> i s a
--   <a>itakingWhile</a> :: (i -&gt; a -&gt; <a>Bool</a>) -&gt; <a>IndexedTraversal'</a> i s a    -&gt; <a>IndexedFold</a> i s a
--   <a>itakingWhile</a> :: (i -&gt; a -&gt; <a>Bool</a>) -&gt; <a>IndexedLens'</a> i s a         -&gt; <a>IndexedFold</a> i s a
--   <a>itakingWhile</a> :: (i -&gt; a -&gt; <a>Bool</a>) -&gt; <a>IndexedGetter</a> i s a        -&gt; <a>IndexedFold</a> i s a
--   </pre>
--   
--   Note: Applying <a>itakingWhile</a> to an <a>IndexedLens</a> or
--   <a>IndexedTraversal</a> will still allow you to use it as a
--   pseudo-<a>IndexedTraversal</a>, but if you change the value of any
--   target to one where the predicate returns <a>False</a>, then you will
--   break the <a>Traversal</a> laws and <a>Traversal</a> fusion will no
--   longer be sound.
itakingWhile :: (Indexable i p, Profunctor q, Contravariant f, Applicative f) => i -> a -> Bool -> Optical' Indexed i q (Const Endo f s :: * -> *) s a -> Optical' p q f s a

-- | Filter an <a>IndexedFold</a> or <a>IndexedGetter</a>, obtaining an
--   <a>IndexedFold</a>.
--   
--   <pre>
--   &gt;&gt;&gt; [0,0,0,5,5,5]^..traversed.ifiltered (\i a -&gt; i &lt;= a)
--   [0,5,5,5]
--   </pre>
--   
--   Compose with <a>ifiltered</a> to filter another <a>IndexedLens</a>,
--   <tt>IndexedIso</tt>, <a>IndexedGetter</a>, <a>IndexedFold</a> (or
--   <a>IndexedTraversal</a>) with access to both the value and the index.
--   
--   Note: As with <a>filtered</a>, this is <i>not</i> a legal
--   <a>IndexedTraversal</a>, unless you are very careful not to invalidate
--   the predicate on the target!
ifiltered :: (Indexable i p, Applicative f) => i -> a -> Bool -> Optical' p Indexed i f a a

-- | Retrieve the indices of the values targeted by a <a>IndexedFold</a> or
--   <a>IndexedTraversal</a> which satisfy a predicate.
--   
--   <pre>
--   <a>findIndices</a> ≡ <a>findIndicesOf</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>findIndicesOf</a> :: <a>IndexedFold</a> i s a       -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; [i]
--   <a>findIndicesOf</a> :: <a>IndexedTraversal'</a> i s a -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; [i]
--   </pre>
findIndicesOf :: () => IndexedGetting i Endo [i] s a -> a -> Bool -> s -> [i]

-- | Retrieve the index of the first value targeted by a <a>IndexedFold</a>
--   or <a>IndexedTraversal</a> which satisfies a predicate.
--   
--   <pre>
--   <a>findIndex</a> ≡ <a>findIndexOf</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>findIndexOf</a> :: <a>IndexedFold</a> i s a       -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Maybe</a> i
--   <a>findIndexOf</a> :: <a>IndexedTraversal'</a> i s a -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Maybe</a> i
--   </pre>
findIndexOf :: () => IndexedGetting i First i s a -> a -> Bool -> s -> Maybe i

-- | Retrieve the indices of the values targeted by a <a>IndexedFold</a> or
--   <a>IndexedTraversal</a> which are equal to a given value.
--   
--   <pre>
--   <a>elemIndices</a> ≡ <a>elemIndicesOf</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>elemIndicesOf</a> :: <a>Eq</a> a =&gt; <a>IndexedFold</a> i s a       -&gt; a -&gt; s -&gt; [i]
--   <a>elemIndicesOf</a> :: <a>Eq</a> a =&gt; <a>IndexedTraversal'</a> i s a -&gt; a -&gt; s -&gt; [i]
--   </pre>
elemIndicesOf :: Eq a => IndexedGetting i Endo [i] s a -> a -> s -> [i]

-- | Retrieve the index of the first value targeted by a <a>IndexedFold</a>
--   or <a>IndexedTraversal</a> which is equal to a given value.
--   
--   <pre>
--   <a>elemIndex</a> ≡ <a>elemIndexOf</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>elemIndexOf</a> :: <a>Eq</a> a =&gt; <a>IndexedFold</a> i s a       -&gt; a -&gt; s -&gt; <a>Maybe</a> i
--   <a>elemIndexOf</a> :: <a>Eq</a> a =&gt; <a>IndexedTraversal'</a> i s a -&gt; a -&gt; s -&gt; <a>Maybe</a> i
--   </pre>
elemIndexOf :: Eq a => IndexedGetting i First i s a -> a -> s -> Maybe i

-- | Perform an *UNSAFE* <a>head</a> (with index) of an <a>IndexedFold</a>
--   or <a>IndexedTraversal</a> assuming that it is there.
--   
--   <pre>
--   (<a>^@?!</a>) :: s -&gt; <a>IndexedGetter</a> i s a     -&gt; (i, a)
--   (<a>^@?!</a>) :: s -&gt; <a>IndexedFold</a> i s a       -&gt; (i, a)
--   (<a>^@?!</a>) :: s -&gt; <a>IndexedLens'</a> i s a      -&gt; (i, a)
--   (<a>^@?!</a>) :: s -&gt; <a>IndexedTraversal'</a> i s a -&gt; (i, a)
--   </pre>
(^@?!) :: HasCallStack => s -> IndexedGetting i Endo (i, a) s a -> (i, a)
infixl 8 ^@?!

-- | Perform a safe <a>head</a> (with index) of an <a>IndexedFold</a> or
--   <a>IndexedTraversal</a> or retrieve <a>Just</a> the index and result
--   from an <a>IndexedGetter</a> or <a>IndexedLens</a>.
--   
--   When using a <a>IndexedTraversal</a> as a partial <a>IndexedLens</a>,
--   or an <a>IndexedFold</a> as a partial <a>IndexedGetter</a> this can be
--   a convenient way to extract the optional value.
--   
--   <pre>
--   (<a>^@?</a>) :: s -&gt; <a>IndexedGetter</a> i s a     -&gt; <a>Maybe</a> (i, a)
--   (<a>^@?</a>) :: s -&gt; <a>IndexedFold</a> i s a       -&gt; <a>Maybe</a> (i, a)
--   (<a>^@?</a>) :: s -&gt; <a>IndexedLens'</a> i s a      -&gt; <a>Maybe</a> (i, a)
--   (<a>^@?</a>) :: s -&gt; <a>IndexedTraversal'</a> i s a -&gt; <a>Maybe</a> (i, a)
--   </pre>
(^@?) :: () => s -> IndexedGetting i Endo Maybe (i, a) s a -> Maybe (i, a)
infixl 8 ^@?

-- | An infix version of <a>itoListOf</a>.
(^@..) :: () => s -> IndexedGetting i Endo [(i, a)] s a -> [(i, a)]
infixl 8 ^@..

-- | Extract the key-value pairs from a structure.
--   
--   When you don't need access to the indices in the result, then
--   <a>toListOf</a> is more flexible in what it accepts.
--   
--   <pre>
--   <a>toListOf</a> l ≡ <a>map</a> <a>snd</a> <a>.</a> <a>itoListOf</a> l
--   </pre>
--   
--   <pre>
--   <a>itoListOf</a> :: <a>IndexedGetter</a> i s a     -&gt; s -&gt; [(i,a)]
--   <a>itoListOf</a> :: <a>IndexedFold</a> i s a       -&gt; s -&gt; [(i,a)]
--   <a>itoListOf</a> :: <a>IndexedLens'</a> i s a      -&gt; s -&gt; [(i,a)]
--   <a>itoListOf</a> :: <a>IndexedTraversal'</a> i s a -&gt; s -&gt; [(i,a)]
--   </pre>
itoListOf :: () => IndexedGetting i Endo [(i, a)] s a -> s -> [(i, a)]

-- | Monadic fold over the elements of a structure with an index,
--   associating to the left.
--   
--   When you don't need access to the index then <a>foldlMOf</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>foldlMOf</a> l ≡ <a>ifoldlMOf</a> l <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>ifoldlMOf</a> :: <a>Monad</a> m =&gt; <a>IndexedGetter</a> i s a     -&gt; (i -&gt; r -&gt; a -&gt; m r) -&gt; r -&gt; s -&gt; m r
--   <a>ifoldlMOf</a> :: <a>Monad</a> m =&gt; <a>IndexedFold</a> i s a       -&gt; (i -&gt; r -&gt; a -&gt; m r) -&gt; r -&gt; s -&gt; m r
--   <a>ifoldlMOf</a> :: <a>Monad</a> m =&gt; <a>IndexedLens'</a> i s a      -&gt; (i -&gt; r -&gt; a -&gt; m r) -&gt; r -&gt; s -&gt; m r
--   <a>ifoldlMOf</a> :: <a>Monad</a> m =&gt; <a>IndexedTraversal'</a> i s a -&gt; (i -&gt; r -&gt; a -&gt; m r) -&gt; r -&gt; s -&gt; m r
--   </pre>
ifoldlMOf :: Monad m => IndexedGetting i Endo r -> m r s a -> i -> r -> a -> m r -> r -> s -> m r

-- | Monadic fold right over the elements of a structure with an index.
--   
--   When you don't need access to the index then <a>foldrMOf</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>foldrMOf</a> l ≡ <a>ifoldrMOf</a> l <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>ifoldrMOf</a> :: <a>Monad</a> m =&gt; <a>IndexedGetter</a> i s a     -&gt; (i -&gt; a -&gt; r -&gt; m r) -&gt; r -&gt; s -&gt; m r
--   <a>ifoldrMOf</a> :: <a>Monad</a> m =&gt; <a>IndexedFold</a> i s a       -&gt; (i -&gt; a -&gt; r -&gt; m r) -&gt; r -&gt; s -&gt; m r
--   <a>ifoldrMOf</a> :: <a>Monad</a> m =&gt; <a>IndexedLens'</a> i s a      -&gt; (i -&gt; a -&gt; r -&gt; m r) -&gt; r -&gt; s -&gt; m r
--   <a>ifoldrMOf</a> :: <a>Monad</a> m =&gt; <a>IndexedTraversal'</a> i s a -&gt; (i -&gt; a -&gt; r -&gt; m r) -&gt; r -&gt; s -&gt; m r
--   </pre>
ifoldrMOf :: Monad m => IndexedGetting i Dual Endo r -> m r s a -> i -> a -> r -> m r -> r -> s -> m r

-- | Fold over the elements of a structure with an index, associating to
--   the left, but <i>strictly</i>.
--   
--   When you don't need access to the index then <a>foldlOf'</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>foldlOf'</a> l ≡ <a>ifoldlOf'</a> l <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>ifoldlOf'</a> :: <a>IndexedGetter</a> i s a       -&gt; (i -&gt; r -&gt; a -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>ifoldlOf'</a> :: <a>IndexedFold</a> i s a         -&gt; (i -&gt; r -&gt; a -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>ifoldlOf'</a> :: <a>IndexedLens'</a> i s a        -&gt; (i -&gt; r -&gt; a -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>ifoldlOf'</a> :: <a>IndexedTraversal'</a> i s a   -&gt; (i -&gt; r -&gt; a -&gt; r) -&gt; r -&gt; s -&gt; r
--   </pre>
ifoldlOf' :: () => IndexedGetting i Endo r -> r s a -> i -> r -> a -> r -> r -> s -> r

-- | <i>Strictly</i> fold right over the elements of a structure with an
--   index.
--   
--   When you don't need access to the index then <a>foldrOf'</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>foldrOf'</a> l ≡ <a>ifoldrOf'</a> l <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>ifoldrOf'</a> :: <a>IndexedGetter</a> i s a     -&gt; (i -&gt; a -&gt; r -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>ifoldrOf'</a> :: <a>IndexedFold</a> i s a       -&gt; (i -&gt; a -&gt; r -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>ifoldrOf'</a> :: <a>IndexedLens'</a> i s a      -&gt; (i -&gt; a -&gt; r -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>ifoldrOf'</a> :: <a>IndexedTraversal'</a> i s a -&gt; (i -&gt; a -&gt; r -&gt; r) -&gt; r -&gt; s -&gt; r
--   </pre>
ifoldrOf' :: () => IndexedGetting i Dual Endo r -> r s a -> i -> a -> r -> r -> r -> s -> r

-- | The <a>ifindMOf</a> function takes an <a>IndexedFold</a> or
--   <a>IndexedTraversal</a>, a monadic predicate that is also supplied the
--   index, a structure and returns in the monad the left-most element of
--   the structure matching the predicate, or <a>Nothing</a> if there is no
--   such element.
--   
--   When you don't need access to the index then <a>findMOf</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>findMOf</a> l ≡ <a>ifindMOf</a> l <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>ifindMOf</a> :: <a>Monad</a> m =&gt; <a>IndexedGetter</a> i s a     -&gt; (i -&gt; a -&gt; m <a>Bool</a>) -&gt; s -&gt; m (<a>Maybe</a> a)
--   <a>ifindMOf</a> :: <a>Monad</a> m =&gt; <a>IndexedFold</a> i s a       -&gt; (i -&gt; a -&gt; m <a>Bool</a>) -&gt; s -&gt; m (<a>Maybe</a> a)
--   <a>ifindMOf</a> :: <a>Monad</a> m =&gt; <a>IndexedLens'</a> i s a      -&gt; (i -&gt; a -&gt; m <a>Bool</a>) -&gt; s -&gt; m (<a>Maybe</a> a)
--   <a>ifindMOf</a> :: <a>Monad</a> m =&gt; <a>IndexedTraversal'</a> i s a -&gt; (i -&gt; a -&gt; m <a>Bool</a>) -&gt; s -&gt; m (<a>Maybe</a> a)
--   </pre>
ifindMOf :: Monad m => IndexedGetting i Endo m Maybe a s a -> i -> a -> m Bool -> s -> m Maybe a

-- | The <a>ifindOf</a> function takes an <a>IndexedFold</a> or
--   <a>IndexedTraversal</a>, a predicate that is also supplied the index,
--   a structure and returns the left-most element of the structure
--   matching the predicate, or <a>Nothing</a> if there is no such element.
--   
--   When you don't need access to the index then <a>findOf</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>findOf</a> l ≡ <a>ifindOf</a> l <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>ifindOf</a> :: <a>IndexedGetter</a> i s a     -&gt; (i -&gt; a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Maybe</a> a
--   <a>ifindOf</a> :: <a>IndexedFold</a> i s a       -&gt; (i -&gt; a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Maybe</a> a
--   <a>ifindOf</a> :: <a>IndexedLens'</a> i s a      -&gt; (i -&gt; a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Maybe</a> a
--   <a>ifindOf</a> :: <a>IndexedTraversal'</a> i s a -&gt; (i -&gt; a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Maybe</a> a
--   </pre>
ifindOf :: () => IndexedGetting i Endo Maybe a s a -> i -> a -> Bool -> s -> Maybe a

-- | Concatenate the results of a function of the elements of an
--   <a>IndexedFold</a> or <a>IndexedTraversal</a> with access to the
--   index.
--   
--   When you don't need access to the index then <a>concatMapOf</a> is
--   more flexible in what it accepts.
--   
--   <pre>
--   <a>concatMapOf</a> l ≡ <a>iconcatMapOf</a> l <a>.</a> <a>const</a>
--   <a>iconcatMapOf</a> ≡ <a>ifoldMapOf</a>
--   </pre>
--   
--   <pre>
--   <a>iconcatMapOf</a> :: <a>IndexedGetter</a> i s a     -&gt; (i -&gt; a -&gt; [r]) -&gt; s -&gt; [r]
--   <a>iconcatMapOf</a> :: <a>IndexedFold</a> i s a       -&gt; (i -&gt; a -&gt; [r]) -&gt; s -&gt; [r]
--   <a>iconcatMapOf</a> :: <a>IndexedLens'</a> i s a      -&gt; (i -&gt; a -&gt; [r]) -&gt; s -&gt; [r]
--   <a>iconcatMapOf</a> :: <a>IndexedTraversal'</a> i s a -&gt; (i -&gt; a -&gt; [r]) -&gt; s -&gt; [r]
--   </pre>
iconcatMapOf :: () => IndexedGetting i [r] s a -> i -> a -> [r] -> s -> [r]

-- | Run monadic actions for each target of an <a>IndexedFold</a> or
--   <a>IndexedTraversal</a> with access to the index, discarding the
--   results (with the arguments flipped).
--   
--   <pre>
--   <a>iforMOf_</a> ≡ <a>flip</a> <a>.</a> <a>imapMOf_</a>
--   </pre>
--   
--   When you don't need access to the index then <a>forMOf_</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>forMOf_</a> l a ≡ <a>iforMOf</a> l a <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>iforMOf_</a> :: <a>Monad</a> m =&gt; <a>IndexedGetter</a> i s a     -&gt; s -&gt; (i -&gt; a -&gt; m r) -&gt; m ()
--   <a>iforMOf_</a> :: <a>Monad</a> m =&gt; <a>IndexedFold</a> i s a       -&gt; s -&gt; (i -&gt; a -&gt; m r) -&gt; m ()
--   <a>iforMOf_</a> :: <a>Monad</a> m =&gt; <a>IndexedLens'</a> i s a      -&gt; s -&gt; (i -&gt; a -&gt; m r) -&gt; m ()
--   <a>iforMOf_</a> :: <a>Monad</a> m =&gt; <a>IndexedTraversal'</a> i s a -&gt; s -&gt; (i -&gt; a -&gt; m r) -&gt; m ()
--   </pre>
iforMOf_ :: Monad m => IndexedGetting i Sequenced r m s a -> s -> i -> a -> m r -> m ()

-- | Run monadic actions for each target of an <a>IndexedFold</a> or
--   <a>IndexedTraversal</a> with access to the index, discarding the
--   results.
--   
--   When you don't need access to the index then <a>mapMOf_</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>mapMOf_</a> l ≡ <a>imapMOf</a> l <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>imapMOf_</a> :: <a>Monad</a> m =&gt; <a>IndexedGetter</a> i s a     -&gt; (i -&gt; a -&gt; m r) -&gt; s -&gt; m ()
--   <a>imapMOf_</a> :: <a>Monad</a> m =&gt; <a>IndexedFold</a> i s a       -&gt; (i -&gt; a -&gt; m r) -&gt; s -&gt; m ()
--   <a>imapMOf_</a> :: <a>Monad</a> m =&gt; <a>IndexedLens'</a> i s a      -&gt; (i -&gt; a -&gt; m r) -&gt; s -&gt; m ()
--   <a>imapMOf_</a> :: <a>Monad</a> m =&gt; <a>IndexedTraversal'</a> i s a -&gt; (i -&gt; a -&gt; m r) -&gt; s -&gt; m ()
--   </pre>
imapMOf_ :: Monad m => IndexedGetting i Sequenced r m s a -> i -> a -> m r -> s -> m ()

-- | Traverse the targets of an <a>IndexedFold</a> or
--   <a>IndexedTraversal</a> with access to the index, discarding the
--   results (with the arguments flipped).
--   
--   <pre>
--   <a>iforOf_</a> ≡ <a>flip</a> <a>.</a> <a>itraverseOf_</a>
--   </pre>
--   
--   When you don't need access to the index then <a>forOf_</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>forOf_</a> l a ≡ <a>iforOf_</a> l a <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>iforOf_</a> :: <a>Functor</a> f     =&gt; <a>IndexedGetter</a> i s a     -&gt; s -&gt; (i -&gt; a -&gt; f r) -&gt; f ()
--   <a>iforOf_</a> :: <a>Applicative</a> f =&gt; <a>IndexedFold</a> i s a       -&gt; s -&gt; (i -&gt; a -&gt; f r) -&gt; f ()
--   <a>iforOf_</a> :: <a>Functor</a> f     =&gt; <a>IndexedLens'</a> i s a      -&gt; s -&gt; (i -&gt; a -&gt; f r) -&gt; f ()
--   <a>iforOf_</a> :: <a>Applicative</a> f =&gt; <a>IndexedTraversal'</a> i s a -&gt; s -&gt; (i -&gt; a -&gt; f r) -&gt; f ()
--   </pre>
iforOf_ :: Functor f => IndexedGetting i Traversed r f s a -> s -> i -> a -> f r -> f ()

-- | Traverse the targets of an <a>IndexedFold</a> or
--   <a>IndexedTraversal</a> with access to the <tt>i</tt>, discarding the
--   results.
--   
--   When you don't need access to the index then <a>traverseOf_</a> is
--   more flexible in what it accepts.
--   
--   <pre>
--   <a>traverseOf_</a> l ≡ <a>itraverseOf</a> l <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>itraverseOf_</a> :: <a>Functor</a> f     =&gt; <a>IndexedGetter</a> i s a     -&gt; (i -&gt; a -&gt; f r) -&gt; s -&gt; f ()
--   <a>itraverseOf_</a> :: <a>Applicative</a> f =&gt; <a>IndexedFold</a> i s a       -&gt; (i -&gt; a -&gt; f r) -&gt; s -&gt; f ()
--   <a>itraverseOf_</a> :: <a>Functor</a> f     =&gt; <a>IndexedLens'</a> i s a      -&gt; (i -&gt; a -&gt; f r) -&gt; s -&gt; f ()
--   <a>itraverseOf_</a> :: <a>Applicative</a> f =&gt; <a>IndexedTraversal'</a> i s a -&gt; (i -&gt; a -&gt; f r) -&gt; s -&gt; f ()
--   </pre>
itraverseOf_ :: Functor f => IndexedGetting i Traversed r f s a -> i -> a -> f r -> s -> f ()

-- | Return whether or not none of the elements viewed through an
--   <a>IndexedFold</a> or <a>IndexedTraversal</a> satisfy a predicate,
--   with access to the <tt>i</tt>.
--   
--   When you don't need access to the index then <a>noneOf</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>noneOf</a> l ≡ <a>inoneOf</a> l <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>inoneOf</a> :: <a>IndexedGetter</a> i s a     -&gt; (i -&gt; a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>inoneOf</a> :: <a>IndexedFold</a> i s a       -&gt; (i -&gt; a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>inoneOf</a> :: <a>IndexedLens'</a> i s a      -&gt; (i -&gt; a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>inoneOf</a> :: <a>IndexedTraversal'</a> i s a -&gt; (i -&gt; a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   </pre>
inoneOf :: () => IndexedGetting i Any s a -> i -> a -> Bool -> s -> Bool

-- | Return whether or not all elements viewed through an
--   <a>IndexedFold</a> or <a>IndexedTraversal</a> satisfy a predicate,
--   with access to the <tt>i</tt>.
--   
--   When you don't need access to the index then <a>allOf</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>allOf</a> l ≡ <a>iallOf</a> l <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>iallOf</a> :: <a>IndexedGetter</a> i s a     -&gt; (i -&gt; a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>iallOf</a> :: <a>IndexedFold</a> i s a       -&gt; (i -&gt; a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>iallOf</a> :: <a>IndexedLens'</a> i s a      -&gt; (i -&gt; a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>iallOf</a> :: <a>IndexedTraversal'</a> i s a -&gt; (i -&gt; a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   </pre>
iallOf :: () => IndexedGetting i All s a -> i -> a -> Bool -> s -> Bool

-- | Return whether or not any element viewed through an <a>IndexedFold</a>
--   or <a>IndexedTraversal</a> satisfy a predicate, with access to the
--   <tt>i</tt>.
--   
--   When you don't need access to the index then <a>anyOf</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>anyOf</a> l ≡ <a>ianyOf</a> l <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>ianyOf</a> :: <a>IndexedGetter</a> i s a     -&gt; (i -&gt; a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>ianyOf</a> :: <a>IndexedFold</a> i s a       -&gt; (i -&gt; a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>ianyOf</a> :: <a>IndexedLens'</a> i s a      -&gt; (i -&gt; a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>ianyOf</a> :: <a>IndexedTraversal'</a> i s a -&gt; (i -&gt; a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   </pre>
ianyOf :: () => IndexedGetting i Any s a -> i -> a -> Bool -> s -> Bool

-- | Left-associative fold of the parts of a structure that are viewed
--   through an <a>IndexedFold</a> or <a>IndexedTraversal</a> with access
--   to the <tt>i</tt>.
--   
--   When you don't need access to the index then <a>foldlOf</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>foldlOf</a> l ≡ <a>ifoldlOf</a> l <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>ifoldlOf</a> :: <a>IndexedGetter</a> i s a     -&gt; (i -&gt; r -&gt; a -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>ifoldlOf</a> :: <a>IndexedFold</a> i s a       -&gt; (i -&gt; r -&gt; a -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>ifoldlOf</a> :: <a>IndexedLens'</a> i s a      -&gt; (i -&gt; r -&gt; a -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>ifoldlOf</a> :: <a>IndexedTraversal'</a> i s a -&gt; (i -&gt; r -&gt; a -&gt; r) -&gt; r -&gt; s -&gt; r
--   </pre>
ifoldlOf :: () => IndexedGetting i Dual Endo r s a -> i -> r -> a -> r -> r -> s -> r

-- | Right-associative fold of parts of a structure that are viewed through
--   an <a>IndexedFold</a> or <a>IndexedTraversal</a> with access to the
--   <tt>i</tt>.
--   
--   When you don't need access to the index then <a>foldrOf</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>foldrOf</a> l ≡ <a>ifoldrOf</a> l <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>ifoldrOf</a> :: <a>IndexedGetter</a> i s a     -&gt; (i -&gt; a -&gt; r -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>ifoldrOf</a> :: <a>IndexedFold</a> i s a       -&gt; (i -&gt; a -&gt; r -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>ifoldrOf</a> :: <a>IndexedLens'</a> i s a      -&gt; (i -&gt; a -&gt; r -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>ifoldrOf</a> :: <a>IndexedTraversal'</a> i s a -&gt; (i -&gt; a -&gt; r -&gt; r) -&gt; r -&gt; s -&gt; r
--   </pre>
ifoldrOf :: () => IndexedGetting i Endo r s a -> i -> a -> r -> r -> r -> s -> r

-- | Fold an <a>IndexedFold</a> or <a>IndexedTraversal</a> by mapping
--   indices and values to an arbitrary <a>Monoid</a> with access to the
--   <tt>i</tt>.
--   
--   When you don't need access to the index then <a>foldMapOf</a> is more
--   flexible in what it accepts.
--   
--   <pre>
--   <a>foldMapOf</a> l ≡ <a>ifoldMapOf</a> l <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>ifoldMapOf</a> ::             <a>IndexedGetter</a> i s a     -&gt; (i -&gt; a -&gt; m) -&gt; s -&gt; m
--   <a>ifoldMapOf</a> :: <a>Monoid</a> m =&gt; <a>IndexedFold</a> i s a       -&gt; (i -&gt; a -&gt; m) -&gt; s -&gt; m
--   <a>ifoldMapOf</a> ::             <a>IndexedLens'</a> i s a      -&gt; (i -&gt; a -&gt; m) -&gt; s -&gt; m
--   <a>ifoldMapOf</a> :: <a>Monoid</a> m =&gt; <a>IndexedTraversal'</a> i s a -&gt; (i -&gt; a -&gt; m) -&gt; s -&gt; m
--   </pre>
ifoldMapOf :: () => IndexedGetting i m s a -> i -> a -> m -> s -> m

-- | This allows you to <a>traverse</a> the elements of a pretty much any
--   <a>LensLike</a> construction in the opposite order.
--   
--   This will preserve indexes on <a>Indexed</a> types and will give you
--   the elements of a (finite) <a>Fold</a> or <a>Traversal</a> in the
--   opposite order.
--   
--   This has no practical impact on a <a>Getter</a>, <a>Setter</a>,
--   <a>Lens</a> or <a>Iso</a>.
--   
--   <i>NB:</i> To write back through an <a>Iso</a>, you want to use
--   <a>from</a>. Similarly, to write back through an <a>Prism</a>, you
--   want to use <a>re</a>.
backwards :: (Profunctor p, Profunctor q) => Optical p q Backwards f s t a b -> Optical p q f s t a b

-- | Retrieve a function of the first index and value targeted by an
--   <a>IndexedFold</a> or <a>IndexedTraversal</a> (or a function of
--   <a>Just</a> the index and result from an <a>IndexedGetter</a> or
--   <a>IndexedLens</a>) into the current state.
--   
--   <pre>
--   <a>ipreuses</a> = <a>uses</a> <a>.</a> <a>ipre</a>
--   </pre>
--   
--   <pre>
--   <a>ipreuses</a> :: <a>MonadState</a> s m =&gt; <a>IndexedGetter</a> i s a     -&gt; (i -&gt; a -&gt; r) -&gt; m (<a>Maybe</a> r)
--   <a>ipreuses</a> :: <a>MonadState</a> s m =&gt; <a>IndexedFold</a> i s a       -&gt; (i -&gt; a -&gt; r) -&gt; m (<a>Maybe</a> r)
--   <a>ipreuses</a> :: <a>MonadState</a> s m =&gt; <a>IndexedLens'</a> i s a      -&gt; (i -&gt; a -&gt; r) -&gt; m (<a>Maybe</a> r)
--   <a>ipreuses</a> :: <a>MonadState</a> s m =&gt; <a>IndexedTraversal'</a> i s a -&gt; (i -&gt; a -&gt; r) -&gt; m (<a>Maybe</a> r)
--   </pre>
ipreuses :: MonadState s m => IndexedGetting i First r s a -> i -> a -> r -> m Maybe r

-- | Retrieve a function of the first value targeted by a <a>Fold</a> or
--   <a>Traversal</a> (or <a>Just</a> the result from a <a>Getter</a> or
--   <a>Lens</a>) into the current state.
--   
--   <pre>
--   <a>preuses</a> = <a>uses</a> <a>.</a> <a>pre</a>
--   </pre>
--   
--   <pre>
--   <a>preuses</a> :: <a>MonadState</a> s m =&gt; <a>Getter</a> s a     -&gt; (a -&gt; r) -&gt; m (<a>Maybe</a> r)
--   <a>preuses</a> :: <a>MonadState</a> s m =&gt; <a>Fold</a> s a       -&gt; (a -&gt; r) -&gt; m (<a>Maybe</a> r)
--   <a>preuses</a> :: <a>MonadState</a> s m =&gt; <a>Lens'</a> s a      -&gt; (a -&gt; r) -&gt; m (<a>Maybe</a> r)
--   <a>preuses</a> :: <a>MonadState</a> s m =&gt; <a>Iso'</a> s a       -&gt; (a -&gt; r) -&gt; m (<a>Maybe</a> r)
--   <a>preuses</a> :: <a>MonadState</a> s m =&gt; <a>Traversal'</a> s a -&gt; (a -&gt; r) -&gt; m (<a>Maybe</a> r)
--   </pre>
preuses :: MonadState s m => Getting First r s a -> a -> r -> m Maybe r

-- | Retrieve the first index and value targeted by an <a>IndexedFold</a>
--   or <a>IndexedTraversal</a> (or <a>Just</a> the index and result from
--   an <a>IndexedGetter</a> or <a>IndexedLens</a>) into the current state.
--   
--   <pre>
--   <a>ipreuse</a> = <a>use</a> <a>.</a> <a>ipre</a>
--   </pre>
--   
--   <pre>
--   <a>ipreuse</a> :: <a>MonadState</a> s m =&gt; <a>IndexedGetter</a> i s a     -&gt; m (<a>Maybe</a> (i, a))
--   <a>ipreuse</a> :: <a>MonadState</a> s m =&gt; <a>IndexedFold</a> i s a       -&gt; m (<a>Maybe</a> (i, a))
--   <a>ipreuse</a> :: <a>MonadState</a> s m =&gt; <a>IndexedLens'</a> i s a      -&gt; m (<a>Maybe</a> (i, a))
--   <a>ipreuse</a> :: <a>MonadState</a> s m =&gt; <a>IndexedTraversal'</a> i s a -&gt; m (<a>Maybe</a> (i, a))
--   </pre>
ipreuse :: MonadState s m => IndexedGetting i First (i, a) s a -> m Maybe (i, a)

-- | Retrieve the first value targeted by a <a>Fold</a> or <a>Traversal</a>
--   (or <a>Just</a> the result from a <a>Getter</a> or <a>Lens</a>) into
--   the current state.
--   
--   <pre>
--   <a>preuse</a> = <a>use</a> <a>.</a> <a>pre</a>
--   </pre>
--   
--   <pre>
--   <a>preuse</a> :: <a>MonadState</a> s m =&gt; <a>Getter</a> s a     -&gt; m (<a>Maybe</a> a)
--   <a>preuse</a> :: <a>MonadState</a> s m =&gt; <a>Fold</a> s a       -&gt; m (<a>Maybe</a> a)
--   <a>preuse</a> :: <a>MonadState</a> s m =&gt; <a>Lens'</a> s a      -&gt; m (<a>Maybe</a> a)
--   <a>preuse</a> :: <a>MonadState</a> s m =&gt; <a>Iso'</a> s a       -&gt; m (<a>Maybe</a> a)
--   <a>preuse</a> :: <a>MonadState</a> s m =&gt; <a>Traversal'</a> s a -&gt; m (<a>Maybe</a> a)
--   </pre>
preuse :: MonadState s m => Getting First a s a -> m Maybe a

-- | Retrieve a function of the first index and value targeted by an
--   <a>IndexedFold</a> or <a>IndexedTraversal</a> (or <a>Just</a> the
--   result from an <a>IndexedGetter</a> or <a>IndexedLens</a>). See also
--   (<a>^@?</a>).
--   
--   <pre>
--   <a>ipreviews</a> = <a>views</a> <a>.</a> <a>ipre</a>
--   </pre>
--   
--   This is usually applied in the <a>Reader</a> <a>Monad</a> <tt>(-&gt;)
--   s</tt>.
--   
--   <pre>
--   <a>ipreviews</a> :: <a>IndexedGetter</a> i s a     -&gt; (i -&gt; a -&gt; r) -&gt; s -&gt; <a>Maybe</a> r
--   <a>ipreviews</a> :: <a>IndexedFold</a> i s a       -&gt; (i -&gt; a -&gt; r) -&gt; s -&gt; <a>Maybe</a> r
--   <a>ipreviews</a> :: <a>IndexedLens'</a> i s a      -&gt; (i -&gt; a -&gt; r) -&gt; s -&gt; <a>Maybe</a> r
--   <a>ipreviews</a> :: <a>IndexedTraversal'</a> i s a -&gt; (i -&gt; a -&gt; r) -&gt; s -&gt; <a>Maybe</a> r
--   </pre>
--   
--   However, it may be useful to think of its full generality when working
--   with a <a>Monad</a> transformer stack:
--   
--   <pre>
--   <a>ipreviews</a> :: <a>MonadReader</a> s m =&gt; <a>IndexedGetter</a> i s a     -&gt; (i -&gt; a -&gt; r) -&gt; m (<a>Maybe</a> r)
--   <a>ipreviews</a> :: <a>MonadReader</a> s m =&gt; <a>IndexedFold</a> i s a       -&gt; (i -&gt; a -&gt; r) -&gt; m (<a>Maybe</a> r)
--   <a>ipreviews</a> :: <a>MonadReader</a> s m =&gt; <a>IndexedLens'</a> i s a      -&gt; (i -&gt; a -&gt; r) -&gt; m (<a>Maybe</a> r)
--   <a>ipreviews</a> :: <a>MonadReader</a> s m =&gt; <a>IndexedTraversal'</a> i s a -&gt; (i -&gt; a -&gt; r) -&gt; m (<a>Maybe</a> r)
--   </pre>
ipreviews :: MonadReader s m => IndexedGetting i First r s a -> i -> a -> r -> m Maybe r

-- | Retrieve a function of the first value targeted by a <a>Fold</a> or
--   <a>Traversal</a> (or <a>Just</a> the result from a <a>Getter</a> or
--   <a>Lens</a>).
--   
--   This is usually applied in the <a>Reader</a> <a>Monad</a> <tt>(-&gt;)
--   s</tt>.
previews :: MonadReader s m => Getting First r s a -> a -> r -> m Maybe r

-- | Retrieve the first index and value targeted by a <a>Fold</a> or
--   <a>Traversal</a> (or <a>Just</a> the result from a <a>Getter</a> or
--   <a>Lens</a>). See also (<a>^@?</a>).
--   
--   <pre>
--   <a>ipreview</a> = <a>view</a> <a>.</a> <a>ipre</a>
--   </pre>
--   
--   This is usually applied in the <a>Reader</a> <a>Monad</a> <tt>(-&gt;)
--   s</tt>.
--   
--   <pre>
--   <a>ipreview</a> :: <a>IndexedGetter</a> i s a     -&gt; s -&gt; <a>Maybe</a> (i, a)
--   <a>ipreview</a> :: <a>IndexedFold</a> i s a       -&gt; s -&gt; <a>Maybe</a> (i, a)
--   <a>ipreview</a> :: <a>IndexedLens'</a> i s a      -&gt; s -&gt; <a>Maybe</a> (i, a)
--   <a>ipreview</a> :: <a>IndexedTraversal'</a> i s a -&gt; s -&gt; <a>Maybe</a> (i, a)
--   </pre>
--   
--   However, it may be useful to think of its full generality when working
--   with a <a>Monad</a> transformer stack:
--   
--   <pre>
--   <a>ipreview</a> :: <a>MonadReader</a> s m =&gt; <a>IndexedGetter</a> s a     -&gt; m (<a>Maybe</a> (i, a))
--   <a>ipreview</a> :: <a>MonadReader</a> s m =&gt; <a>IndexedFold</a> s a       -&gt; m (<a>Maybe</a> (i, a))
--   <a>ipreview</a> :: <a>MonadReader</a> s m =&gt; <a>IndexedLens'</a> s a      -&gt; m (<a>Maybe</a> (i, a))
--   <a>ipreview</a> :: <a>MonadReader</a> s m =&gt; <a>IndexedTraversal'</a> s a -&gt; m (<a>Maybe</a> (i, a))
--   </pre>
ipreview :: MonadReader s m => IndexedGetting i First (i, a) s a -> m Maybe (i, a)

-- | Retrieve the first value targeted by a <a>Fold</a> or <a>Traversal</a>
--   (or <a>Just</a> the result from a <a>Getter</a> or <a>Lens</a>). See
--   also (<a>^?</a>).
--   
--   <pre>
--   <a>listToMaybe</a> <a>.</a> <a>toList</a> ≡ <a>preview</a> <a>folded</a>
--   </pre>
--   
--   This is usually applied in the <a>Reader</a> <a>Monad</a> <tt>(-&gt;)
--   s</tt>.
--   
--   <pre>
--   <a>preview</a> = <a>view</a> <a>.</a> <a>pre</a>
--   </pre>
--   
--   <pre>
--   <a>preview</a> :: <a>Getter</a> s a     -&gt; s -&gt; <a>Maybe</a> a
--   <a>preview</a> :: <a>Fold</a> s a       -&gt; s -&gt; <a>Maybe</a> a
--   <a>preview</a> :: <a>Lens'</a> s a      -&gt; s -&gt; <a>Maybe</a> a
--   <a>preview</a> :: <a>Iso'</a> s a       -&gt; s -&gt; <a>Maybe</a> a
--   <a>preview</a> :: <a>Traversal'</a> s a -&gt; s -&gt; <a>Maybe</a> a
--   </pre>
--   
--   However, it may be useful to think of its full generality when working
--   with a <a>Monad</a> transformer stack:
--   
--   <pre>
--   <a>preview</a> :: <a>MonadReader</a> s m =&gt; <a>Getter</a> s a     -&gt; m (<a>Maybe</a> a)
--   <a>preview</a> :: <a>MonadReader</a> s m =&gt; <a>Fold</a> s a       -&gt; m (<a>Maybe</a> a)
--   <a>preview</a> :: <a>MonadReader</a> s m =&gt; <a>Lens'</a> s a      -&gt; m (<a>Maybe</a> a)
--   <a>preview</a> :: <a>MonadReader</a> s m =&gt; <a>Iso'</a> s a       -&gt; m (<a>Maybe</a> a)
--   <a>preview</a> :: <a>MonadReader</a> s m =&gt; <a>Traversal'</a> s a -&gt; m (<a>Maybe</a> a)
--   </pre>
preview :: MonadReader s m => Getting First a s a -> m Maybe a

-- | This converts an <a>IndexedFold</a> to an <a>IndexPreservingGetter</a>
--   that returns the first index and element, if they exist, as a
--   <a>Maybe</a>.
--   
--   <pre>
--   <a>ipre</a> :: <a>IndexedGetter</a> i s a     -&gt; <a>IndexPreservingGetter</a> s (<a>Maybe</a> (i, a))
--   <a>ipre</a> :: <a>IndexedFold</a> i s a       -&gt; <a>IndexPreservingGetter</a> s (<a>Maybe</a> (i, a))
--   <a>ipre</a> :: <a>IndexedTraversal'</a> i s a -&gt; <a>IndexPreservingGetter</a> s (<a>Maybe</a> (i, a))
--   <a>ipre</a> :: <a>IndexedLens'</a> i s a      -&gt; <a>IndexPreservingGetter</a> s (<a>Maybe</a> (i, a))
--   </pre>
ipre :: () => IndexedGetting i First (i, a) s a -> IndexPreservingGetter s Maybe (i, a)

-- | This converts a <a>Fold</a> to a <a>IndexPreservingGetter</a> that
--   returns the first element, if it exists, as a <a>Maybe</a>.
--   
--   <pre>
--   <a>pre</a> :: <a>Getter</a> s a     -&gt; <a>IndexPreservingGetter</a> s (<a>Maybe</a> a)
--   <a>pre</a> :: <a>Fold</a> s a       -&gt; <a>IndexPreservingGetter</a> s (<a>Maybe</a> a)
--   <a>pre</a> :: <a>Traversal'</a> s a -&gt; <a>IndexPreservingGetter</a> s (<a>Maybe</a> a)
--   <a>pre</a> :: <a>Lens'</a> s a      -&gt; <a>IndexPreservingGetter</a> s (<a>Maybe</a> a)
--   <a>pre</a> :: <a>Iso'</a> s a       -&gt; <a>IndexPreservingGetter</a> s (<a>Maybe</a> a)
--   <a>pre</a> :: <a>Prism'</a> s a     -&gt; <a>IndexPreservingGetter</a> s (<a>Maybe</a> a)
--   </pre>
pre :: () => Getting First a s a -> IndexPreservingGetter s Maybe a

-- | Check to see if this <a>Fold</a> or <a>Traversal</a> has no matches.
--   
--   <pre>
--   &gt;&gt;&gt; hasn't _Left (Right 12)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; hasn't _Left (Left 12)
--   False
--   </pre>
hasn't :: () => Getting All s a -> s -> Bool

-- | Check to see if this <a>Fold</a> or <a>Traversal</a> matches 1 or more
--   entries.
--   
--   <pre>
--   &gt;&gt;&gt; has (element 0) []
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; has _Left (Left 12)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; has _Right (Left 12)
--   False
--   </pre>
--   
--   This will always return <a>True</a> for a <a>Lens</a> or
--   <a>Getter</a>.
--   
--   <pre>
--   &gt;&gt;&gt; has _1 ("hello","world")
--   True
--   </pre>
--   
--   <pre>
--   <a>has</a> :: <a>Getter</a> s a     -&gt; s -&gt; <a>Bool</a>
--   <a>has</a> :: <a>Fold</a> s a       -&gt; s -&gt; <a>Bool</a>
--   <a>has</a> :: <a>Iso'</a> s a       -&gt; s -&gt; <a>Bool</a>
--   <a>has</a> :: <a>Lens'</a> s a      -&gt; s -&gt; <a>Bool</a>
--   <a>has</a> :: <a>Traversal'</a> s a -&gt; s -&gt; <a>Bool</a>
--   </pre>
has :: () => Getting Any s a -> s -> Bool

-- | Monadic fold over the elements of a structure, associating to the
--   left, i.e. from left to right.
--   
--   <pre>
--   <a>foldlM</a> ≡ <a>foldlMOf</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>foldlMOf</a> :: <a>Monad</a> m =&gt; <a>Getter</a> s a     -&gt; (r -&gt; a -&gt; m r) -&gt; r -&gt; s -&gt; m r
--   <a>foldlMOf</a> :: <a>Monad</a> m =&gt; <a>Fold</a> s a       -&gt; (r -&gt; a -&gt; m r) -&gt; r -&gt; s -&gt; m r
--   <a>foldlMOf</a> :: <a>Monad</a> m =&gt; <a>Iso'</a> s a       -&gt; (r -&gt; a -&gt; m r) -&gt; r -&gt; s -&gt; m r
--   <a>foldlMOf</a> :: <a>Monad</a> m =&gt; <a>Lens'</a> s a      -&gt; (r -&gt; a -&gt; m r) -&gt; r -&gt; s -&gt; m r
--   <a>foldlMOf</a> :: <a>Monad</a> m =&gt; <a>Traversal'</a> s a -&gt; (r -&gt; a -&gt; m r) -&gt; r -&gt; s -&gt; m r
--   </pre>
foldlMOf :: Monad m => Getting Endo r -> m r s a -> r -> a -> m r -> r -> s -> m r

-- | Monadic fold over the elements of a structure, associating to the
--   right, i.e. from right to left.
--   
--   <pre>
--   <a>foldrM</a> ≡ <a>foldrMOf</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>foldrMOf</a> :: <a>Monad</a> m =&gt; <a>Getter</a> s a     -&gt; (a -&gt; r -&gt; m r) -&gt; r -&gt; s -&gt; m r
--   <a>foldrMOf</a> :: <a>Monad</a> m =&gt; <a>Fold</a> s a       -&gt; (a -&gt; r -&gt; m r) -&gt; r -&gt; s -&gt; m r
--   <a>foldrMOf</a> :: <a>Monad</a> m =&gt; <a>Iso'</a> s a       -&gt; (a -&gt; r -&gt; m r) -&gt; r -&gt; s -&gt; m r
--   <a>foldrMOf</a> :: <a>Monad</a> m =&gt; <a>Lens'</a> s a      -&gt; (a -&gt; r -&gt; m r) -&gt; r -&gt; s -&gt; m r
--   <a>foldrMOf</a> :: <a>Monad</a> m =&gt; <a>Traversal'</a> s a -&gt; (a -&gt; r -&gt; m r) -&gt; r -&gt; s -&gt; m r
--   </pre>
foldrMOf :: Monad m => Getting Dual Endo r -> m r s a -> a -> r -> m r -> r -> s -> m r

-- | A variant of <a>foldlOf'</a> that has no base case and thus may only
--   be applied to folds and structures such that the fold views at least
--   one element of the structure.
--   
--   <pre>
--   <a>foldl1Of'</a> l f ≡ <a>foldl1'</a> f <a>.</a> <a>toListOf</a> l
--   </pre>
--   
--   <pre>
--   <a>foldl1Of'</a> :: <a>Getter</a> s a     -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; a
--   <a>foldl1Of'</a> :: <a>Fold</a> s a       -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; a
--   <a>foldl1Of'</a> :: <a>Iso'</a> s a       -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; a
--   <a>foldl1Of'</a> :: <a>Lens'</a> s a      -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; a
--   <a>foldl1Of'</a> :: <a>Traversal'</a> s a -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; a
--   </pre>
foldl1Of' :: HasCallStack => Getting Endo Endo Maybe a s a -> a -> a -> a -> s -> a

-- | A variant of <a>foldrOf'</a> that has no base case and thus may only
--   be applied to folds and structures such that the fold views at least
--   one element of the structure.
--   
--   <pre>
--   <a>foldr1Of</a> l f ≡ <a>foldr1</a> f <a>.</a> <a>toListOf</a> l
--   </pre>
--   
--   <pre>
--   <a>foldr1Of'</a> :: <a>Getter</a> s a     -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; a
--   <a>foldr1Of'</a> :: <a>Fold</a> s a       -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; a
--   <a>foldr1Of'</a> :: <a>Iso'</a> s a       -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; a
--   <a>foldr1Of'</a> :: <a>Lens'</a> s a      -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; a
--   <a>foldr1Of'</a> :: <a>Traversal'</a> s a -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; a
--   </pre>
foldr1Of' :: HasCallStack => Getting Dual Endo Endo Maybe a s a -> a -> a -> a -> s -> a

-- | Fold over the elements of a structure, associating to the left, but
--   strictly.
--   
--   <pre>
--   <a>foldl'</a> ≡ <a>foldlOf'</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>foldlOf'</a> :: <a>Getter</a> s a     -&gt; (r -&gt; a -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>foldlOf'</a> :: <a>Fold</a> s a       -&gt; (r -&gt; a -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>foldlOf'</a> :: <a>Iso'</a> s a       -&gt; (r -&gt; a -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>foldlOf'</a> :: <a>Lens'</a> s a      -&gt; (r -&gt; a -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>foldlOf'</a> :: <a>Traversal'</a> s a -&gt; (r -&gt; a -&gt; r) -&gt; r -&gt; s -&gt; r
--   </pre>
foldlOf' :: () => Getting Endo Endo r s a -> r -> a -> r -> r -> s -> r

-- | Strictly fold right over the elements of a structure.
--   
--   <pre>
--   <a>foldr'</a> ≡ <a>foldrOf'</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>foldrOf'</a> :: <a>Getter</a> s a     -&gt; (a -&gt; r -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>foldrOf'</a> :: <a>Fold</a> s a       -&gt; (a -&gt; r -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>foldrOf'</a> :: <a>Iso'</a> s a       -&gt; (a -&gt; r -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>foldrOf'</a> :: <a>Lens'</a> s a      -&gt; (a -&gt; r -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>foldrOf'</a> :: <a>Traversal'</a> s a -&gt; (a -&gt; r -&gt; r) -&gt; r -&gt; s -&gt; r
--   </pre>
foldrOf' :: () => Getting Dual Endo Endo r s a -> a -> r -> r -> r -> s -> r

-- | A variant of <a>foldlOf</a> that has no base case and thus may only be
--   applied to lenses and structures such that the <a>Lens</a> views at
--   least one element of the structure.
--   
--   <pre>
--   &gt;&gt;&gt; foldl1Of each (+) (1,2,3,4)
--   10
--   </pre>
--   
--   <pre>
--   <a>foldl1Of</a> l f ≡ <a>foldl1</a> f <a>.</a> <a>toListOf</a> l
--   <a>foldl1</a> ≡ <a>foldl1Of</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>foldl1Of</a> :: <a>Getter</a> s a     -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; a
--   <a>foldl1Of</a> :: <a>Fold</a> s a       -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; a
--   <a>foldl1Of</a> :: <a>Iso'</a> s a       -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; a
--   <a>foldl1Of</a> :: <a>Lens'</a> s a      -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; a
--   <a>foldl1Of</a> :: <a>Traversal'</a> s a -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; a
--   </pre>
foldl1Of :: HasCallStack => Getting Dual Endo Maybe a s a -> a -> a -> a -> s -> a

-- | A variant of <a>foldrOf</a> that has no base case and thus may only be
--   applied to lenses and structures such that the <a>Lens</a> views at
--   least one element of the structure.
--   
--   <pre>
--   &gt;&gt;&gt; foldr1Of each (+) (1,2,3,4)
--   10
--   </pre>
--   
--   <pre>
--   <a>foldr1Of</a> l f ≡ <a>foldr1</a> f <a>.</a> <a>toListOf</a> l
--   <a>foldr1</a> ≡ <a>foldr1Of</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>foldr1Of</a> :: <a>Getter</a> s a     -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; a
--   <a>foldr1Of</a> :: <a>Fold</a> s a       -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; a
--   <a>foldr1Of</a> :: <a>Iso'</a> s a       -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; a
--   <a>foldr1Of</a> :: <a>Lens'</a> s a      -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; a
--   <a>foldr1Of</a> :: <a>Traversal'</a> s a -&gt; (a -&gt; a -&gt; a) -&gt; s -&gt; a
--   </pre>
foldr1Of :: HasCallStack => Getting Endo Maybe a s a -> a -> a -> a -> s -> a

-- | The <a>lookupOf</a> function takes a <a>Fold</a> (or <a>Getter</a>,
--   <a>Traversal</a>, <a>Lens</a>, <a>Iso</a>, etc.), a key, and a
--   structure containing key/value pairs. It returns the first value
--   corresponding to the given key. This function generalizes
--   <a>lookup</a> to work on an arbitrary <a>Fold</a> instead of lists.
--   
--   <pre>
--   &gt;&gt;&gt; lookupOf folded 4 [(2, 'a'), (4, 'b'), (4, 'c')]
--   Just 'b'
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; lookupOf each 2 [(2, 'a'), (4, 'b'), (4, 'c')]
--   Just 'a'
--   </pre>
--   
--   <pre>
--   <a>lookupOf</a> :: <a>Eq</a> k =&gt; <a>Fold</a> s (k,v) -&gt; k -&gt; s -&gt; <a>Maybe</a> v
--   </pre>
lookupOf :: Eq k => Getting Endo Maybe v s (k, v) -> k -> s -> Maybe v

-- | The <a>findMOf</a> function takes a <a>Lens</a> (or <a>Getter</a>,
--   <a>Iso</a>, <a>Fold</a>, or <a>Traversal</a>), a monadic predicate and
--   a structure and returns in the monad the leftmost element of the
--   structure matching the predicate, or <a>Nothing</a> if there is no
--   such element.
--   
--   <pre>
--   &gt;&gt;&gt; findMOf each ( \x -&gt; print ("Checking " ++ show x) &gt;&gt; return (even x)) (1,3,4,6)
--   "Checking 1"
--   "Checking 3"
--   "Checking 4"
--   Just 4
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; findMOf each ( \x -&gt; print ("Checking " ++ show x) &gt;&gt; return (even x)) (1,3,5,7)
--   "Checking 1"
--   "Checking 3"
--   "Checking 5"
--   "Checking 7"
--   Nothing
--   </pre>
--   
--   <pre>
--   <a>findMOf</a> :: (<a>Monad</a> m, <a>Getter</a> s a)     -&gt; (a -&gt; m <a>Bool</a>) -&gt; s -&gt; m (<a>Maybe</a> a)
--   <a>findMOf</a> :: (<a>Monad</a> m, <a>Fold</a> s a)       -&gt; (a -&gt; m <a>Bool</a>) -&gt; s -&gt; m (<a>Maybe</a> a)
--   <a>findMOf</a> :: (<a>Monad</a> m, <a>Iso'</a> s a)       -&gt; (a -&gt; m <a>Bool</a>) -&gt; s -&gt; m (<a>Maybe</a> a)
--   <a>findMOf</a> :: (<a>Monad</a> m, <a>Lens'</a> s a)      -&gt; (a -&gt; m <a>Bool</a>) -&gt; s -&gt; m (<a>Maybe</a> a)
--   <a>findMOf</a> :: (<a>Monad</a> m, <a>Traversal'</a> s a) -&gt; (a -&gt; m <a>Bool</a>) -&gt; s -&gt; m (<a>Maybe</a> a)
--   </pre>
--   
--   <pre>
--   <a>findMOf</a> <a>folded</a> :: (Monad m, Foldable f) =&gt; (a -&gt; m Bool) -&gt; f a -&gt; m (Maybe a)
--   <a>ifindMOf</a> l ≡ <a>findMOf</a> l <a>.</a> <a>Indexed</a>
--   </pre>
--   
--   A simpler version that didn't permit indexing, would be:
--   
--   <pre>
--   <a>findMOf</a> :: Monad m =&gt; <a>Getting</a> (<a>Endo</a> (m (<a>Maybe</a> a))) s a -&gt; (a -&gt; m <a>Bool</a>) -&gt; s -&gt; m (<a>Maybe</a> a)
--   <a>findMOf</a> l p = <a>foldrOf</a> l (a y -&gt; p a &gt;&gt;= x -&gt; if x then return (<a>Just</a> a) else y) $ return <a>Nothing</a>
--   </pre>
findMOf :: Monad m => Getting Endo m Maybe a s a -> a -> m Bool -> s -> m Maybe a

-- | The <a>findOf</a> function takes a <a>Lens</a> (or <a>Getter</a>,
--   <a>Iso</a>, <a>Fold</a>, or <a>Traversal</a>), a predicate and a
--   structure and returns the leftmost element of the structure matching
--   the predicate, or <a>Nothing</a> if there is no such element.
--   
--   <pre>
--   &gt;&gt;&gt; findOf each even (1,3,4,6)
--   Just 4
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; findOf folded even [1,3,5,7]
--   Nothing
--   </pre>
--   
--   <pre>
--   <a>findOf</a> :: <a>Getter</a> s a     -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Maybe</a> a
--   <a>findOf</a> :: <a>Fold</a> s a       -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Maybe</a> a
--   <a>findOf</a> :: <a>Iso'</a> s a       -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Maybe</a> a
--   <a>findOf</a> :: <a>Lens'</a> s a      -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Maybe</a> a
--   <a>findOf</a> :: <a>Traversal'</a> s a -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Maybe</a> a
--   </pre>
--   
--   <pre>
--   <a>find</a> ≡ <a>findOf</a> <a>folded</a>
--   <a>ifindOf</a> l ≡ <a>findOf</a> l <a>.</a> <a>Indexed</a>
--   </pre>
--   
--   A simpler version that didn't permit indexing, would be:
--   
--   <pre>
--   <a>findOf</a> :: <a>Getting</a> (<a>Endo</a> (<a>Maybe</a> a)) s a -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Maybe</a> a
--   <a>findOf</a> l p = <a>foldrOf</a> l (a y -&gt; if p a then <a>Just</a> a else y) <a>Nothing</a>
--   </pre>
findOf :: () => Getting Endo Maybe a s a -> a -> Bool -> s -> Maybe a

-- | Obtain the minimum element (if any) targeted by a <a>Fold</a>,
--   <a>Traversal</a>, <a>Lens</a>, <a>Iso</a> or <a>Getter</a> according
--   to a user supplied <a>Ordering</a>.
--   
--   In the interest of efficiency, This operation has semantics more
--   strict than strictly necessary.
--   
--   <pre>
--   &gt;&gt;&gt; minimumByOf traverse (compare `on` length) ["mustard","relish","ham"]
--   Just "ham"
--   </pre>
--   
--   <pre>
--   <a>minimumBy</a> cmp ≡ <a>fromMaybe</a> (<a>error</a> "empty") <a>.</a> <a>minimumByOf</a> <a>folded</a> cmp
--   </pre>
--   
--   <pre>
--   <a>minimumByOf</a> :: <a>Getter</a> s a     -&gt; (a -&gt; a -&gt; <a>Ordering</a>) -&gt; s -&gt; <a>Maybe</a> a
--   <a>minimumByOf</a> :: <a>Fold</a> s a       -&gt; (a -&gt; a -&gt; <a>Ordering</a>) -&gt; s -&gt; <a>Maybe</a> a
--   <a>minimumByOf</a> :: <a>Iso'</a> s a       -&gt; (a -&gt; a -&gt; <a>Ordering</a>) -&gt; s -&gt; <a>Maybe</a> a
--   <a>minimumByOf</a> :: <a>Lens'</a> s a      -&gt; (a -&gt; a -&gt; <a>Ordering</a>) -&gt; s -&gt; <a>Maybe</a> a
--   <a>minimumByOf</a> :: <a>Traversal'</a> s a -&gt; (a -&gt; a -&gt; <a>Ordering</a>) -&gt; s -&gt; <a>Maybe</a> a
--   </pre>
minimumByOf :: () => Getting Endo Endo Maybe a s a -> a -> a -> Ordering -> s -> Maybe a

-- | Obtain the maximum element (if any) targeted by a <a>Fold</a>,
--   <a>Traversal</a>, <a>Lens</a>, <a>Iso</a>, or <a>Getter</a> according
--   to a user supplied <a>Ordering</a>.
--   
--   <pre>
--   &gt;&gt;&gt; maximumByOf traverse (compare `on` length) ["mustard","relish","ham"]
--   Just "mustard"
--   </pre>
--   
--   In the interest of efficiency, This operation has semantics more
--   strict than strictly necessary.
--   
--   <pre>
--   <a>maximumBy</a> cmp ≡ <a>fromMaybe</a> (<a>error</a> "empty") <a>.</a> <a>maximumByOf</a> <a>folded</a> cmp
--   </pre>
--   
--   <pre>
--   <a>maximumByOf</a> :: <a>Getter</a> s a     -&gt; (a -&gt; a -&gt; <a>Ordering</a>) -&gt; s -&gt; <a>Maybe</a> a
--   <a>maximumByOf</a> :: <a>Fold</a> s a       -&gt; (a -&gt; a -&gt; <a>Ordering</a>) -&gt; s -&gt; <a>Maybe</a> a
--   <a>maximumByOf</a> :: <a>Iso'</a> s a       -&gt; (a -&gt; a -&gt; <a>Ordering</a>) -&gt; s -&gt; <a>Maybe</a> a
--   <a>maximumByOf</a> :: <a>Lens'</a> s a      -&gt; (a -&gt; a -&gt; <a>Ordering</a>) -&gt; s -&gt; <a>Maybe</a> a
--   <a>maximumByOf</a> :: <a>Traversal'</a> s a -&gt; (a -&gt; a -&gt; <a>Ordering</a>) -&gt; s -&gt; <a>Maybe</a> a
--   </pre>
maximumByOf :: () => Getting Endo Endo Maybe a s a -> a -> a -> Ordering -> s -> Maybe a

-- | Obtain the minimum element targeted by a <a>Fold1</a> or
--   <a>Traversal1</a>.
--   
--   <pre>
--   &gt;&gt;&gt; minimum1Of traverse1 (1 :| [2..10])
--   1
--   </pre>
--   
--   <pre>
--   <a>minimum1Of</a> :: <a>Ord</a> a =&gt; <a>Getter</a> s a      -&gt; s -&gt; a
--   <a>minimum1Of</a> :: <a>Ord</a> a =&gt; <a>Fold1</a> s a       -&gt; s -&gt; a
--   <a>minimum1Of</a> :: <a>Ord</a> a =&gt; <a>Iso'</a> s a        -&gt; s -&gt; a
--   <a>minimum1Of</a> :: <a>Ord</a> a =&gt; <a>Lens'</a> s a       -&gt; s -&gt; a
--   <a>minimum1Of</a> :: <a>Ord</a> a =&gt; <a>Traversal1'</a> s a -&gt; s -&gt; a
--   </pre>
minimum1Of :: Ord a => Getting Min a s a -> s -> a

-- | Obtain the minimum element (if any) targeted by a <a>Fold</a> or
--   <a>Traversal</a> safely.
--   
--   Note: <a>minimumOf</a> on a valid <a>Iso</a>, <a>Lens</a> or
--   <a>Getter</a> will always return <a>Just</a> a value.
--   
--   <pre>
--   &gt;&gt;&gt; minimumOf traverse [1..10]
--   Just 1
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; minimumOf traverse []
--   Nothing
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; minimumOf (folded.filtered even) [1,4,3,6,7,9,2]
--   Just 2
--   </pre>
--   
--   <pre>
--   <a>minimum</a> ≡ <a>fromMaybe</a> (<a>error</a> "empty") <a>.</a> <a>minimumOf</a> <a>folded</a>
--   </pre>
--   
--   In the interest of efficiency, This operation has semantics more
--   strict than strictly necessary. <tt><a>rmap</a> <a>getMin</a>
--   (<a>foldMapOf</a> l <a>Min</a>)</tt> has lazier semantics but could
--   leak memory.
--   
--   <pre>
--   <a>minimumOf</a> :: <a>Ord</a> a =&gt; <a>Getter</a> s a     -&gt; s -&gt; <a>Maybe</a> a
--   <a>minimumOf</a> :: <a>Ord</a> a =&gt; <a>Fold</a> s a       -&gt; s -&gt; <a>Maybe</a> a
--   <a>minimumOf</a> :: <a>Ord</a> a =&gt; <a>Iso'</a> s a       -&gt; s -&gt; <a>Maybe</a> a
--   <a>minimumOf</a> :: <a>Ord</a> a =&gt; <a>Lens'</a> s a      -&gt; s -&gt; <a>Maybe</a> a
--   <a>minimumOf</a> :: <a>Ord</a> a =&gt; <a>Traversal'</a> s a -&gt; s -&gt; <a>Maybe</a> a
--   </pre>
minimumOf :: Ord a => Getting Endo Endo Maybe a s a -> s -> Maybe a

-- | Obtain the maximum element targeted by a <a>Fold1</a> or
--   <a>Traversal1</a>.
--   
--   <pre>
--   &gt;&gt;&gt; maximum1Of traverse1 (1 :| [2..10])
--   10
--   </pre>
--   
--   <pre>
--   <a>maximum1Of</a> :: <a>Ord</a> a =&gt; <a>Getter</a> s a      -&gt; s -&gt; a
--   <a>maximum1Of</a> :: <a>Ord</a> a =&gt; <a>Fold1</a> s a       -&gt; s -&gt; a
--   <a>maximum1Of</a> :: <a>Ord</a> a =&gt; <a>Iso'</a> s a        -&gt; s -&gt; a
--   <a>maximum1Of</a> :: <a>Ord</a> a =&gt; <a>Lens'</a> s a       -&gt; s -&gt; a
--   <a>maximum1Of</a> :: <a>Ord</a> a =&gt; <a>Traversal1'</a> s a -&gt; s -&gt; a
--   </pre>
maximum1Of :: Ord a => Getting Max a s a -> s -> a

-- | Obtain the maximum element (if any) targeted by a <a>Fold</a> or
--   <a>Traversal</a> safely.
--   
--   Note: <a>maximumOf</a> on a valid <a>Iso</a>, <a>Lens</a> or
--   <a>Getter</a> will always return <a>Just</a> a value.
--   
--   <pre>
--   &gt;&gt;&gt; maximumOf traverse [1..10]
--   Just 10
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; maximumOf traverse []
--   Nothing
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; maximumOf (folded.filtered even) [1,4,3,6,7,9,2]
--   Just 6
--   </pre>
--   
--   <pre>
--   <a>maximum</a> ≡ <a>fromMaybe</a> (<a>error</a> "empty") <a>.</a> <a>maximumOf</a> <a>folded</a>
--   </pre>
--   
--   In the interest of efficiency, This operation has semantics more
--   strict than strictly necessary. <tt><a>rmap</a> <a>getMax</a>
--   (<a>foldMapOf</a> l <a>Max</a>)</tt> has lazier semantics but could
--   leak memory.
--   
--   <pre>
--   <a>maximumOf</a> :: <a>Ord</a> a =&gt; <a>Getter</a> s a     -&gt; s -&gt; <a>Maybe</a> a
--   <a>maximumOf</a> :: <a>Ord</a> a =&gt; <a>Fold</a> s a       -&gt; s -&gt; <a>Maybe</a> a
--   <a>maximumOf</a> :: <a>Ord</a> a =&gt; <a>Iso'</a> s a       -&gt; s -&gt; <a>Maybe</a> a
--   <a>maximumOf</a> :: <a>Ord</a> a =&gt; <a>Lens'</a> s a      -&gt; s -&gt; <a>Maybe</a> a
--   <a>maximumOf</a> :: <a>Ord</a> a =&gt; <a>Traversal'</a> s a -&gt; s -&gt; <a>Maybe</a> a
--   </pre>
maximumOf :: Ord a => Getting Endo Endo Maybe a s a -> s -> Maybe a

-- | Returns <a>True</a> if this <a>Fold</a> or <a>Traversal</a> has any
--   targets in the given container.
--   
--   A more "conversational" alias for this combinator is <a>has</a>.
--   
--   Note: <a>notNullOf</a> on a valid <a>Iso</a>, <a>Lens</a> or
--   <a>Getter</a> should always return <a>True</a>.
--   
--   <pre>
--   <a>not</a> <a>.</a> <a>null</a> ≡ <a>notNullOf</a> <a>folded</a>
--   </pre>
--   
--   This may be rather inefficient compared to the <tt><a>not</a> <a>.</a>
--   <a>null</a></tt> check of many containers.
--   
--   <pre>
--   &gt;&gt;&gt; notNullOf _1 (1,2)
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; notNullOf traverse [1..10]
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; notNullOf folded []
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; notNullOf (element 20) [1..10]
--   False
--   </pre>
--   
--   <pre>
--   <a>notNullOf</a> (<a>folded</a> <a>.</a> <tt>_1</tt> <a>.</a> <a>folded</a>) :: (<a>Foldable</a> f, <a>Foldable</a> g) =&gt; f (g a, b) -&gt; <a>Bool</a>
--   </pre>
--   
--   <pre>
--   <a>notNullOf</a> :: <a>Getter</a> s a     -&gt; s -&gt; <a>Bool</a>
--   <a>notNullOf</a> :: <a>Fold</a> s a       -&gt; s -&gt; <a>Bool</a>
--   <a>notNullOf</a> :: <a>Iso'</a> s a       -&gt; s -&gt; <a>Bool</a>
--   <a>notNullOf</a> :: <a>Lens'</a> s a      -&gt; s -&gt; <a>Bool</a>
--   <a>notNullOf</a> :: <a>Traversal'</a> s a -&gt; s -&gt; <a>Bool</a>
--   </pre>
notNullOf :: () => Getting Any s a -> s -> Bool

-- | Returns <a>True</a> if this <a>Fold</a> or <a>Traversal</a> has no
--   targets in the given container.
--   
--   Note: <a>nullOf</a> on a valid <a>Iso</a>, <a>Lens</a> or
--   <a>Getter</a> should always return <a>False</a>.
--   
--   <pre>
--   <a>null</a> ≡ <a>nullOf</a> <a>folded</a>
--   </pre>
--   
--   This may be rather inefficient compared to the <a>null</a> check of
--   many containers.
--   
--   <pre>
--   &gt;&gt;&gt; nullOf _1 (1,2)
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; nullOf ignored ()
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; nullOf traverse []
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; nullOf (element 20) [1..10]
--   True
--   </pre>
--   
--   <pre>
--   <a>nullOf</a> (<a>folded</a> <a>.</a> <tt>_1</tt> <a>.</a> <a>folded</a>) :: (<a>Foldable</a> f, <a>Foldable</a> g) =&gt; f (g a, b) -&gt; <a>Bool</a>
--   </pre>
--   
--   <pre>
--   <a>nullOf</a> :: <a>Getter</a> s a     -&gt; s -&gt; <a>Bool</a>
--   <a>nullOf</a> :: <a>Fold</a> s a       -&gt; s -&gt; <a>Bool</a>
--   <a>nullOf</a> :: <a>Iso'</a> s a       -&gt; s -&gt; <a>Bool</a>
--   <a>nullOf</a> :: <a>Lens'</a> s a      -&gt; s -&gt; <a>Bool</a>
--   <a>nullOf</a> :: <a>Traversal'</a> s a -&gt; s -&gt; <a>Bool</a>
--   </pre>
nullOf :: () => Getting All s a -> s -> Bool

-- | Retrieve the <a>Last</a> entry of a <a>Fold1</a> or <a>Traversal1</a>
--   or retrieve the result from a <a>Getter</a> or <a>Lens</a>.o
--   
--   <pre>
--   &gt;&gt;&gt; last1Of traverse1 (1 :| [2..10])
--   10
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; last1Of both1 (1,2)
--   2
--   </pre>
--   
--   <pre>
--   <a>last1Of</a> :: <a>Getter</a> s a      -&gt; s -&gt; <a>Maybe</a> a
--   <a>last1Of</a> :: <a>Fold1</a> s a       -&gt; s -&gt; <a>Maybe</a> a
--   <a>last1Of</a> :: <a>Lens'</a> s a       -&gt; s -&gt; <a>Maybe</a> a
--   <a>last1Of</a> :: <a>Iso'</a> s a        -&gt; s -&gt; <a>Maybe</a> a
--   <a>last1Of</a> :: <a>Traversal1'</a> s a -&gt; s -&gt; <a>Maybe</a> a
--   </pre>
last1Of :: () => Getting Last a s a -> s -> a

-- | Retrieve the <a>Last</a> entry of a <a>Fold</a> or <a>Traversal</a> or
--   retrieve <a>Just</a> the result from a <a>Getter</a> or <a>Lens</a>.
--   
--   The answer is computed in a manner that leaks space less than
--   <tt><tt>ala</tt> <a>Last</a> <a>.</a> <a>foldMapOf</a></tt> and gives
--   you back access to the outermost <a>Just</a> constructor more quickly,
--   but may have worse constant factors.
--   
--   <pre>
--   &gt;&gt;&gt; lastOf traverse [1..10]
--   Just 10
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; lastOf both (1,2)
--   Just 2
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; lastOf ignored ()
--   Nothing
--   </pre>
--   
--   <pre>
--   <a>lastOf</a> :: <a>Getter</a> s a     -&gt; s -&gt; <a>Maybe</a> a
--   <a>lastOf</a> :: <a>Fold</a> s a       -&gt; s -&gt; <a>Maybe</a> a
--   <a>lastOf</a> :: <a>Lens'</a> s a      -&gt; s -&gt; <a>Maybe</a> a
--   <a>lastOf</a> :: <a>Iso'</a> s a       -&gt; s -&gt; <a>Maybe</a> a
--   <a>lastOf</a> :: <a>Traversal'</a> s a -&gt; s -&gt; <a>Maybe</a> a
--   </pre>
lastOf :: () => Getting Rightmost a s a -> s -> Maybe a

-- | Retrieve the <a>First</a> entry of a <a>Fold1</a> or <a>Traversal1</a>
--   or the result from a <a>Getter</a> or <a>Lens</a>.
--   
--   <pre>
--   &gt;&gt;&gt; first1Of traverse1 (1 :| [2..10])
--   1
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; first1Of both1 (1,2)
--   1
--   </pre>
--   
--   <i>Note:</i> this is different from <a>^.</a>.
--   
--   <pre>
--   &gt;&gt;&gt; first1Of traverse1 ([1,2] :| [[3,4],[5,6]])
--   [1,2]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; ([1,2] :| [[3,4],[5,6]]) ^. traverse1
--   [1,2,3,4,5,6]
--   </pre>
--   
--   <pre>
--   <a>first1Of</a> :: <a>Getter</a> s a      -&gt; s -&gt; a
--   <a>first1Of</a> :: <a>Fold1</a> s a       -&gt; s -&gt; a
--   <a>first1Of</a> :: <a>Lens'</a> s a       -&gt; s -&gt; a
--   <a>first1Of</a> :: <a>Iso'</a> s a        -&gt; s -&gt; a
--   <a>first1Of</a> :: <a>Traversal1'</a> s a -&gt; s -&gt; a
--   </pre>
first1Of :: () => Getting First a s a -> s -> a

-- | Retrieve the <a>First</a> entry of a <a>Fold</a> or <a>Traversal</a>
--   or retrieve <a>Just</a> the result from a <a>Getter</a> or
--   <a>Lens</a>.
--   
--   The answer is computed in a manner that leaks space less than
--   <tt><tt>ala</tt> <a>First</a> <a>.</a> <a>foldMapOf</a></tt> and gives
--   you back access to the outermost <a>Just</a> constructor more quickly,
--   but may have worse constant factors.
--   
--   Note: this could been named <tt>headOf</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; firstOf traverse [1..10]
--   Just 1
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; firstOf both (1,2)
--   Just 1
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; firstOf ignored ()
--   Nothing
--   </pre>
--   
--   <pre>
--   <a>firstOf</a> :: <a>Getter</a> s a     -&gt; s -&gt; <a>Maybe</a> a
--   <a>firstOf</a> :: <a>Fold</a> s a       -&gt; s -&gt; <a>Maybe</a> a
--   <a>firstOf</a> :: <a>Lens'</a> s a      -&gt; s -&gt; <a>Maybe</a> a
--   <a>firstOf</a> :: <a>Iso'</a> s a       -&gt; s -&gt; <a>Maybe</a> a
--   <a>firstOf</a> :: <a>Traversal'</a> s a -&gt; s -&gt; <a>Maybe</a> a
--   </pre>
firstOf :: () => Getting Leftmost a s a -> s -> Maybe a

-- | Perform an *UNSAFE* <a>head</a> of a <a>Fold</a> or <a>Traversal</a>
--   assuming that it is there.
--   
--   <pre>
--   &gt;&gt;&gt; Left 4 ^?! _Left
--   4
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; "world" ^?! ix 3
--   'l'
--   </pre>
--   
--   <pre>
--   (<a>^?!</a>) :: s -&gt; <a>Getter</a> s a     -&gt; a
--   (<a>^?!</a>) :: s -&gt; <a>Fold</a> s a       -&gt; a
--   (<a>^?!</a>) :: s -&gt; <a>Lens'</a> s a      -&gt; a
--   (<a>^?!</a>) :: s -&gt; <a>Iso'</a> s a       -&gt; a
--   (<a>^?!</a>) :: s -&gt; <a>Traversal'</a> s a -&gt; a
--   </pre>
(^?!) :: HasCallStack => s -> Getting Endo a s a -> a
infixl 8 ^?!

-- | Perform a safe <a>head</a> of a <a>Fold</a> or <a>Traversal</a> or
--   retrieve <a>Just</a> the result from a <a>Getter</a> or <a>Lens</a>.
--   
--   When using a <a>Traversal</a> as a partial <a>Lens</a>, or a
--   <a>Fold</a> as a partial <a>Getter</a> this can be a convenient way to
--   extract the optional value.
--   
--   Note: if you get stack overflows due to this, you may want to use
--   <a>firstOf</a> instead, which can deal more gracefully with heavily
--   left-biased trees.
--   
--   <pre>
--   &gt;&gt;&gt; Left 4 ^?_Left
--   Just 4
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Right 4 ^?_Left
--   Nothing
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; "world" ^? ix 3
--   Just 'l'
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; "world" ^? ix 20
--   Nothing
--   </pre>
--   
--   <pre>
--   (<a>^?</a>) ≡ <a>flip</a> <a>preview</a>
--   </pre>
--   
--   <pre>
--   (<a>^?</a>) :: s -&gt; <a>Getter</a> s a     -&gt; <a>Maybe</a> a
--   (<a>^?</a>) :: s -&gt; <a>Fold</a> s a       -&gt; <a>Maybe</a> a
--   (<a>^?</a>) :: s -&gt; <a>Lens'</a> s a      -&gt; <a>Maybe</a> a
--   (<a>^?</a>) :: s -&gt; <a>Iso'</a> s a       -&gt; <a>Maybe</a> a
--   (<a>^?</a>) :: s -&gt; <a>Traversal'</a> s a -&gt; <a>Maybe</a> a
--   </pre>
(^?) :: () => s -> Getting First a s a -> Maybe a
infixl 8 ^?

-- | Calculate the number of targets there are for a <a>Fold</a> in a given
--   container.
--   
--   <i>Note:</i> This can be rather inefficient for large containers and
--   just like <a>length</a>, this will not terminate for infinite folds.
--   
--   <pre>
--   <a>length</a> ≡ <a>lengthOf</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; lengthOf _1 ("hello",())
--   1
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; lengthOf traverse [1..10]
--   10
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; lengthOf (traverse.traverse) [[1,2],[3,4],[5,6]]
--   6
--   </pre>
--   
--   <pre>
--   <a>lengthOf</a> (<a>folded</a> <a>.</a> <a>folded</a>) :: (<a>Foldable</a> f, <a>Foldable</a> g) =&gt; f (g a) -&gt; <a>Int</a>
--   </pre>
--   
--   <pre>
--   <a>lengthOf</a> :: <a>Getter</a> s a     -&gt; s -&gt; <a>Int</a>
--   <a>lengthOf</a> :: <a>Fold</a> s a       -&gt; s -&gt; <a>Int</a>
--   <a>lengthOf</a> :: <a>Lens'</a> s a      -&gt; s -&gt; <a>Int</a>
--   <a>lengthOf</a> :: <a>Iso'</a> s a       -&gt; s -&gt; <a>Int</a>
--   <a>lengthOf</a> :: <a>Traversal'</a> s a -&gt; s -&gt; <a>Int</a>
--   </pre>
lengthOf :: () => Getting Endo Endo Int s a -> s -> Int

-- | Concatenate all of the lists targeted by a <a>Fold</a> into a longer
--   list.
--   
--   <pre>
--   &gt;&gt;&gt; concatOf both ("pan","ama")
--   "panama"
--   </pre>
--   
--   <pre>
--   <a>concat</a> ≡ <a>concatOf</a> <a>folded</a>
--   <a>concatOf</a> ≡ <a>view</a>
--   </pre>
--   
--   <pre>
--   <a>concatOf</a> :: <a>Getter</a> s [r]     -&gt; s -&gt; [r]
--   <a>concatOf</a> :: <a>Fold</a> s [r]       -&gt; s -&gt; [r]
--   <a>concatOf</a> :: <a>Iso'</a> s [r]       -&gt; s -&gt; [r]
--   <a>concatOf</a> :: <a>Lens'</a> s [r]      -&gt; s -&gt; [r]
--   <a>concatOf</a> :: <a>Traversal'</a> s [r] -&gt; s -&gt; [r]
--   </pre>
concatOf :: () => Getting [r] s [r] -> s -> [r]

-- | Map a function over all the targets of a <a>Fold</a> of a container
--   and concatenate the resulting lists.
--   
--   <pre>
--   &gt;&gt;&gt; concatMapOf both (\x -&gt; [x, x + 1]) (1,3)
--   [1,2,3,4]
--   </pre>
--   
--   <pre>
--   <a>concatMap</a> ≡ <a>concatMapOf</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>concatMapOf</a> :: <a>Getter</a> s a     -&gt; (a -&gt; [r]) -&gt; s -&gt; [r]
--   <a>concatMapOf</a> :: <a>Fold</a> s a       -&gt; (a -&gt; [r]) -&gt; s -&gt; [r]
--   <a>concatMapOf</a> :: <a>Lens'</a> s a      -&gt; (a -&gt; [r]) -&gt; s -&gt; [r]
--   <a>concatMapOf</a> :: <a>Iso'</a> s a       -&gt; (a -&gt; [r]) -&gt; s -&gt; [r]
--   <a>concatMapOf</a> :: <a>Traversal'</a> s a -&gt; (a -&gt; [r]) -&gt; s -&gt; [r]
--   </pre>
concatMapOf :: () => Getting [r] s a -> a -> [r] -> s -> [r]

-- | Does the element not occur anywhere within a given <a>Fold</a> of the
--   structure?
--   
--   <pre>
--   &gt;&gt;&gt; notElemOf each 'd' ('a','b','c')
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; notElemOf each 'a' ('a','b','c')
--   False
--   </pre>
--   
--   <pre>
--   <a>notElem</a> ≡ <a>notElemOf</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>notElemOf</a> :: <a>Eq</a> a =&gt; <a>Getter</a> s a     -&gt; a -&gt; s -&gt; <a>Bool</a>
--   <a>notElemOf</a> :: <a>Eq</a> a =&gt; <a>Fold</a> s a       -&gt; a -&gt; s -&gt; <a>Bool</a>
--   <a>notElemOf</a> :: <a>Eq</a> a =&gt; <a>Iso'</a> s a       -&gt; a -&gt; s -&gt; <a>Bool</a>
--   <a>notElemOf</a> :: <a>Eq</a> a =&gt; <a>Lens'</a> s a      -&gt; a -&gt; s -&gt; <a>Bool</a>
--   <a>notElemOf</a> :: <a>Eq</a> a =&gt; <a>Traversal'</a> s a -&gt; a -&gt; s -&gt; <a>Bool</a>
--   <a>notElemOf</a> :: <a>Eq</a> a =&gt; <a>Prism'</a> s a     -&gt; a -&gt; s -&gt; <a>Bool</a>
--   </pre>
notElemOf :: Eq a => Getting All s a -> a -> s -> Bool

-- | Does the element occur anywhere within a given <a>Fold</a> of the
--   structure?
--   
--   <pre>
--   &gt;&gt;&gt; elemOf both "hello" ("hello","world")
--   True
--   </pre>
--   
--   <pre>
--   <a>elem</a> ≡ <a>elemOf</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>elemOf</a> :: <a>Eq</a> a =&gt; <a>Getter</a> s a     -&gt; a -&gt; s -&gt; <a>Bool</a>
--   <a>elemOf</a> :: <a>Eq</a> a =&gt; <a>Fold</a> s a       -&gt; a -&gt; s -&gt; <a>Bool</a>
--   <a>elemOf</a> :: <a>Eq</a> a =&gt; <a>Lens'</a> s a      -&gt; a -&gt; s -&gt; <a>Bool</a>
--   <a>elemOf</a> :: <a>Eq</a> a =&gt; <a>Iso'</a> s a       -&gt; a -&gt; s -&gt; <a>Bool</a>
--   <a>elemOf</a> :: <a>Eq</a> a =&gt; <a>Traversal'</a> s a -&gt; a -&gt; s -&gt; <a>Bool</a>
--   <a>elemOf</a> :: <a>Eq</a> a =&gt; <a>Prism'</a> s a     -&gt; a -&gt; s -&gt; <a>Bool</a>
--   </pre>
elemOf :: Eq a => Getting Any s a -> a -> s -> Bool

-- | The sum of a collection of actions, generalizing <a>concatOf</a>.
--   
--   <pre>
--   &gt;&gt;&gt; msumOf both ("hello","world")
--   "helloworld"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; msumOf each (Nothing, Just "hello", Nothing)
--   Just "hello"
--   </pre>
--   
--   <pre>
--   <a>msum</a> ≡ <a>msumOf</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>msumOf</a> :: <a>MonadPlus</a> m =&gt; <a>Getter</a> s (m a)     -&gt; s -&gt; m a
--   <a>msumOf</a> :: <a>MonadPlus</a> m =&gt; <a>Fold</a> s (m a)       -&gt; s -&gt; m a
--   <a>msumOf</a> :: <a>MonadPlus</a> m =&gt; <a>Lens'</a> s (m a)      -&gt; s -&gt; m a
--   <a>msumOf</a> :: <a>MonadPlus</a> m =&gt; <a>Iso'</a> s (m a)       -&gt; s -&gt; m a
--   <a>msumOf</a> :: <a>MonadPlus</a> m =&gt; <a>Traversal'</a> s (m a) -&gt; s -&gt; m a
--   <a>msumOf</a> :: <a>MonadPlus</a> m =&gt; <a>Prism'</a> s (m a)     -&gt; s -&gt; m a
--   </pre>
msumOf :: MonadPlus m => Getting Endo m a s m a -> s -> m a

-- | The sum of a collection of actions, generalizing <a>concatOf</a>.
--   
--   <pre>
--   &gt;&gt;&gt; asumOf both ("hello","world")
--   "helloworld"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; asumOf each (Nothing, Just "hello", Nothing)
--   Just "hello"
--   </pre>
--   
--   <pre>
--   <a>asum</a> ≡ <a>asumOf</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>asumOf</a> :: <a>Alternative</a> f =&gt; <a>Getter</a> s (f a)     -&gt; s -&gt; f a
--   <a>asumOf</a> :: <a>Alternative</a> f =&gt; <a>Fold</a> s (f a)       -&gt; s -&gt; f a
--   <a>asumOf</a> :: <a>Alternative</a> f =&gt; <a>Lens'</a> s (f a)      -&gt; s -&gt; f a
--   <a>asumOf</a> :: <a>Alternative</a> f =&gt; <a>Iso'</a> s (f a)       -&gt; s -&gt; f a
--   <a>asumOf</a> :: <a>Alternative</a> f =&gt; <a>Traversal'</a> s (f a) -&gt; s -&gt; f a
--   <a>asumOf</a> :: <a>Alternative</a> f =&gt; <a>Prism'</a> s (f a)     -&gt; s -&gt; f a
--   </pre>
asumOf :: Alternative f => Getting Endo f a s f a -> s -> f a

-- | Evaluate each monadic action referenced by a <a>Fold</a> on the
--   structure from left to right, and ignore the results.
--   
--   <pre>
--   &gt;&gt;&gt; sequenceOf_ both (putStrLn "hello",putStrLn "world")
--   hello
--   world
--   </pre>
--   
--   <pre>
--   <a>sequence_</a> ≡ <a>sequenceOf_</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>sequenceOf_</a> :: <a>Monad</a> m =&gt; <a>Getter</a> s (m a)     -&gt; s -&gt; m ()
--   <a>sequenceOf_</a> :: <a>Monad</a> m =&gt; <a>Fold</a> s (m a)       -&gt; s -&gt; m ()
--   <a>sequenceOf_</a> :: <a>Monad</a> m =&gt; <a>Lens'</a> s (m a)      -&gt; s -&gt; m ()
--   <a>sequenceOf_</a> :: <a>Monad</a> m =&gt; <a>Iso'</a> s (m a)       -&gt; s -&gt; m ()
--   <a>sequenceOf_</a> :: <a>Monad</a> m =&gt; <a>Traversal'</a> s (m a) -&gt; s -&gt; m ()
--   <a>sequenceOf_</a> :: <a>Monad</a> m =&gt; <a>Prism'</a> s (m a)     -&gt; s -&gt; m ()
--   </pre>
sequenceOf_ :: Monad m => Getting Sequenced a m s m a -> s -> m ()

-- | <a>forMOf_</a> is <a>mapMOf_</a> with two of its arguments flipped.
--   
--   <pre>
--   &gt;&gt;&gt; forMOf_ both ("hello","world") putStrLn
--   hello
--   world
--   </pre>
--   
--   <pre>
--   <a>forM_</a> ≡ <a>forMOf_</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>forMOf_</a> :: <a>Monad</a> m =&gt; <a>Getter</a> s a     -&gt; s -&gt; (a -&gt; m r) -&gt; m ()
--   <a>forMOf_</a> :: <a>Monad</a> m =&gt; <a>Fold</a> s a       -&gt; s -&gt; (a -&gt; m r) -&gt; m ()
--   <a>forMOf_</a> :: <a>Monad</a> m =&gt; <a>Lens'</a> s a      -&gt; s -&gt; (a -&gt; m r) -&gt; m ()
--   <a>forMOf_</a> :: <a>Monad</a> m =&gt; <a>Iso'</a> s a       -&gt; s -&gt; (a -&gt; m r) -&gt; m ()
--   <a>forMOf_</a> :: <a>Monad</a> m =&gt; <a>Traversal'</a> s a -&gt; s -&gt; (a -&gt; m r) -&gt; m ()
--   <a>forMOf_</a> :: <a>Monad</a> m =&gt; <a>Prism'</a> s a     -&gt; s -&gt; (a -&gt; m r) -&gt; m ()
--   </pre>
forMOf_ :: Monad m => Getting Sequenced r m s a -> s -> a -> m r -> m ()

-- | Map each target of a <a>Fold</a> on a structure to a monadic action,
--   evaluate these actions from left to right, and ignore the results.
--   
--   <pre>
--   &gt;&gt;&gt; mapMOf_ both putStrLn ("hello","world")
--   hello
--   world
--   </pre>
--   
--   <pre>
--   <a>mapM_</a> ≡ <a>mapMOf_</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>mapMOf_</a> :: <a>Monad</a> m =&gt; <a>Getter</a> s a     -&gt; (a -&gt; m r) -&gt; s -&gt; m ()
--   <a>mapMOf_</a> :: <a>Monad</a> m =&gt; <a>Fold</a> s a       -&gt; (a -&gt; m r) -&gt; s -&gt; m ()
--   <a>mapMOf_</a> :: <a>Monad</a> m =&gt; <a>Lens'</a> s a      -&gt; (a -&gt; m r) -&gt; s -&gt; m ()
--   <a>mapMOf_</a> :: <a>Monad</a> m =&gt; <a>Iso'</a> s a       -&gt; (a -&gt; m r) -&gt; s -&gt; m ()
--   <a>mapMOf_</a> :: <a>Monad</a> m =&gt; <a>Traversal'</a> s a -&gt; (a -&gt; m r) -&gt; s -&gt; m ()
--   <a>mapMOf_</a> :: <a>Monad</a> m =&gt; <a>Prism'</a> s a     -&gt; (a -&gt; m r) -&gt; s -&gt; m ()
--   </pre>
mapMOf_ :: Monad m => Getting Sequenced r m s a -> a -> m r -> s -> m ()

-- | See <a>sequenceAOf_</a> and <a>traverse1Of_</a>.
--   
--   <pre>
--   <a>sequence1Of_</a> :: <a>Apply</a> f =&gt; <a>Fold1</a> s (f a) -&gt; s -&gt; f ()
--   </pre>
sequence1Of_ :: Functor f => Getting TraversedF a f s f a -> s -> f ()

-- | See <a>forOf_</a> and <a>traverse1Of_</a>.
--   
--   <pre>
--   &gt;&gt;&gt; for1Of_ both1 ("abc", "bcd") (\ks -&gt; Map.fromList [ (k, ()) | k &lt;- ks ])
--   fromList [('b',()),('c',())]
--   </pre>
--   
--   <pre>
--   <a>for1Of_</a> :: <a>Apply</a> f =&gt; <a>Fold1</a> s a -&gt; s -&gt; (a -&gt; f r) -&gt; f ()
--   </pre>
for1Of_ :: Functor f => Getting TraversedF r f s a -> s -> a -> f r -> f ()

-- | Traverse over all of the targets of a <a>Fold1</a>, computing an
--   <a>Apply</a> based answer.
--   
--   As long as you have <a>Applicative</a> or <a>Functor</a> effect you
--   are better using <a>traverseOf_</a>. The <a>traverse1Of_</a> is useful
--   only when you have genuine <a>Apply</a> effect.
--   
--   <pre>
--   &gt;&gt;&gt; traverse1Of_ both1 (\ks -&gt; Map.fromList [ (k, ()) | k &lt;- ks ]) ("abc", "bcd")
--   fromList [('b',()),('c',())]
--   </pre>
--   
--   <pre>
--   <a>traverse1Of_</a> :: <a>Apply</a> f =&gt; <a>Fold1</a> s a -&gt; (a -&gt; f r) -&gt; s -&gt; f ()
--   </pre>
traverse1Of_ :: Functor f => Getting TraversedF r f s a -> a -> f r -> s -> f ()

-- | Evaluate each action in observed by a <a>Fold</a> on a structure from
--   left to right, ignoring the results.
--   
--   <pre>
--   <a>sequenceA_</a> ≡ <a>sequenceAOf_</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; sequenceAOf_ both (putStrLn "hello",putStrLn "world")
--   hello
--   world
--   </pre>
--   
--   <pre>
--   <a>sequenceAOf_</a> :: <a>Functor</a> f     =&gt; <a>Getter</a> s (f a)     -&gt; s -&gt; f ()
--   <a>sequenceAOf_</a> :: <a>Applicative</a> f =&gt; <a>Fold</a> s (f a)       -&gt; s -&gt; f ()
--   <a>sequenceAOf_</a> :: <a>Functor</a> f     =&gt; <a>Lens'</a> s (f a)      -&gt; s -&gt; f ()
--   <a>sequenceAOf_</a> :: <a>Functor</a> f     =&gt; <a>Iso'</a> s (f a)       -&gt; s -&gt; f ()
--   <a>sequenceAOf_</a> :: <a>Applicative</a> f =&gt; <a>Traversal'</a> s (f a) -&gt; s -&gt; f ()
--   <a>sequenceAOf_</a> :: <a>Applicative</a> f =&gt; <a>Prism'</a> s (f a)     -&gt; s -&gt; f ()
--   </pre>
sequenceAOf_ :: Functor f => Getting Traversed a f s f a -> s -> f ()

-- | Traverse over all of the targets of a <a>Fold</a> (or <a>Getter</a>),
--   computing an <a>Applicative</a> (or <a>Functor</a>)-based answer, but
--   unlike <a>forOf</a> do not construct a new structure. <a>forOf_</a>
--   generalizes <a>for_</a> to work over any <a>Fold</a>.
--   
--   When passed a <a>Getter</a>, <a>forOf_</a> can work over any
--   <a>Functor</a>, but when passed a <a>Fold</a>, <a>forOf_</a> requires
--   an <a>Applicative</a>.
--   
--   <pre>
--   <a>for_</a> ≡ <a>forOf_</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; forOf_ both ("hello","world") putStrLn
--   hello
--   world
--   </pre>
--   
--   The rather specific signature of <a>forOf_</a> allows it to be used as
--   if the signature was any of:
--   
--   <pre>
--   <a>iforOf_</a> l s ≡ <a>forOf_</a> l s <a>.</a> <a>Indexed</a>
--   </pre>
--   
--   <pre>
--   <a>forOf_</a> :: <a>Functor</a> f     =&gt; <a>Getter</a> s a     -&gt; s -&gt; (a -&gt; f r) -&gt; f ()
--   <a>forOf_</a> :: <a>Applicative</a> f =&gt; <a>Fold</a> s a       -&gt; s -&gt; (a -&gt; f r) -&gt; f ()
--   <a>forOf_</a> :: <a>Functor</a> f     =&gt; <a>Lens'</a> s a      -&gt; s -&gt; (a -&gt; f r) -&gt; f ()
--   <a>forOf_</a> :: <a>Functor</a> f     =&gt; <a>Iso'</a> s a       -&gt; s -&gt; (a -&gt; f r) -&gt; f ()
--   <a>forOf_</a> :: <a>Applicative</a> f =&gt; <a>Traversal'</a> s a -&gt; s -&gt; (a -&gt; f r) -&gt; f ()
--   <a>forOf_</a> :: <a>Applicative</a> f =&gt; <a>Prism'</a> s a     -&gt; s -&gt; (a -&gt; f r) -&gt; f ()
--   </pre>
forOf_ :: Functor f => Getting Traversed r f s a -> s -> a -> f r -> f ()

-- | Traverse over all of the targets of a <a>Fold</a> (or <a>Getter</a>),
--   computing an <a>Applicative</a> (or <a>Functor</a>)-based answer, but
--   unlike <a>traverseOf</a> do not construct a new structure.
--   <a>traverseOf_</a> generalizes <a>traverse_</a> to work over any
--   <a>Fold</a>.
--   
--   When passed a <a>Getter</a>, <a>traverseOf_</a> can work over any
--   <a>Functor</a>, but when passed a <a>Fold</a>, <a>traverseOf_</a>
--   requires an <a>Applicative</a>.
--   
--   <pre>
--   &gt;&gt;&gt; traverseOf_ both putStrLn ("hello","world")
--   hello
--   world
--   </pre>
--   
--   <pre>
--   <a>traverse_</a> ≡ <a>traverseOf_</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>traverseOf_</a> <tt>_2</tt> :: <a>Functor</a> f =&gt; (c -&gt; f r) -&gt; (d, c) -&gt; f ()
--   <a>traverseOf_</a> <a>_Left</a> :: <a>Applicative</a> f =&gt; (a -&gt; f b) -&gt; <a>Either</a> a c -&gt; f ()
--   </pre>
--   
--   <pre>
--   <a>itraverseOf_</a> l ≡ <a>traverseOf_</a> l <a>.</a> <a>Indexed</a>
--   </pre>
--   
--   The rather specific signature of <a>traverseOf_</a> allows it to be
--   used as if the signature was any of:
--   
--   <pre>
--   <a>traverseOf_</a> :: <a>Functor</a> f     =&gt; <a>Getter</a> s a     -&gt; (a -&gt; f r) -&gt; s -&gt; f ()
--   <a>traverseOf_</a> :: <a>Applicative</a> f =&gt; <a>Fold</a> s a       -&gt; (a -&gt; f r) -&gt; s -&gt; f ()
--   <a>traverseOf_</a> :: <a>Functor</a> f     =&gt; <a>Lens'</a> s a      -&gt; (a -&gt; f r) -&gt; s -&gt; f ()
--   <a>traverseOf_</a> :: <a>Functor</a> f     =&gt; <a>Iso'</a> s a       -&gt; (a -&gt; f r) -&gt; s -&gt; f ()
--   <a>traverseOf_</a> :: <a>Applicative</a> f =&gt; <a>Traversal'</a> s a -&gt; (a -&gt; f r) -&gt; s -&gt; f ()
--   <a>traverseOf_</a> :: <a>Applicative</a> f =&gt; <a>Prism'</a> s a     -&gt; (a -&gt; f r) -&gt; s -&gt; f ()
--   </pre>
traverseOf_ :: Functor f => Getting Traversed r f s a -> a -> f r -> s -> f ()

-- | Calculate the <a>Sum</a> of every number targeted by a <a>Fold</a>.
--   
--   <pre>
--   &gt;&gt;&gt; sumOf both (5,6)
--   11
--   
--   &gt;&gt;&gt; sumOf folded [1,2,3,4]
--   10
--   
--   &gt;&gt;&gt; sumOf (folded.both) [(1,2),(3,4)]
--   10
--   
--   &gt;&gt;&gt; import Data.Data.Lens
--   
--   &gt;&gt;&gt; sumOf biplate [(1::Int,[]),(2,[(3::Int,4::Int)])] :: Int
--   10
--   </pre>
--   
--   <pre>
--   <a>sum</a> ≡ <a>sumOf</a> <a>folded</a>
--   </pre>
--   
--   This operation may be more strict than you would expect. If you want a
--   lazier version use <tt><tt>ala</tt> <a>Sum</a> <a>.</a>
--   <a>foldMapOf</a></tt>
--   
--   <pre>
--   <a>sumOf</a> <tt>_1</tt> :: <a>Num</a> a =&gt; (a, b) -&gt; a
--   <a>sumOf</a> (<a>folded</a> <a>.</a> <a>_1</a>) :: (<a>Foldable</a> f, <a>Num</a> a) =&gt; f (a, b) -&gt; a
--   </pre>
--   
--   <pre>
--   <a>sumOf</a> :: <a>Num</a> a =&gt; <a>Getter</a> s a     -&gt; s -&gt; a
--   <a>sumOf</a> :: <a>Num</a> a =&gt; <a>Fold</a> s a       -&gt; s -&gt; a
--   <a>sumOf</a> :: <a>Num</a> a =&gt; <a>Lens'</a> s a      -&gt; s -&gt; a
--   <a>sumOf</a> :: <a>Num</a> a =&gt; <a>Iso'</a> s a       -&gt; s -&gt; a
--   <a>sumOf</a> :: <a>Num</a> a =&gt; <a>Traversal'</a> s a -&gt; s -&gt; a
--   <a>sumOf</a> :: <a>Num</a> a =&gt; <a>Prism'</a> s a     -&gt; s -&gt; a
--   </pre>
sumOf :: Num a => Getting Endo Endo a s a -> s -> a

-- | Calculate the <a>Product</a> of every number targeted by a
--   <a>Fold</a>.
--   
--   <pre>
--   &gt;&gt;&gt; productOf both (4,5)
--   20
--   
--   &gt;&gt;&gt; productOf folded [1,2,3,4,5]
--   120
--   </pre>
--   
--   <pre>
--   <a>product</a> ≡ <a>productOf</a> <a>folded</a>
--   </pre>
--   
--   This operation may be more strict than you would expect. If you want a
--   lazier version use <tt><tt>ala</tt> <a>Product</a> <a>.</a>
--   <a>foldMapOf</a></tt>
--   
--   <pre>
--   <a>productOf</a> :: <a>Num</a> a =&gt; <a>Getter</a> s a     -&gt; s -&gt; a
--   <a>productOf</a> :: <a>Num</a> a =&gt; <a>Fold</a> s a       -&gt; s -&gt; a
--   <a>productOf</a> :: <a>Num</a> a =&gt; <a>Lens'</a> s a      -&gt; s -&gt; a
--   <a>productOf</a> :: <a>Num</a> a =&gt; <a>Iso'</a> s a       -&gt; s -&gt; a
--   <a>productOf</a> :: <a>Num</a> a =&gt; <a>Traversal'</a> s a -&gt; s -&gt; a
--   <a>productOf</a> :: <a>Num</a> a =&gt; <a>Prism'</a> s a     -&gt; s -&gt; a
--   </pre>
productOf :: Num a => Getting Endo Endo a s a -> s -> a

-- | Returns <a>True</a> only if no targets of a <a>Fold</a> satisfy a
--   predicate.
--   
--   <pre>
--   &gt;&gt;&gt; noneOf each (is _Nothing) (Just 3, Just 4, Just 5)
--   True
--   
--   &gt;&gt;&gt; noneOf (folded.folded) (&lt;10) [[13,99,20],[3,71,42]]
--   False
--   </pre>
--   
--   <pre>
--   <a>inoneOf</a> l = <a>noneOf</a> l <a>.</a> <a>Indexed</a>
--   </pre>
--   
--   <pre>
--   <a>noneOf</a> :: <a>Getter</a> s a     -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>noneOf</a> :: <a>Fold</a> s a       -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>noneOf</a> :: <a>Lens'</a> s a      -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>noneOf</a> :: <a>Iso'</a> s a       -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>noneOf</a> :: <a>Traversal'</a> s a -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>noneOf</a> :: <a>Prism'</a> s a     -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   </pre>
noneOf :: () => Getting Any s a -> a -> Bool -> s -> Bool

-- | Returns <a>True</a> if every target of a <a>Fold</a> satisfies a
--   predicate.
--   
--   <pre>
--   &gt;&gt;&gt; allOf both (&gt;=3) (4,5)
--   True
--   
--   &gt;&gt;&gt; allOf folded (&gt;=2) [1..10]
--   False
--   </pre>
--   
--   <pre>
--   <a>all</a> ≡ <a>allOf</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>iallOf</a> l = <a>allOf</a> l <a>.</a> <a>Indexed</a>
--   </pre>
--   
--   <pre>
--   <a>allOf</a> :: <a>Getter</a> s a     -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>allOf</a> :: <a>Fold</a> s a       -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>allOf</a> :: <a>Lens'</a> s a      -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>allOf</a> :: <a>Iso'</a> s a       -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>allOf</a> :: <a>Traversal'</a> s a -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>allOf</a> :: <a>Prism'</a> s a     -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   </pre>
allOf :: () => Getting All s a -> a -> Bool -> s -> Bool

-- | Returns <a>True</a> if any target of a <a>Fold</a> satisfies a
--   predicate.
--   
--   <pre>
--   &gt;&gt;&gt; anyOf both (=='x') ('x','y')
--   True
--   
--   &gt;&gt;&gt; import Data.Data.Lens
--   
--   &gt;&gt;&gt; anyOf biplate (== "world") (((),2::Int),"hello",("world",11::Int))
--   True
--   </pre>
--   
--   <pre>
--   <a>any</a> ≡ <a>anyOf</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>ianyOf</a> l ≡ <a>anyOf</a> l <a>.</a> <a>Indexed</a>
--   </pre>
--   
--   <pre>
--   <a>anyOf</a> :: <a>Getter</a> s a     -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>anyOf</a> :: <a>Fold</a> s a       -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>anyOf</a> :: <a>Lens'</a> s a      -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>anyOf</a> :: <a>Iso'</a> s a       -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>anyOf</a> :: <a>Traversal'</a> s a -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   <a>anyOf</a> :: <a>Prism'</a> s a     -&gt; (a -&gt; <a>Bool</a>) -&gt; s -&gt; <a>Bool</a>
--   </pre>
anyOf :: () => Getting Any s a -> a -> Bool -> s -> Bool

-- | Returns <a>True</a> if any target of a <a>Fold</a> is <a>True</a>.
--   
--   <pre>
--   &gt;&gt;&gt; orOf both (True,False)
--   True
--   
--   &gt;&gt;&gt; orOf both (False,False)
--   False
--   </pre>
--   
--   <pre>
--   <a>or</a> ≡ <a>orOf</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>orOf</a> :: <a>Getter</a> s <a>Bool</a>     -&gt; s -&gt; <a>Bool</a>
--   <a>orOf</a> :: <a>Fold</a> s <a>Bool</a>       -&gt; s -&gt; <a>Bool</a>
--   <a>orOf</a> :: <a>Lens'</a> s <a>Bool</a>      -&gt; s -&gt; <a>Bool</a>
--   <a>orOf</a> :: <a>Iso'</a> s <a>Bool</a>       -&gt; s -&gt; <a>Bool</a>
--   <a>orOf</a> :: <a>Traversal'</a> s <a>Bool</a> -&gt; s -&gt; <a>Bool</a>
--   <a>orOf</a> :: <a>Prism'</a> s <a>Bool</a>     -&gt; s -&gt; <a>Bool</a>
--   </pre>
orOf :: () => Getting Any s Bool -> s -> Bool

-- | Returns <a>True</a> if every target of a <a>Fold</a> is <a>True</a>.
--   
--   <pre>
--   &gt;&gt;&gt; andOf both (True,False)
--   False
--   
--   &gt;&gt;&gt; andOf both (True,True)
--   True
--   </pre>
--   
--   <pre>
--   <a>and</a> ≡ <a>andOf</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>andOf</a> :: <a>Getter</a> s <a>Bool</a>     -&gt; s -&gt; <a>Bool</a>
--   <a>andOf</a> :: <a>Fold</a> s <a>Bool</a>       -&gt; s -&gt; <a>Bool</a>
--   <a>andOf</a> :: <a>Lens'</a> s <a>Bool</a>      -&gt; s -&gt; <a>Bool</a>
--   <a>andOf</a> :: <a>Iso'</a> s <a>Bool</a>       -&gt; s -&gt; <a>Bool</a>
--   <a>andOf</a> :: <a>Traversal'</a> s <a>Bool</a> -&gt; s -&gt; <a>Bool</a>
--   <a>andOf</a> :: <a>Prism'</a> s <a>Bool</a>     -&gt; s -&gt; <a>Bool</a>
--   </pre>
andOf :: () => Getting All s Bool -> s -> Bool

-- | A convenient infix (flipped) version of <a>toListOf</a>.
--   
--   <pre>
--   &gt;&gt;&gt; [[1,2],[3]]^..id
--   [[[1,2],[3]]]
--   
--   &gt;&gt;&gt; [[1,2],[3]]^..traverse
--   [[1,2],[3]]
--   
--   &gt;&gt;&gt; [[1,2],[3]]^..traverse.traverse
--   [1,2,3]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (1,2)^..both
--   [1,2]
--   </pre>
--   
--   <pre>
--   <a>toList</a> xs ≡ xs <a>^..</a> <a>folded</a>
--   (<a>^..</a>) ≡ <a>flip</a> <a>toListOf</a>
--   </pre>
--   
--   <pre>
--   (<a>^..</a>) :: s -&gt; <a>Getter</a> s a     -&gt; <a>a</a> :: s -&gt; <a>Fold</a> s a       -&gt; <a>a</a> :: s -&gt; <a>Lens'</a> s a      -&gt; <a>a</a> :: s -&gt; <a>Iso'</a> s a       -&gt; <a>a</a> :: s -&gt; <a>Traversal'</a> s a -&gt; <a>a</a> :: s -&gt; <a>Prism'</a> s a     -&gt; [a]
--   </pre>
(^..) :: () => s -> Getting Endo [a] s a -> [a]
infixl 8 ^..

-- | Extract a <a>NonEmpty</a> of the targets of <a>Fold1</a>.
--   
--   <pre>
--   &gt;&gt;&gt; toNonEmptyOf both1 ("hello", "world")
--   "hello" :| ["world"]
--   </pre>
--   
--   <pre>
--   <a>toNonEmptyOf</a> :: <a>Getter</a> s a      -&gt; s -&gt; NonEmpty a
--   <a>toNonEmptyOf</a> :: <a>Fold1</a> s a       -&gt; s -&gt; NonEmpty a
--   <a>toNonEmptyOf</a> :: <a>Lens'</a> s a       -&gt; s -&gt; NonEmpty a
--   <a>toNonEmptyOf</a> :: <a>Iso'</a> s a        -&gt; s -&gt; NonEmpty a
--   <a>toNonEmptyOf</a> :: <a>Traversal1'</a> s a -&gt; s -&gt; NonEmpty a
--   <a>toNonEmptyOf</a> :: <a>Prism'</a> s a      -&gt; s -&gt; NonEmpty a
--   </pre>
toNonEmptyOf :: () => Getting NonEmptyDList a s a -> s -> NonEmpty a

-- | Extract a list of the targets of a <a>Fold</a>. See also (<a>^..</a>).
--   
--   <pre>
--   <a>toList</a> ≡ <a>toListOf</a> <a>folded</a>
--   (<a>^..</a>) ≡ <a>flip</a> <a>toListOf</a>
--   </pre>
toListOf :: () => Getting Endo [a] s a -> s -> [a]

-- | Left-associative fold of the parts of a structure that are viewed
--   through a <a>Lens</a>, <a>Getter</a>, <a>Fold</a> or <a>Traversal</a>.
--   
--   <pre>
--   <a>foldl</a> ≡ <a>foldlOf</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>foldlOf</a> :: <a>Getter</a> s a     -&gt; (r -&gt; a -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>foldlOf</a> :: <a>Fold</a> s a       -&gt; (r -&gt; a -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>foldlOf</a> :: <a>Lens'</a> s a      -&gt; (r -&gt; a -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>foldlOf</a> :: <a>Iso'</a> s a       -&gt; (r -&gt; a -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>foldlOf</a> :: <a>Traversal'</a> s a -&gt; (r -&gt; a -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>foldlOf</a> :: <a>Prism'</a> s a     -&gt; (r -&gt; a -&gt; r) -&gt; r -&gt; s -&gt; r
--   </pre>
foldlOf :: () => Getting Dual Endo r s a -> r -> a -> r -> r -> s -> r

-- | Right-associative fold of parts of a structure that are viewed through
--   a <a>Lens</a>, <a>Getter</a>, <a>Fold</a> or <a>Traversal</a>.
--   
--   <pre>
--   <a>foldr</a> ≡ <a>foldrOf</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>foldrOf</a> :: <a>Getter</a> s a     -&gt; (a -&gt; r -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>foldrOf</a> :: <a>Fold</a> s a       -&gt; (a -&gt; r -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>foldrOf</a> :: <a>Lens'</a> s a      -&gt; (a -&gt; r -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>foldrOf</a> :: <a>Iso'</a> s a       -&gt; (a -&gt; r -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>foldrOf</a> :: <a>Traversal'</a> s a -&gt; (a -&gt; r -&gt; r) -&gt; r -&gt; s -&gt; r
--   <a>foldrOf</a> :: <a>Prism'</a> s a     -&gt; (a -&gt; r -&gt; r) -&gt; r -&gt; s -&gt; r
--   </pre>
--   
--   <pre>
--   <a>ifoldrOf</a> l ≡ <a>foldrOf</a> l <a>.</a> <a>Indexed</a>
--   </pre>
--   
--   <pre>
--   <a>foldrOf</a> :: <a>Getting</a> (<a>Endo</a> r) s a -&gt; (a -&gt; r -&gt; r) -&gt; r -&gt; s -&gt; r
--   </pre>
foldrOf :: () => Getting Endo r s a -> a -> r -> r -> r -> s -> r

-- | Combine the elements of a structure viewed through a <a>Lens</a>,
--   <a>Getter</a>, <a>Fold</a> or <a>Traversal</a> using a monoid.
--   
--   <pre>
--   &gt;&gt;&gt; foldOf (folded.folded) [[Sum 1,Sum 4],[Sum 8, Sum 8],[Sum 21]]
--   Sum {getSum = 42}
--   </pre>
--   
--   <pre>
--   <a>fold</a> = <a>foldOf</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>foldOf</a> ≡ <a>view</a>
--   </pre>
--   
--   <pre>
--   <a>foldOf</a> ::             <a>Getter</a> s m     -&gt; s -&gt; m
--   <a>foldOf</a> :: <a>Monoid</a> m =&gt; <a>Fold</a> s m       -&gt; s -&gt; m
--   <a>foldOf</a> ::             <a>Lens'</a> s m      -&gt; s -&gt; m
--   <a>foldOf</a> ::             <a>Iso'</a> s m       -&gt; s -&gt; m
--   <a>foldOf</a> :: <a>Monoid</a> m =&gt; <a>Traversal'</a> s m -&gt; s -&gt; m
--   <a>foldOf</a> :: <a>Monoid</a> m =&gt; <a>Prism'</a> s m     -&gt; s -&gt; m
--   </pre>
foldOf :: () => Getting a s a -> s -> a

-- | Map each part of a structure viewed through a <a>Lens</a>,
--   <a>Getter</a>, <a>Fold</a> or <a>Traversal</a> to a monoid and combine
--   the results.
--   
--   <pre>
--   &gt;&gt;&gt; foldMapOf (folded . both . _Just) Sum [(Just 21, Just 21)]
--   Sum {getSum = 42}
--   </pre>
--   
--   <pre>
--   <a>foldMap</a> = <a>foldMapOf</a> <a>folded</a>
--   </pre>
--   
--   <pre>
--   <a>foldMapOf</a> ≡ <a>views</a>
--   <a>ifoldMapOf</a> l = <a>foldMapOf</a> l <a>.</a> <a>Indexed</a>
--   </pre>
--   
--   <pre>
--   <a>foldMapOf</a> ::                <a>Getter</a> s a      -&gt; (a -&gt; r) -&gt; s -&gt; r
--   <a>foldMapOf</a> :: <a>Monoid</a> r    =&gt; <a>Fold</a> s a        -&gt; (a -&gt; r) -&gt; s -&gt; r
--   <a>foldMapOf</a> :: <a>Semigroup</a> r =&gt; <a>Fold1</a> s a       -&gt; (a -&gt; r) -&gt; s -&gt; r
--   <a>foldMapOf</a> ::                <a>Lens'</a> s a       -&gt; (a -&gt; r) -&gt; s -&gt; r
--   <a>foldMapOf</a> ::                <a>Iso'</a> s a        -&gt; (a -&gt; r) -&gt; s -&gt; r
--   <a>foldMapOf</a> :: <a>Monoid</a> r    =&gt; <a>Traversal'</a> s a  -&gt; (a -&gt; r) -&gt; s -&gt; r
--   <a>foldMapOf</a> :: <a>Semigroup</a> r =&gt; <a>Traversal1'</a> s a -&gt; (a -&gt; r) -&gt; s -&gt; r
--   <a>foldMapOf</a> :: <a>Monoid</a> r    =&gt; <a>Prism'</a> s a      -&gt; (a -&gt; r) -&gt; s -&gt; r
--   </pre>
--   
--   <pre>
--   <a>foldMapOf</a> :: <a>Getting</a> r s a -&gt; (a -&gt; r) -&gt; s -&gt; r
--   </pre>
foldMapOf :: () => Getting r s a -> a -> r -> s -> r

-- | A <a>Fold</a> over the individual <a>lines</a> of a <a>String</a>.
--   
--   <pre>
--   <a>lined</a> :: <a>Fold</a> <a>String</a> <a>String</a>
--   <a>lined</a> :: <a>Traversal'</a> <a>String</a> <a>String</a>
--   </pre>
--   
--   <pre>
--   <a>lined</a> :: <a>IndexedFold</a> <a>Int</a> <a>String</a> <a>String</a>
--   <a>lined</a> :: <a>IndexedTraversal'</a> <a>Int</a> <a>String</a> <a>String</a>
--   </pre>
--   
--   Note: This function type-checks as a <a>Traversal</a> but it doesn't
--   satisfy the laws. It's only valid to use it when you don't insert any
--   newline characters while traversing, and if your original
--   <a>String</a> contains only isolated newline characters.
lined :: Applicative f => IndexedLensLike' Int f String String

-- | A <a>Fold</a> over the individual <a>words</a> of a <a>String</a>.
--   
--   <pre>
--   <a>worded</a> :: <a>Fold</a> <a>String</a> <a>String</a>
--   <a>worded</a> :: <a>Traversal'</a> <a>String</a> <a>String</a>
--   </pre>
--   
--   <pre>
--   <a>worded</a> :: <a>IndexedFold</a> <a>Int</a> <a>String</a> <a>String</a>
--   <a>worded</a> :: <a>IndexedTraversal'</a> <a>Int</a> <a>String</a> <a>String</a>
--   </pre>
--   
--   Note: This function type-checks as a <a>Traversal</a> but it doesn't
--   satisfy the laws. It's only valid to use it when you don't insert any
--   whitespace characters while traversing, and if your original
--   <a>String</a> contains only isolated space characters (and no other
--   characters that count as space, such as non-breaking spaces).
worded :: Applicative f => IndexedLensLike' Int f String String

-- | Obtain a <a>Fold</a> by dropping elements from another <a>Fold</a>,
--   <a>Lens</a>, <a>Iso</a>, <a>Getter</a> or <a>Traversal</a> while a
--   predicate holds.
--   
--   <pre>
--   <a>dropWhile</a> p ≡ <a>toListOf</a> (<a>droppingWhile</a> p <a>folded</a>)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; toListOf (droppingWhile (&lt;=3) folded) [1..6]
--   [4,5,6]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; toListOf (droppingWhile (&lt;=3) folded) [1,6,1]
--   [6,1]
--   </pre>
--   
--   <pre>
--   <a>droppingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>Fold</a> s a                         -&gt; <a>Fold</a> s a
--   <a>droppingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>Getter</a> s a                       -&gt; <a>Fold</a> s a
--   <a>droppingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>Traversal'</a> s a                   -&gt; <a>Fold</a> s a                -- see notes
--   <a>droppingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>Lens'</a> s a                        -&gt; <a>Fold</a> s a                -- see notes
--   <a>droppingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>Prism'</a> s a                       -&gt; <a>Fold</a> s a                -- see notes
--   <a>droppingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>Iso'</a> s a                         -&gt; <a>Fold</a> s a                -- see notes
--   </pre>
--   
--   <pre>
--   <a>droppingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>IndexPreservingTraversal'</a> s a    -&gt; <a>IndexPreservingFold</a> s a -- see notes
--   <a>droppingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>IndexPreservingLens'</a> s a         -&gt; <a>IndexPreservingFold</a> s a -- see notes
--   <a>droppingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>IndexPreservingGetter</a> s a        -&gt; <a>IndexPreservingFold</a> s a
--   <a>droppingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>IndexPreservingFold</a> s a          -&gt; <a>IndexPreservingFold</a> s a
--   </pre>
--   
--   <pre>
--   <a>droppingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>IndexedTraversal'</a> i s a          -&gt; <a>IndexedFold</a> i s a       -- see notes
--   <a>droppingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>IndexedLens'</a> i s a               -&gt; <a>IndexedFold</a> i s a       -- see notes
--   <a>droppingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>IndexedGetter</a> i s a              -&gt; <a>IndexedFold</a> i s a
--   <a>droppingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>IndexedFold</a> i s a                -&gt; <a>IndexedFold</a> i s a
--   </pre>
--   
--   Note: Many uses of this combinator will yield something that meets the
--   types, but not the laws of a valid <a>Traversal</a> or
--   <a>IndexedTraversal</a>. The <a>Traversal</a> and
--   <a>IndexedTraversal</a> laws are only satisfied if the new values you
--   assign to the first target also does not pass the predicate! Otherwise
--   subsequent traversals will visit fewer elements and <a>Traversal</a>
--   fusion is not sound.
--   
--   So for any traversal <tt>t</tt> and predicate <tt>p</tt>,
--   <tt><a>droppingWhile</a> p t</tt> may not be lawful, but
--   <tt>(<a>dropping</a> 1 . <a>droppingWhile</a> p) t</tt> is. For
--   example:
--   
--   <pre>
--   &gt;&gt;&gt; let l  :: Traversal' [Int] Int; l  = droppingWhile (&lt;= 1) traverse
--   
--   &gt;&gt;&gt; let l' :: Traversal' [Int] Int; l' = dropping 1 l
--   </pre>
--   
--   <tt>l</tt> is not a lawful setter because <tt><a>over</a> l f .
--   <a>over</a> l g ≢ <a>over</a> l (f . g)</tt>:
--   
--   <pre>
--   &gt;&gt;&gt; [1,2,3] &amp; l .~ 0 &amp; l .~ 4
--   [1,0,0]
--   
--   &gt;&gt;&gt; [1,2,3] &amp; l .~ 4
--   [1,4,4]
--   </pre>
--   
--   <tt>l'</tt> on the other hand behaves lawfully:
--   
--   <pre>
--   &gt;&gt;&gt; [1,2,3] &amp; l' .~ 0 &amp; l' .~ 4
--   [1,2,4]
--   
--   &gt;&gt;&gt; [1,2,3] &amp; l' .~ 4
--   [1,2,4]
--   </pre>
droppingWhile :: (Conjoined p, Profunctor q, Applicative f) => a -> Bool -> Optical p q Compose State Bool f s t a a -> Optical p q f s t a a

-- | Obtain a <a>Fold</a> by taking elements from another <a>Fold</a>,
--   <a>Lens</a>, <a>Iso</a>, <a>Getter</a> or <a>Traversal</a> while a
--   predicate holds.
--   
--   <pre>
--   <a>takeWhile</a> p ≡ <a>toListOf</a> (<a>takingWhile</a> p <a>folded</a>)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; timingOut $ toListOf (takingWhile (&lt;=3) folded) [1..]
--   [1,2,3]
--   </pre>
--   
--   <pre>
--   <a>takingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>Fold</a> s a                         -&gt; <a>Fold</a> s a
--   <a>takingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>Getter</a> s a                       -&gt; <a>Fold</a> s a
--   <a>takingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>Traversal'</a> s a                   -&gt; <a>Fold</a> s a -- * See note below
--   <a>takingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>Lens'</a> s a                        -&gt; <a>Fold</a> s a -- * See note below
--   <a>takingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>Prism'</a> s a                       -&gt; <a>Fold</a> s a -- * See note below
--   <a>takingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>Iso'</a> s a                         -&gt; <a>Fold</a> s a -- * See note below
--   <a>takingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>IndexedTraversal'</a> i s a          -&gt; <a>IndexedFold</a> i s a -- * See note below
--   <a>takingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>IndexedLens'</a> i s a               -&gt; <a>IndexedFold</a> i s a -- * See note below
--   <a>takingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>IndexedFold</a> i s a                -&gt; <a>IndexedFold</a> i s a
--   <a>takingWhile</a> :: (a -&gt; <a>Bool</a>) -&gt; <a>IndexedGetter</a> i s a              -&gt; <a>IndexedFold</a> i s a
--   </pre>
--   
--   <i>Note:</i> When applied to a <a>Traversal</a>, <a>takingWhile</a>
--   yields something that can be used as if it were a <a>Traversal</a>,
--   but which is not a <a>Traversal</a> per the laws, unless you are
--   careful to ensure that you do not invalidate the predicate when
--   writing back through it.
takingWhile :: (Conjoined p, Applicative f) => a -> Bool -> Over p TakingWhile p f a a s t a a -> Over p f s t a a

-- | Obtain an <a>Fold</a> that can be composed with to filter another
--   <a>Lens</a>, <a>Iso</a>, <a>Getter</a>, <a>Fold</a> (or
--   <a>Traversal</a>).
--   
--   Note: This is <i>not</i> a legal <a>Traversal</a>, unless you are very
--   careful not to invalidate the predicate on the target.
--   
--   Note: This is also <i>not</i> a legal <a>Prism</a>, unless you are
--   very careful not to inject a value that matches the predicate.
--   
--   As a counter example, consider that given <tt>evens = <a>filtered</a>
--   <a>even</a></tt> the second <a>Traversal</a> law is violated:
--   
--   <pre>
--   <a>over</a> evens <a>succ</a> <a>.</a> <a>over</a> evens <a>succ</a> <a>/=</a> <a>over</a> evens (<a>succ</a> <a>.</a> <a>succ</a>)
--   </pre>
--   
--   So, in order for this to qualify as a legal <a>Traversal</a> you can
--   only use it for actions that preserve the result of the predicate!
--   
--   <pre>
--   &gt;&gt;&gt; [1..10]^..folded.filtered even
--   [2,4,6,8,10]
--   </pre>
--   
--   This will preserve an index if it is present.
filtered :: (Choice p, Applicative f) => a -> Bool -> Optic' p f a a

-- | <tt>x <a>^.</a> <a>iterated</a> f</tt> returns an infinite
--   <a>Fold1</a> of repeated applications of <tt>f</tt> to <tt>x</tt>.
--   
--   <pre>
--   <a>toListOf</a> (<a>iterated</a> f) a ≡ <a>iterate</a> f a
--   </pre>
--   
--   <pre>
--   <a>iterated</a> :: (a -&gt; a) -&gt; <a>Fold1</a> a a
--   </pre>
iterated :: Apply f => a -> a -> LensLike' f a a

-- | Build a <a>Fold</a> that unfolds its values from a seed.
--   
--   <pre>
--   <a>unfoldr</a> ≡ <a>toListOf</a> <a>.</a> <a>unfolded</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 10^..unfolded (\b -&gt; if b == 0 then Nothing else Just (b, b-1))
--   [10,9,8,7,6,5,4,3,2,1]
--   </pre>
unfolded :: () => b -> Maybe (a, b) -> Fold b a

-- | Transform a non-empty <a>Fold</a> into a <a>Fold1</a> that loops over
--   its elements over and over.
--   
--   <pre>
--   &gt;&gt;&gt; timingOut $ [1,2,3]^..taking 7 (cycled traverse)
--   [1,2,3,1,2,3,1]
--   </pre>
--   
--   <pre>
--   <a>cycled</a> :: <a>Fold1</a> s a -&gt; <a>Fold1</a> s a
--   </pre>
cycled :: Apply f => LensLike f s t a b -> LensLike f s t a b

-- | A <a>Fold</a> that replicates its input <tt>n</tt> times.
--   
--   <pre>
--   <a>replicate</a> n ≡ <a>toListOf</a> (<a>replicated</a> n)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 5^..replicated 20
--   [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5]
--   </pre>
replicated :: () => Int -> Fold a a

-- | Form a <a>Fold1</a> by repeating the input forever.
--   
--   <pre>
--   <a>repeat</a> ≡ <a>toListOf</a> <a>repeated</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; timingOut $ 5^..taking 20 repeated
--   [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5]
--   </pre>
--   
--   <pre>
--   <a>repeated</a> :: <a>Fold1</a> a a
--   </pre>
repeated :: Apply f => LensLike' f a a

-- | Obtain a <a>Fold</a> from any <a>Foldable</a> indexed by ordinal
--   position.
folded64 :: Foldable f => IndexedFold Int64 f a a

-- | Obtain a <a>Fold</a> from any <a>Foldable</a> indexed by ordinal
--   position.
--   
--   <pre>
--   &gt;&gt;&gt; Just 3^..folded
--   [3]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Nothing^..folded
--   []
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [(1,2),(3,4)]^..folded.both
--   [1,2,3,4]
--   </pre>
folded :: Foldable f => IndexedFold Int f a a

-- | Obtain <tt>FoldWithIndex</tt> by lifting <a>ifoldr</a> like function.
ifoldring :: (Indexable i p, Contravariant f, Applicative f) => i -> a -> f a -> f a -> f a -> s -> f a -> Over p f s t a b

-- | Obtain a <a>Fold</a> by lifting <a>foldr</a> like function.
--   
--   <pre>
--   &gt;&gt;&gt; [1,2,3,4]^..foldring foldr
--   [1,2,3,4]
--   </pre>
foldring :: (Contravariant f, Applicative f) => a -> f a -> f a -> f a -> s -> f a -> LensLike f s t a b
ifolding :: (Foldable f, Indexable i p, Contravariant g, Applicative g) => s -> f (i, a) -> Over p g s t a b

-- | Obtain a <a>Fold</a> by lifting an operation that returns a
--   <a>Foldable</a> result.
--   
--   This can be useful to lift operations from <tt>Data.List</tt> and
--   elsewhere into a <a>Fold</a>.
--   
--   <pre>
--   &gt;&gt;&gt; [1,2,3,4]^..folding tail
--   [2,3,4]
--   </pre>
folding :: Foldable f => s -> f a -> Fold s a

-- | This is an improper prism for text formatting based on <a>Read</a> and
--   <a>Show</a>.
--   
--   This <a>Prism</a> is "improper" in the sense that it normalizes the
--   text formatting, but round tripping is idempotent given sane
--   'Read'/'Show' instances.
--   
--   <pre>
--   &gt;&gt;&gt; _Show # 2
--   "2"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; "EQ" ^? _Show :: Maybe Ordering
--   Just EQ
--   </pre>
--   
--   <pre>
--   <a>_Show</a> ≡ <a>prism'</a> <a>show</a> <tt>readMaybe</tt>
--   </pre>
_Show :: (Read a, Show a) => Prism' String a

-- | This <a>Prism</a> compares for approximate equality with a given value
--   and a predicate for testing, an example where the value is the empty
--   list and the predicate checks that a list is empty (same as
--   <a>_Empty</a> with the <a>AsEmpty</a> list instance):
--   
--   <pre>
--   &gt;&gt;&gt; nearly [] null # ()
--   []
--   
--   &gt;&gt;&gt; [1,2,3,4] ^? nearly [] null
--   Nothing
--   </pre>
--   
--   <pre>
--   <a>nearly</a> [] <a>null</a> :: <a>Prism'</a> [a] ()
--   </pre>
--   
--   To comply with the <a>Prism</a> laws the arguments you supply to
--   <tt>nearly a p</tt> are somewhat constrained.
--   
--   We assume <tt>p x</tt> holds iff <tt>x ≡ a</tt>. Under that assumption
--   then this is a valid <a>Prism</a>.
--   
--   This is useful when working with a type where you can test equality
--   for only a subset of its values, and the prism selects such a value.
nearly :: () => a -> a -> Bool -> Prism' a ()

-- | This <a>Prism</a> compares for exact equality with a given value.
--   
--   <pre>
--   &gt;&gt;&gt; only 4 # ()
--   4
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 5 ^? only 4
--   Nothing
--   </pre>
only :: Eq a => a -> Prism' a ()

-- | <a>Void</a> is a logically uninhabited data type.
--   
--   This is a <a>Prism</a> that will always fail to match.
_Void :: (Choice p, Applicative f) => p a f Void -> p s f s

-- | This <a>Prism</a> provides the <a>Traversal</a> of a <a>Nothing</a> in
--   a <a>Maybe</a>.
--   
--   <pre>
--   &gt;&gt;&gt; Nothing ^? _Nothing
--   Just ()
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Just () ^? _Nothing
--   Nothing
--   </pre>
--   
--   But you can turn it around and use it to construct <a>Nothing</a> as
--   well:
--   
--   <pre>
--   &gt;&gt;&gt; _Nothing # ()
--   Nothing
--   </pre>
_Nothing :: (Choice p, Applicative f) => p () f () -> p Maybe a f Maybe a

-- | This <a>Prism</a> provides a <a>Traversal</a> for tweaking the target
--   of the value of <a>Just</a> in a <a>Maybe</a>.
--   
--   <pre>
--   &gt;&gt;&gt; over _Just (+1) (Just 2)
--   Just 3
--   </pre>
--   
--   Unlike <a>traverse</a> this is a <a>Prism</a>, and so you can use it
--   to inject as well:
--   
--   <pre>
--   &gt;&gt;&gt; _Just # 5
--   Just 5
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 5^.re _Just
--   Just 5
--   </pre>
--   
--   Interestingly,
--   
--   <pre>
--   m <tt>^?</tt> <a>_Just</a> ≡ m
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Just x ^? _Just
--   Just x
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Nothing ^? _Just
--   Nothing
--   </pre>
_Just :: (Choice p, Applicative f) => p a f b -> p Maybe a f Maybe b

-- | This <a>Prism</a> provides a <a>Traversal</a> for tweaking the
--   <a>Right</a> half of an <a>Either</a>:
--   
--   <pre>
--   &gt;&gt;&gt; over _Right (+1) (Left 2)
--   Left 2
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; over _Right (+1) (Right 2)
--   Right 3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Right "hello" ^._Right
--   "hello"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Left "hello" ^._Right :: [Double]
--   []
--   </pre>
--   
--   It also can be turned around to obtain the embedding into the
--   <a>Right</a> half of an <a>Either</a>:
--   
--   <pre>
--   &gt;&gt;&gt; _Right # 5
--   Right 5
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 5^.re _Right
--   Right 5
--   </pre>
_Right :: (Choice p, Applicative f) => p a f b -> p Either c a f Either c b

-- | This <a>Prism</a> provides a <a>Traversal</a> for tweaking the
--   <a>Left</a> half of an <a>Either</a>:
--   
--   <pre>
--   &gt;&gt;&gt; over _Left (+1) (Left 2)
--   Left 3
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; over _Left (+1) (Right 2)
--   Right 2
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Right 42 ^._Left :: String
--   ""
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Left "hello" ^._Left
--   "hello"
--   </pre>
--   
--   It also can be turned around to obtain the embedding into the
--   <a>Left</a> half of an <a>Either</a>:
--   
--   <pre>
--   &gt;&gt;&gt; _Left # 5
--   Left 5
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 5^.re _Left
--   Left 5
--   </pre>
_Left :: (Choice p, Applicative f) => p a f b -> p Either a c f Either b c

-- | Retrieve the value targeted by a <a>Prism</a> or return the original
--   value while allowing the type to change if it does not match.
--   
--   <pre>
--   &gt;&gt;&gt; matching _Just (Just 12)
--   Right 12
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; matching _Just (Nothing :: Maybe Int) :: Either (Maybe Bool) Int
--   Left Nothing
--   </pre>
matching :: () => APrism s t a b -> s -> Either t a

-- | <tt>lift</tt> a <a>Prism</a> through a <a>Traversable</a> functor,
--   giving a Prism that matches only if all the elements of the container
--   match the <a>Prism</a>.
--   
--   <pre>
--   &gt;&gt;&gt; [Left 1, Right "foo", Left 4, Right "woot"]^..below _Right
--   []
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [Right "hail hydra!", Right "foo", Right "blah", Right "woot"]^..below _Right
--   [["hail hydra!","foo","blah","woot"]]
--   </pre>
below :: Traversable f => APrism' s a -> Prism' f s f a

-- | Use a <a>Prism</a> to work over part of a structure.
aside :: () => APrism s t a b -> Prism (e, s) (e, t) (e, a) (e, b)

-- | Given a pair of prisms, project sums.
--   
--   Viewing a <a>Prism</a> as a co-<a>Lens</a>, this combinator can be
--   seen to be dual to <a>alongside</a>.
without :: () => APrism s t a b -> APrism u v c d -> Prism Either s u Either t v Either a c Either b d

-- | Use a <a>Prism</a> as a kind of first-class pattern.
--   
--   <pre>
--   <a>outside</a> :: <a>Prism</a> s t a b -&gt; <a>Lens</a> (t -&gt; r) (s -&gt; r) (b -&gt; r) (a -&gt; r)
--   </pre>
outside :: Representable p => APrism s t a b -> Lens p t r p s r p b r p a r

-- | This is usually used to build a <a>Prism'</a>, when you have to use an
--   operation like <a>cast</a> which already returns a <a>Maybe</a>.
prism' :: () => b -> s -> s -> Maybe a -> Prism s s a b

-- | Build a <a>Prism</a>.
--   
--   <tt><a>Either</a> t a</tt> is used instead of <tt><a>Maybe</a> a</tt>
--   to permit the types of <tt>s</tt> and <tt>t</tt> to differ.
prism :: () => b -> t -> s -> Either t a -> Prism s t a b

-- | Clone a <a>Prism</a> so that you can reuse the same monomorphically
--   typed <a>Prism</a> for different purposes.
--   
--   See <a>cloneLens</a> and <a>cloneTraversal</a> for examples of why you
--   might want to do this.
clonePrism :: () => APrism s t a b -> Prism s t a b

-- | Convert <a>APrism</a> to the pair of functions that characterize it.
withPrism :: () => APrism s t a b -> b -> t -> s -> Either t a -> r -> r

-- | If you see this in a signature for a function, the function is
--   expecting a <a>Prism</a>.
type APrism s t a b = Market a b a Identity b -> Market a b s Identity t

-- | <pre>
--   type APrism' = <a>Simple</a> <a>APrism</a>
--   </pre>
type APrism' s a = APrism s s a a

-- | This can be used to turn an <a>Iso</a> or <a>Prism</a> around and
--   <a>use</a> the current state through it the other way, applying a
--   function.
--   
--   <pre>
--   <a>reuses</a> ≡ <a>uses</a> <a>.</a> <a>re</a>
--   <a>reuses</a> (<a>unto</a> f) g ≡ <a>gets</a> (g <a>.</a> f)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; evalState (reuses _Left isLeft) (5 :: Int)
--   True
--   </pre>
--   
--   <pre>
--   <a>reuses</a> :: <a>MonadState</a> a m =&gt; <a>Prism'</a> s a -&gt; (s -&gt; r) -&gt; m r
--   <a>reuses</a> :: <a>MonadState</a> a m =&gt; <a>Iso'</a> s a   -&gt; (s -&gt; r) -&gt; m r
--   </pre>
reuses :: MonadState b m => AReview t b -> t -> r -> m r

-- | This can be used to turn an <a>Iso</a> or <a>Prism</a> around and
--   <a>use</a> a value (or the current environment) through it the other
--   way.
--   
--   <pre>
--   <a>reuse</a> ≡ <a>use</a> <a>.</a> <a>re</a>
--   <a>reuse</a> <a>.</a> <a>unto</a> ≡ <a>gets</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; evalState (reuse _Left) 5
--   Left 5
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; evalState (reuse (unto succ)) 5
--   6
--   </pre>
--   
--   <pre>
--   <a>reuse</a> :: <a>MonadState</a> a m =&gt; <a>Prism'</a> s a -&gt; m s
--   <a>reuse</a> :: <a>MonadState</a> a m =&gt; <a>Iso'</a> s a   -&gt; m s
--   </pre>
reuse :: MonadState b m => AReview t b -> m t

-- | This can be used to turn an <a>Iso</a> or <a>Prism</a> around and
--   <a>view</a> a value (or the current environment) through it the other
--   way, applying a function.
--   
--   <pre>
--   <a>reviews</a> ≡ <a>views</a> <a>.</a> <a>re</a>
--   <a>reviews</a> (<a>unto</a> f) g ≡ g <a>.</a> f
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; reviews _Left isRight "mustard"
--   False
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; reviews (unto succ) (*2) 3
--   8
--   </pre>
--   
--   Usually this function is used in the <tt>(-&gt;)</tt> <a>Monad</a>
--   with a <a>Prism</a> or <a>Iso</a>, in which case it may be useful to
--   think of it as having one of these more restricted type signatures:
--   
--   <pre>
--   <a>reviews</a> :: <a>Iso'</a> s a   -&gt; (s -&gt; r) -&gt; a -&gt; r
--   <a>reviews</a> :: <a>Prism'</a> s a -&gt; (s -&gt; r) -&gt; a -&gt; r
--   </pre>
--   
--   However, when working with a <a>Monad</a> transformer stack, it is
--   sometimes useful to be able to <a>review</a> the current environment,
--   in which case it may be beneficial to think of it as having one of
--   these slightly more liberal type signatures:
--   
--   <pre>
--   <a>reviews</a> :: <a>MonadReader</a> a m =&gt; <a>Iso'</a> s a   -&gt; (s -&gt; r) -&gt; m r
--   <a>reviews</a> :: <a>MonadReader</a> a m =&gt; <a>Prism'</a> s a -&gt; (s -&gt; r) -&gt; m r
--   </pre>
reviews :: MonadReader b m => AReview t b -> t -> r -> m r

-- | An infix alias for <a>review</a>.
--   
--   <pre>
--   <a>unto</a> f # x ≡ f x
--   l # x ≡ x <a>^.</a> <a>re</a> l
--   </pre>
--   
--   This is commonly used when using a <a>Prism</a> as a smart
--   constructor.
--   
--   <pre>
--   &gt;&gt;&gt; _Left # 4
--   Left 4
--   </pre>
--   
--   But it can be used for any <a>Prism</a>
--   
--   <pre>
--   &gt;&gt;&gt; base 16 # 123
--   "7b"
--   </pre>
--   
--   <pre>
--   (#) :: <a>Iso'</a>      s a -&gt; a -&gt; s
--   (#) :: <a>Prism'</a>    s a -&gt; a -&gt; s
--   (#) :: <a>Review</a>    s a -&gt; a -&gt; s
--   (#) :: <a>Equality'</a> s a -&gt; a -&gt; s
--   </pre>
(#) :: () => AReview t b -> b -> t
infixr 8 #

-- | This can be used to turn an <a>Iso</a> or <a>Prism</a> around and
--   <a>view</a> a value (or the current environment) through it the other
--   way.
--   
--   <pre>
--   <a>review</a> ≡ <a>view</a> <a>.</a> <a>re</a>
--   <a>review</a> . <a>unto</a> ≡ <a>id</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; review _Left "mustard"
--   Left "mustard"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; review (unto succ) 5
--   6
--   </pre>
--   
--   Usually <a>review</a> is used in the <tt>(-&gt;)</tt> <a>Monad</a>
--   with a <a>Prism</a> or <a>Iso</a>, in which case it may be useful to
--   think of it as having one of these more restricted type signatures:
--   
--   <pre>
--   <a>review</a> :: <a>Iso'</a> s a   -&gt; a -&gt; s
--   <a>review</a> :: <a>Prism'</a> s a -&gt; a -&gt; s
--   </pre>
--   
--   However, when working with a <a>Monad</a> transformer stack, it is
--   sometimes useful to be able to <a>review</a> the current environment,
--   in which case it may be beneficial to think of it as having one of
--   these slightly more liberal type signatures:
--   
--   <pre>
--   <a>review</a> :: <a>MonadReader</a> a m =&gt; <a>Iso'</a> s a   -&gt; m s
--   <a>review</a> :: <a>MonadReader</a> a m =&gt; <a>Prism'</a> s a -&gt; m s
--   </pre>
review :: MonadReader b m => AReview t b -> m t

-- | Turn a <a>Prism</a> or <a>Iso</a> around to build a <a>Getter</a>.
--   
--   If you have an <a>Iso</a>, <a>from</a> is a more powerful version of
--   this function that will return an <a>Iso</a> instead of a mere
--   <a>Getter</a>.
--   
--   <pre>
--   &gt;&gt;&gt; 5 ^.re _Left
--   Left 5
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 6 ^.re (_Left.unto succ)
--   Left 7
--   </pre>
--   
--   <pre>
--   <a>review</a>  ≡ <a>view</a>  <a>.</a> <a>re</a>
--   <a>reviews</a> ≡ <a>views</a> <a>.</a> <a>re</a>
--   <a>reuse</a>   ≡ <a>use</a>   <a>.</a> <a>re</a>
--   <a>reuses</a>  ≡ <a>uses</a>  <a>.</a> <a>re</a>
--   </pre>
--   
--   <pre>
--   <a>re</a> :: <a>Prism</a> s t a b -&gt; <a>Getter</a> b t
--   <a>re</a> :: <a>Iso</a> s t a b   -&gt; <a>Getter</a> b t
--   </pre>
re :: () => AReview t b -> Getter b t

-- | Turn a <a>Getter</a> around to get a <a>Review</a>
--   
--   <pre>
--   <a>un</a> = <a>unto</a> . <a>view</a>
--   <a>unto</a> = <a>un</a> . <a>to</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; un (to length) # [1,2,3]
--   3
--   </pre>
un :: (Profunctor p, Bifunctor p, Functor f) => Getting a s a -> Optic' p f a s

-- | An analogue of <a>to</a> for <a>review</a>.
--   
--   <pre>
--   <a>unto</a> :: (b -&gt; t) -&gt; <tt>Review'</tt> t b
--   </pre>
--   
--   <pre>
--   <a>unto</a> = <a>un</a> . <a>to</a>
--   </pre>
unto :: (Profunctor p, Bifunctor p, Functor f) => b -> t -> Optic p f s t a b

-- | Coerce a <a>Getter</a>-compatible <a>Optical</a> to an
--   <a>Optical'</a>. This is useful when using a <a>Traversal</a> that is
--   not simple as a <a>Getter</a> or a <a>Fold</a>.
--   
--   <pre>
--   <a>getting</a> :: <a>Traversal</a> s t a b          -&gt; <a>Fold</a> s a
--   <a>getting</a> :: <a>Lens</a> s t a b               -&gt; <a>Getter</a> s a
--   <a>getting</a> :: <a>IndexedTraversal</a> i s t a b -&gt; <a>IndexedFold</a> i s a
--   <a>getting</a> :: <a>IndexedLens</a> i s t a b      -&gt; <a>IndexedGetter</a> i s a
--   </pre>
getting :: (Profunctor p, Profunctor q, Functor f, Contravariant f) => Optical p q f s t a b -> Optical' p q f s a

-- | View the index and value of an <a>IndexedGetter</a> or
--   <a>IndexedLens</a>.
--   
--   This is the same operation as <a>iview</a> with the arguments flipped.
--   
--   The fixity and semantics are such that subsequent field accesses can
--   be performed with (<a>.</a>).
--   
--   <pre>
--   (<a>^@.</a>) :: s -&gt; <a>IndexedGetter</a> i s a -&gt; (i, a)
--   (<a>^@.</a>) :: s -&gt; <a>IndexedLens'</a> i s a  -&gt; (i, a)
--   </pre>
--   
--   The result probably doesn't have much meaning when applied to an
--   <a>IndexedFold</a>.
(^@.) :: () => s -> IndexedGetting i (i, a) s a -> (i, a)
infixl 8 ^@.

-- | Use a function of the index and value of an <a>IndexedGetter</a> into
--   the current state.
--   
--   When applied to an <a>IndexedFold</a> the result will be a monoidal
--   summary instead of a single answer.
iuses :: MonadState s m => IndexedGetting i r s a -> i -> a -> r -> m r

-- | Use the index and value of an <a>IndexedGetter</a> into the current
--   state as a pair.
--   
--   When applied to an <a>IndexedFold</a> the result will most likely be a
--   nonsensical monoidal summary of the indices tupled with a monoidal
--   summary of the values and probably not whatever it is you wanted.
iuse :: MonadState s m => IndexedGetting i (i, a) s a -> m (i, a)

-- | View a function of the index and value of an <a>IndexedGetter</a> into
--   the current environment.
--   
--   When applied to an <a>IndexedFold</a> the result will be a monoidal
--   summary instead of a single answer.
--   
--   <pre>
--   <a>iviews</a> ≡ <a>ifoldMapOf</a>
--   </pre>
iviews :: MonadReader s m => IndexedGetting i r s a -> i -> a -> r -> m r

-- | View the index and value of an <a>IndexedGetter</a> into the current
--   environment as a pair.
--   
--   When applied to an <a>IndexedFold</a> the result will most likely be a
--   nonsensical monoidal summary of the indices tupled with a monoidal
--   summary of the values and probably not whatever it is you wanted.
iview :: MonadReader s m => IndexedGetting i (i, a) s a -> m (i, a)

-- | This is a generalized form of <a>listen</a> that only extracts the
--   portion of the log that is focused on by a <a>Getter</a>. If given a
--   <a>Fold</a> or a <a>Traversal</a> then a monoidal summary of the parts
--   of the log that are visited will be returned.
--   
--   <pre>
--   <a>ilistenings</a> :: <a>MonadWriter</a> w m             =&gt; <a>IndexedGetter</a> w u     -&gt; (i -&gt; u -&gt; v) -&gt; m a -&gt; m (a, v)
--   <a>ilistenings</a> :: <a>MonadWriter</a> w m             =&gt; <a>IndexedLens'</a> w u      -&gt; (i -&gt; u -&gt; v) -&gt; m a -&gt; m (a, v)
--   <a>ilistenings</a> :: (<a>MonadWriter</a> w m, <a>Monoid</a> v) =&gt; <a>IndexedFold</a> w u       -&gt; (i -&gt; u -&gt; v) -&gt; m a -&gt; m (a, v)
--   <a>ilistenings</a> :: (<a>MonadWriter</a> w m, <a>Monoid</a> v) =&gt; <a>IndexedTraversal'</a> w u -&gt; (i -&gt; u -&gt; v) -&gt; m a -&gt; m (a, v)
--   </pre>
ilistenings :: MonadWriter w m => IndexedGetting i v w u -> i -> u -> v -> m a -> m (a, v)

-- | This is a generalized form of <a>listen</a> that only extracts the
--   portion of the log that is focused on by a <a>Getter</a>. If given a
--   <a>Fold</a> or a <a>Traversal</a> then a monoidal summary of the parts
--   of the log that are visited will be returned.
--   
--   <pre>
--   <a>listenings</a> :: <a>MonadWriter</a> w m             =&gt; <a>Getter</a> w u     -&gt; (u -&gt; v) -&gt; m a -&gt; m (a, v)
--   <a>listenings</a> :: <a>MonadWriter</a> w m             =&gt; <a>Lens'</a> w u      -&gt; (u -&gt; v) -&gt; m a -&gt; m (a, v)
--   <a>listenings</a> :: <a>MonadWriter</a> w m             =&gt; <a>Iso'</a> w u       -&gt; (u -&gt; v) -&gt; m a -&gt; m (a, v)
--   <a>listenings</a> :: (<a>MonadWriter</a> w m, <a>Monoid</a> v) =&gt; <a>Fold</a> w u       -&gt; (u -&gt; v) -&gt; m a -&gt; m (a, v)
--   <a>listenings</a> :: (<a>MonadWriter</a> w m, <a>Monoid</a> v) =&gt; <a>Traversal'</a> w u -&gt; (u -&gt; v) -&gt; m a -&gt; m (a, v)
--   <a>listenings</a> :: (<a>MonadWriter</a> w m, <a>Monoid</a> v) =&gt; <a>Prism'</a> w u     -&gt; (u -&gt; v) -&gt; m a -&gt; m (a, v)
--   </pre>
listenings :: MonadWriter w m => Getting v w u -> u -> v -> m a -> m (a, v)

-- | This is a generalized form of <a>listen</a> that only extracts the
--   portion of the log that is focused on by a <a>Getter</a>. If given a
--   <a>Fold</a> or a <a>Traversal</a> then a monoidal summary of the parts
--   of the log that are visited will be returned.
--   
--   <pre>
--   <a>ilistening</a> :: <a>MonadWriter</a> w m             =&gt; <a>IndexedGetter</a> i w u     -&gt; m a -&gt; m (a, (i, u))
--   <a>ilistening</a> :: <a>MonadWriter</a> w m             =&gt; <a>IndexedLens'</a> i w u      -&gt; m a -&gt; m (a, (i, u))
--   <a>ilistening</a> :: (<a>MonadWriter</a> w m, <a>Monoid</a> u) =&gt; <a>IndexedFold</a> i w u       -&gt; m a -&gt; m (a, (i, u))
--   <a>ilistening</a> :: (<a>MonadWriter</a> w m, <a>Monoid</a> u) =&gt; <a>IndexedTraversal'</a> i w u -&gt; m a -&gt; m (a, (i, u))
--   </pre>
ilistening :: MonadWriter w m => IndexedGetting i (i, u) w u -> m a -> m (a, (i, u))

-- | This is a generalized form of <a>listen</a> that only extracts the
--   portion of the log that is focused on by a <a>Getter</a>. If given a
--   <a>Fold</a> or a <a>Traversal</a> then a monoidal summary of the parts
--   of the log that are visited will be returned.
--   
--   <pre>
--   <a>listening</a> :: <a>MonadWriter</a> w m             =&gt; <a>Getter</a> w u     -&gt; m a -&gt; m (a, u)
--   <a>listening</a> :: <a>MonadWriter</a> w m             =&gt; <a>Lens'</a> w u      -&gt; m a -&gt; m (a, u)
--   <a>listening</a> :: <a>MonadWriter</a> w m             =&gt; <a>Iso'</a> w u       -&gt; m a -&gt; m (a, u)
--   <a>listening</a> :: (<a>MonadWriter</a> w m, <a>Monoid</a> u) =&gt; <a>Fold</a> w u       -&gt; m a -&gt; m (a, u)
--   <a>listening</a> :: (<a>MonadWriter</a> w m, <a>Monoid</a> u) =&gt; <a>Traversal'</a> w u -&gt; m a -&gt; m (a, u)
--   <a>listening</a> :: (<a>MonadWriter</a> w m, <a>Monoid</a> u) =&gt; <a>Prism'</a> w u     -&gt; m a -&gt; m (a, u)
--   </pre>
listening :: MonadWriter w m => Getting u w u -> m a -> m (a, u)

-- | Use the target of a <a>Lens</a>, <a>Iso</a> or <a>Getter</a> in the
--   current state, or use a summary of a <a>Fold</a> or <a>Traversal</a>
--   that points to a monoidal value.
--   
--   <pre>
--   &gt;&gt;&gt; evalState (uses _1 length) ("hello","world")
--   5
--   </pre>
--   
--   <pre>
--   <a>uses</a> :: <a>MonadState</a> s m             =&gt; <a>Getter</a> s a     -&gt; (a -&gt; r) -&gt; m r
--   <a>uses</a> :: (<a>MonadState</a> s m, <a>Monoid</a> r) =&gt; <a>Fold</a> s a       -&gt; (a -&gt; r) -&gt; m r
--   <a>uses</a> :: <a>MonadState</a> s m             =&gt; <a>Lens'</a> s a      -&gt; (a -&gt; r) -&gt; m r
--   <a>uses</a> :: <a>MonadState</a> s m             =&gt; <a>Iso'</a> s a       -&gt; (a -&gt; r) -&gt; m r
--   <a>uses</a> :: (<a>MonadState</a> s m, <a>Monoid</a> r) =&gt; <a>Traversal'</a> s a -&gt; (a -&gt; r) -&gt; m r
--   </pre>
--   
--   <pre>
--   <a>uses</a> :: <a>MonadState</a> s m =&gt; <a>Getting</a> r s t a b -&gt; (a -&gt; r) -&gt; m r
--   </pre>
uses :: MonadState s m => LensLike' (Const r :: * -> *) s a -> a -> r -> m r

-- | Use the target of a <a>Lens</a>, <a>Iso</a>, or <a>Getter</a> in the
--   current state, or use a summary of a <a>Fold</a> or <a>Traversal</a>
--   that points to a monoidal value.
--   
--   <pre>
--   &gt;&gt;&gt; evalState (use _1) (a,b)
--   a
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; evalState (use _1) ("hello","world")
--   "hello"
--   </pre>
--   
--   <pre>
--   <a>use</a> :: <a>MonadState</a> s m             =&gt; <a>Getter</a> s a     -&gt; m a
--   <a>use</a> :: (<a>MonadState</a> s m, <a>Monoid</a> r) =&gt; <a>Fold</a> s r       -&gt; m r
--   <a>use</a> :: <a>MonadState</a> s m             =&gt; <a>Iso'</a> s a       -&gt; m a
--   <a>use</a> :: <a>MonadState</a> s m             =&gt; <a>Lens'</a> s a      -&gt; m a
--   <a>use</a> :: (<a>MonadState</a> s m, <a>Monoid</a> r) =&gt; <a>Traversal'</a> s r -&gt; m r
--   </pre>
use :: MonadState s m => Getting a s a -> m a

-- | View the value pointed to by a <a>Getter</a> or <a>Lens</a> or the
--   result of folding over all the results of a <a>Fold</a> or
--   <a>Traversal</a> that points at a monoidal values.
--   
--   This is the same operation as <a>view</a> with the arguments flipped.
--   
--   The fixity and semantics are such that subsequent field accesses can
--   be performed with (<a>.</a>).
--   
--   <pre>
--   &gt;&gt;&gt; (a,b)^._2
--   b
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; ("hello","world")^._2
--   "world"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; import Data.Complex
--   
--   &gt;&gt;&gt; ((0, 1 :+ 2), 3)^._1._2.to magnitude
--   2.23606797749979
--   </pre>
--   
--   <pre>
--   (<a>^.</a>) ::             s -&gt; <a>Getter</a> s a     -&gt; a
--   (<a>^.</a>) :: <a>Monoid</a> m =&gt; s -&gt; <a>Fold</a> s m       -&gt; m
--   (<a>^.</a>) ::             s -&gt; <a>Iso'</a> s a       -&gt; a
--   (<a>^.</a>) ::             s -&gt; <a>Lens'</a> s a      -&gt; a
--   (<a>^.</a>) :: <a>Monoid</a> m =&gt; s -&gt; <a>Traversal'</a> s m -&gt; m
--   </pre>
(^.) :: () => s -> Getting a s a -> a
infixl 8 ^.

-- | View a function of the value pointed to by a <a>Getter</a> or
--   <a>Lens</a> or the result of folding over the result of mapping the
--   targets of a <a>Fold</a> or <a>Traversal</a>.
--   
--   <pre>
--   <a>views</a> l f ≡ <a>view</a> (l <a>.</a> <a>to</a> f)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; views (to f) g a
--   g (f a)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; views _2 length (1,"hello")
--   5
--   </pre>
--   
--   As <a>views</a> is commonly used to access the target of a
--   <a>Getter</a> or obtain a monoidal summary of the targets of a
--   <a>Fold</a>, It may be useful to think of it as having one of these
--   more restricted signatures:
--   
--   <pre>
--   <a>views</a> ::             <a>Getter</a> s a     -&gt; (a -&gt; r) -&gt; s -&gt; r
--   <a>views</a> :: <a>Monoid</a> m =&gt; <a>Fold</a> s a       -&gt; (a -&gt; m) -&gt; s -&gt; m
--   <a>views</a> ::             <a>Iso'</a> s a       -&gt; (a -&gt; r) -&gt; s -&gt; r
--   <a>views</a> ::             <a>Lens'</a> s a      -&gt; (a -&gt; r) -&gt; s -&gt; r
--   <a>views</a> :: <a>Monoid</a> m =&gt; <a>Traversal'</a> s a -&gt; (a -&gt; m) -&gt; s -&gt; m
--   </pre>
--   
--   In a more general setting, such as when working with a <a>Monad</a>
--   transformer stack you can use:
--   
--   <pre>
--   <a>views</a> :: <a>MonadReader</a> s m             =&gt; <a>Getter</a> s a     -&gt; (a -&gt; r) -&gt; m r
--   <a>views</a> :: (<a>MonadReader</a> s m, <a>Monoid</a> r) =&gt; <a>Fold</a> s a       -&gt; (a -&gt; r) -&gt; m r
--   <a>views</a> :: <a>MonadReader</a> s m             =&gt; <a>Iso'</a> s a       -&gt; (a -&gt; r) -&gt; m r
--   <a>views</a> :: <a>MonadReader</a> s m             =&gt; <a>Lens'</a> s a      -&gt; (a -&gt; r) -&gt; m r
--   <a>views</a> :: (<a>MonadReader</a> s m, <a>Monoid</a> r) =&gt; <a>Traversal'</a> s a -&gt; (a -&gt; r) -&gt; m r
--   </pre>
--   
--   <pre>
--   <a>views</a> :: <a>MonadReader</a> s m =&gt; <a>Getting</a> r s a -&gt; (a -&gt; r) -&gt; m r
--   </pre>
views :: MonadReader s m => LensLike' (Const r :: * -> *) s a -> a -> r -> m r

-- | View the value pointed to by a <a>Getter</a>, <a>Iso</a> or
--   <a>Lens</a> or the result of folding over all the results of a
--   <a>Fold</a> or <a>Traversal</a> that points at a monoidal value.
--   
--   <pre>
--   <a>view</a> <a>.</a> <a>to</a> ≡ <a>id</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; view (to f) a
--   f a
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; view _2 (1,"hello")
--   "hello"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; view (to succ) 5
--   6
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; view (_2._1) ("hello",("world","!!!"))
--   "world"
--   </pre>
--   
--   As <a>view</a> is commonly used to access the target of a
--   <a>Getter</a> or obtain a monoidal summary of the targets of a
--   <a>Fold</a>, It may be useful to think of it as having one of these
--   more restricted signatures:
--   
--   <pre>
--   <a>view</a> ::             <a>Getter</a> s a     -&gt; s -&gt; a
--   <a>view</a> :: <a>Monoid</a> m =&gt; <a>Fold</a> s m       -&gt; s -&gt; m
--   <a>view</a> ::             <a>Iso'</a> s a       -&gt; s -&gt; a
--   <a>view</a> ::             <a>Lens'</a> s a      -&gt; s -&gt; a
--   <a>view</a> :: <a>Monoid</a> m =&gt; <a>Traversal'</a> s m -&gt; s -&gt; m
--   </pre>
--   
--   In a more general setting, such as when working with a <a>Monad</a>
--   transformer stack you can use:
--   
--   <pre>
--   <a>view</a> :: <a>MonadReader</a> s m             =&gt; <a>Getter</a> s a     -&gt; m a
--   <a>view</a> :: (<a>MonadReader</a> s m, <a>Monoid</a> a) =&gt; <a>Fold</a> s a       -&gt; m a
--   <a>view</a> :: <a>MonadReader</a> s m             =&gt; <a>Iso'</a> s a       -&gt; m a
--   <a>view</a> :: <a>MonadReader</a> s m             =&gt; <a>Lens'</a> s a      -&gt; m a
--   <a>view</a> :: (<a>MonadReader</a> s m, <a>Monoid</a> a) =&gt; <a>Traversal'</a> s a -&gt; m a
--   </pre>
view :: MonadReader s m => Getting a s a -> m a

-- | <pre>
--   <a>ilike</a> :: i -&gt; a -&gt; <a>IndexedGetter</a> i s a
--   </pre>
ilike :: (Indexable i p, Contravariant f, Functor f) => i -> a -> Over' p f s a

-- | Build an constant-valued (index-preserving) <a>Getter</a> from an
--   arbitrary Haskell value.
--   
--   <pre>
--   <a>like</a> a <a>.</a> <a>like</a> b ≡ <a>like</a> b
--   a <a>^.</a> <a>like</a> b ≡ b
--   a <a>^.</a> <a>like</a> b ≡ a <a>^.</a> <a>to</a> (<a>const</a> b)
--   </pre>
--   
--   This can be useful as a second case <tt>failing</tt> a <a>Fold</a>
--   e.g. <tt>foo <tt>failing</tt> <a>like</a> 0</tt>
--   
--   <pre>
--   <a>like</a> :: a -&gt; <a>IndexPreservingGetter</a> s a
--   </pre>
like :: (Profunctor p, Contravariant f, Functor f) => a -> Optic' p f s a

-- | <pre>
--   <a>ito</a> :: (s -&gt; (i, a)) -&gt; <a>IndexedGetter</a> i s a
--   </pre>
ito :: (Indexable i p, Contravariant f) => s -> (i, a) -> Over' p f s a

-- | Build an (index-preserving) <a>Getter</a> from an arbitrary Haskell
--   function.
--   
--   <pre>
--   <a>to</a> f <a>.</a> <a>to</a> g ≡ <a>to</a> (g <a>.</a> f)
--   </pre>
--   
--   <pre>
--   a <a>^.</a> <a>to</a> f ≡ f a
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; a ^.to f
--   f a
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; ("hello","world")^.to snd
--   "world"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; 5^.to succ
--   6
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (0, -5)^._2.to abs
--   5
--   </pre>
--   
--   <pre>
--   <a>to</a> :: (s -&gt; a) -&gt; <a>IndexPreservingGetter</a> s a
--   </pre>
to :: (Profunctor p, Contravariant f) => s -> a -> Optic' p f s a

-- | When you see this in a type signature it indicates that you can pass
--   the function a <a>Lens</a>, <a>Getter</a>, <a>Traversal</a>,
--   <a>Fold</a>, <a>Prism</a>, <a>Iso</a>, or one of the indexed variants,
--   and it will just "do the right thing".
--   
--   Most <a>Getter</a> combinators are able to be used with both a
--   <a>Getter</a> or a <a>Fold</a> in limited situations, to do so, they
--   need to be monomorphic in what we are going to extract with
--   <a>Const</a>. To be compatible with <a>Lens</a>, <a>Traversal</a> and
--   <a>Iso</a> we also restricted choices of the irrelevant <tt>t</tt> and
--   <tt>b</tt> parameters.
--   
--   If a function accepts a <tt><a>Getting</a> r s a</tt>, then when
--   <tt>r</tt> is a <a>Monoid</a>, then you can pass a <a>Fold</a> (or
--   <a>Traversal</a>), otherwise you can only pass this a <a>Getter</a> or
--   <a>Lens</a>.
type Getting r s a = a -> Const r a -> s -> Const r s

-- | Used to consume an <a>IndexedFold</a>.
type IndexedGetting i m s a = Indexed i a Const m a -> s -> Const m s

-- | This is a convenient alias used when consuming (indexed) getters and
--   (indexed) folds in a highly general fashion.
type Accessing (p :: * -> * -> *) m s a = p a Const m a -> s -> Const m s

-- | Strict version of <a>_19</a>
_19' :: Field19 s t a b => Lens s t a b

-- | Strict version of <a>_18</a>
_18' :: Field18 s t a b => Lens s t a b

-- | Strict version of <a>_17</a>
_17' :: Field17 s t a b => Lens s t a b

-- | Strict version of <a>_16</a>
_16' :: Field16 s t a b => Lens s t a b

-- | Strict version of <a>_15</a>
_15' :: Field15 s t a b => Lens s t a b

-- | Strict version of <a>_14</a>
_14' :: Field14 s t a b => Lens s t a b

-- | Strict version of <a>_13</a>
_13' :: Field13 s t a b => Lens s t a b

-- | Strict version of <a>_12</a>
_12' :: Field12 s t a b => Lens s t a b

-- | Strict version of <a>_11</a>
_11' :: Field11 s t a b => Lens s t a b

-- | Strict version of <a>_10</a>
_10' :: Field10 s t a b => Lens s t a b

-- | Strict version of <a>_9</a>
_9' :: Field9 s t a b => Lens s t a b

-- | Strict version of <a>_8</a>
_8' :: Field8 s t a b => Lens s t a b

-- | Strict version of <a>_7</a>
_7' :: Field7 s t a b => Lens s t a b

-- | Strict version of <a>_6</a>
_6' :: Field6 s t a b => Lens s t a b

-- | Strict version of <a>_5</a>
_5' :: Field5 s t a b => Lens s t a b

-- | Strict version of <a>_4</a>
_4' :: Field4 s t a b => Lens s t a b

-- | Strict version of <a>_3</a>
_3' :: Field3 s t a b => Lens s t a b

-- | Strict version of <a>_2</a>
_2' :: Field2 s t a b => Lens s t a b

-- | Strict version of <a>_1</a>
_1' :: Field1 s t a b => Lens s t a b

-- | Provides access to 1st field of a tuple.
class Field1 s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | Access the 1st field of a tuple (and possibly change its type).
--   
--   <pre>
--   &gt;&gt;&gt; (1,2)^._1
--   1
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; _1 .~ "hello" $ (1,2)
--   ("hello",2)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (1,2) &amp; _1 .~ "hello"
--   ("hello",2)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; _1 putStrLn ("hello","world")
--   hello
--   ((),"world")
--   </pre>
--   
--   This can also be used on larger tuples as well:
--   
--   <pre>
--   &gt;&gt;&gt; (1,2,3,4,5) &amp; _1 +~ 41
--   (42,2,3,4,5)
--   </pre>
--   
--   <pre>
--   <a>_1</a> :: <a>Lens</a> (a,b) (a',b) a a'
--   <a>_1</a> :: <a>Lens</a> (a,b,c) (a',b,c) a a'
--   <a>_1</a> :: <a>Lens</a> (a,b,c,d) (a',b,c,d) a a'
--   ...
--   <a>_1</a> :: <a>Lens</a> (a,b,c,d,e,f,g,h,i) (a',b,c,d,e,f,g,h,i) a a'
--   </pre>
_1 :: Field1 s t a b => Lens s t a b

-- | Provides access to the 2nd field of a tuple.
class Field2 s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | Access the 2nd field of a tuple.
--   
--   <pre>
--   &gt;&gt;&gt; _2 .~ "hello" $ (1,(),3,4)
--   (1,"hello",3,4)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (1,2,3,4) &amp; _2 *~ 3
--   (1,6,3,4)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; _2 print (1,2)
--   2
--   (1,())
--   </pre>
--   
--   <pre>
--   <a>anyOf</a> <a>_2</a> :: (s -&gt; <a>Bool</a>) -&gt; (a, s) -&gt; <a>Bool</a>
--   <a>traverse</a> <a>.</a> <a>_2</a> :: (<a>Applicative</a> f, <a>Traversable</a> t) =&gt; (a -&gt; f b) -&gt; t (s, a) -&gt; f (t (s, b))
--   <a>foldMapOf</a> (<a>traverse</a> <a>.</a> <a>_2</a>) :: (<a>Traversable</a> t, <a>Monoid</a> m) =&gt; (s -&gt; m) -&gt; t (b, s) -&gt; m
--   </pre>
_2 :: Field2 s t a b => Lens s t a b

-- | Provides access to the 3rd field of a tuple.
class Field3 s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | Access the 3rd field of a tuple.
_3 :: Field3 s t a b => Lens s t a b

-- | Provide access to the 4th field of a tuple.
class Field4 s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | Access the 4th field of a tuple.
_4 :: Field4 s t a b => Lens s t a b

-- | Provides access to the 5th field of a tuple.
class Field5 s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | Access the 5th field of a tuple.
_5 :: Field5 s t a b => Lens s t a b

-- | Provides access to the 6th element of a tuple.
class Field6 s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | Access the 6th field of a tuple.
_6 :: Field6 s t a b => Lens s t a b

-- | Provide access to the 7th field of a tuple.
class Field7 s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | Access the 7th field of a tuple.
_7 :: Field7 s t a b => Lens s t a b

-- | Provide access to the 8th field of a tuple.
class Field8 s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | Access the 8th field of a tuple.
_8 :: Field8 s t a b => Lens s t a b

-- | Provides access to the 9th field of a tuple.
class Field9 s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | Access the 9th field of a tuple.
_9 :: Field9 s t a b => Lens s t a b

-- | Provides access to the 10th field of a tuple.
class Field10 s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | Access the 10th field of a tuple.
_10 :: Field10 s t a b => Lens s t a b

-- | Provides access to the 11th field of a tuple.
class Field11 s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | Access the 11th field of a tuple.
_11 :: Field11 s t a b => Lens s t a b

-- | Provides access to the 12th field of a tuple.
class Field12 s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | Access the 12th field of a tuple.
_12 :: Field12 s t a b => Lens s t a b

-- | Provides access to the 13th field of a tuple.
class Field13 s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | Access the 13th field of a tuple.
_13 :: Field13 s t a b => Lens s t a b

-- | Provides access to the 14th field of a tuple.
class Field14 s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | Access the 14th field of a tuple.
_14 :: Field14 s t a b => Lens s t a b

-- | Provides access to the 15th field of a tuple.
class Field15 s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | Access the 15th field of a tuple.
_15 :: Field15 s t a b => Lens s t a b

-- | Provides access to the 16th field of a tuple.
class Field16 s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | Access the 16th field of a tuple.
_16 :: Field16 s t a b => Lens s t a b

-- | Provides access to the 17th field of a tuple.
class Field17 s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | Access the 17th field of a tuple.
_17 :: Field17 s t a b => Lens s t a b

-- | Provides access to the 18th field of a tuple.
class Field18 s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | Access the 18th field of a tuple.
_18 :: Field18 s t a b => Lens s t a b

-- | Provides access to the 19th field of a tuple.
class Field19 s t a b | s -> a, t -> b, s b -> t, t a -> s

-- | Access the 19th field of a tuple.
_19 :: Field19 s t a b => Lens s t a b

-- | Fuse a composition of lenses using <a>Yoneda</a> to provide
--   <a>fmap</a> fusion.
--   
--   In general, given a pair of lenses <tt>foo</tt> and <tt>bar</tt>
--   
--   <pre>
--   fusing (foo.bar) = foo.bar
--   </pre>
--   
--   however, <tt>foo</tt> and <tt>bar</tt> are either going to <a>fmap</a>
--   internally or they are trivial.
--   
--   <a>fusing</a> exploits the <a>Yoneda</a> lemma to merge these separate
--   uses into a single <a>fmap</a>.
--   
--   This is particularly effective when the choice of functor <tt>f</tt>
--   is unknown at compile time or when the <a>Lens</a> <tt>foo.bar</tt> in
--   the above description is recursive or complex enough to prevent
--   inlining.
--   
--   <pre>
--   <a>fusing</a> :: <a>Lens</a> s t a b -&gt; <a>Lens</a> s t a b
--   </pre>
fusing :: Functor f => LensLike Yoneda f s t a b -> LensLike f s t a b

-- | We can always retrieve a <tt>()</tt> from any type.
--   
--   <pre>
--   &gt;&gt;&gt; "hello"^.united
--   ()
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; "hello" &amp; united .~ ()
--   "hello"
--   </pre>
united :: Functor f => () -> f () -> a -> f a

-- | There is a field for every type in the <a>Void</a>. Very zen.
--   
--   <pre>
--   &gt;&gt;&gt; [] &amp; mapped.devoid +~ 1
--   []
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Nothing &amp; mapped.devoid %~ abs
--   Nothing
--   </pre>
--   
--   <pre>
--   <a>devoid</a> :: <a>Lens'</a> <a>Void</a> a
--   </pre>
devoid :: () => Over p f Void Void a b

-- | A version of (<a>&lt;.=</a>) that works on <a>ALens</a>.
(<#=) :: MonadState s m => ALens s s a b -> b -> m b
infix 4 <#=

-- | A version of (<a>&lt;.~</a>) that works on <a>ALens</a>.
--   
--   <pre>
--   &gt;&gt;&gt; ("hello","there") &amp; _2 &lt;#~ "world"
--   ("world",("hello","world"))
--   </pre>
(<#~) :: () => ALens s t a b -> b -> s -> (b, t)
infixr 4 <#~

-- | A version of (<a>%%=</a>) that works on <a>ALens</a>.
(#%%=) :: MonadState s m => ALens s s a b -> a -> (r, b) -> m r
infix 4 #%%=

-- | A version of (<a>&lt;%=</a>) that works on <a>ALens</a>.
(<#%=) :: MonadState s m => ALens s s a b -> a -> b -> m b
infix 4 <#%=

-- | A version of (<a>&lt;%~</a>) that works on <a>ALens</a>.
--   
--   <pre>
--   &gt;&gt;&gt; ("hello","world") &amp; _2 &lt;#%~ length
--   (5,("hello",5))
--   </pre>
(<#%~) :: () => ALens s t a b -> a -> b -> s -> (b, t)
infixr 4 <#%~

-- | A version of (<a>%=</a>) that works on <a>ALens</a>.
(#%=) :: MonadState s m => ALens s s a b -> a -> b -> m ()
infix 4 #%=

-- | A version of (<a>.=</a>) that works on <a>ALens</a>.
(#=) :: MonadState s m => ALens s s a b -> b -> m ()
infix 4 #=

-- | A version of (<a>%%~</a>) that works on <a>ALens</a>.
--   
--   <pre>
--   &gt;&gt;&gt; ("hello","world") &amp; _2 #%%~ \x -&gt; (length x, x ++ "!")
--   (5,("hello","world!"))
--   </pre>
(#%%~) :: Functor f => ALens s t a b -> a -> f b -> s -> f t
infixr 4 #%%~

-- | A version of (<a>%~</a>) that works on <a>ALens</a>.
--   
--   <pre>
--   &gt;&gt;&gt; ("hello","world") &amp; _2 #%~ length
--   ("hello",5)
--   </pre>
(#%~) :: () => ALens s t a b -> a -> b -> s -> t
infixr 4 #%~

-- | A version of (<a>.~</a>) that works on <a>ALens</a>.
--   
--   <pre>
--   &gt;&gt;&gt; ("hello","there") &amp; _2 #~ "world"
--   ("hello","world")
--   </pre>
(#~) :: () => ALens s t a b -> b -> s -> t
infixr 4 #~

-- | A version of <a>set</a> that works on <a>ALens</a>.
--   
--   <pre>
--   &gt;&gt;&gt; storing _2 "world" ("hello","there")
--   ("hello","world")
--   </pre>
storing :: () => ALens s t a b -> b -> s -> t

-- | A version of (<a>^.</a>) that works on <a>ALens</a>.
--   
--   <pre>
--   &gt;&gt;&gt; ("hello","world")^#_2
--   "world"
--   </pre>
(^#) :: () => s -> ALens s t a b -> a
infixl 8 ^#

-- | Adjust the target of an <a>IndexedLens</a> returning the old value, or
--   adjust all of the targets of an <a>IndexedTraversal</a> within the
--   current state, and return a monoidal summary of the old values.
--   
--   <pre>
--   (<a>&lt;&lt;%@=</a>) :: <a>MonadState</a> s m                 =&gt; <a>IndexedLens</a> i s s a b      -&gt; (i -&gt; a -&gt; b) -&gt; m a
--   (<a>&lt;&lt;%@=</a>) :: (<a>MonadState</a> s m, <a>Monoid</a> b) =&gt; <a>IndexedTraversal</a> i s s a b -&gt; (i -&gt; a -&gt; b) -&gt; m a
--   </pre>
(<<%@=) :: MonadState s m => IndexedLensLike i (,) a s s a b -> i -> a -> b -> m a
infix 4 <<%@=

-- | Adjust the target of an <a>IndexedLens</a> returning the intermediate
--   result, or adjust all of the targets of an <a>IndexedTraversal</a>
--   within the current state, and return a monoidal summary of the
--   intermediate results.
--   
--   <pre>
--   (<a>&lt;%@=</a>) :: <a>MonadState</a> s m                 =&gt; <a>IndexedLens</a> i s s a b      -&gt; (i -&gt; a -&gt; b) -&gt; m b
--   (<a>&lt;%@=</a>) :: (<a>MonadState</a> s m, <a>Monoid</a> b) =&gt; <a>IndexedTraversal</a> i s s a b -&gt; (i -&gt; a -&gt; b) -&gt; m b
--   </pre>
(<%@=) :: MonadState s m => IndexedLensLike i (,) b s s a b -> i -> a -> b -> m b
infix 4 <%@=

-- | Adjust the target of an <a>IndexedLens</a> returning a supplementary
--   result, or adjust all of the targets of an <a>IndexedTraversal</a>
--   within the current state, and return a monoidal summary of the
--   supplementary results.
--   
--   <pre>
--   l <a>%%@=</a> f ≡ <a>state</a> (l <a>%%@~</a> f)
--   </pre>
--   
--   <pre>
--   (<a>%%@=</a>) :: <a>MonadState</a> s m                 =&gt; <a>IndexedLens</a> i s s a b      -&gt; (i -&gt; a -&gt; (r, b)) -&gt; s -&gt; m r
--   (<a>%%@=</a>) :: (<a>MonadState</a> s m, <a>Monoid</a> r) =&gt; <a>IndexedTraversal</a> i s s a b -&gt; (i -&gt; a -&gt; (r, b)) -&gt; s -&gt; m r
--   </pre>
(%%@=) :: MonadState s m => IndexedLensLike i (,) r s s a b -> i -> a -> (r, b) -> m r
infix 4 %%@=

-- | Adjust the target of an <a>IndexedLens</a> returning a supplementary
--   result, or adjust all of the targets of an <a>IndexedTraversal</a> and
--   return a monoidal summary of the supplementary results and the answer.
--   
--   <pre>
--   (<a>%%@~</a>) ≡ <a>withIndex</a>
--   </pre>
--   
--   <pre>
--   (<a>%%@~</a>) :: <a>Functor</a> f =&gt; <a>IndexedLens</a> i s t a b      -&gt; (i -&gt; a -&gt; f b) -&gt; s -&gt; f t
--   (<a>%%@~</a>) :: <a>Applicative</a> f =&gt; <a>IndexedTraversal</a> i s t a b -&gt; (i -&gt; a -&gt; f b) -&gt; s -&gt; f t
--   </pre>
--   
--   In particular, it is often useful to think of this function as having
--   one of these even more restricted type signatures:
--   
--   <pre>
--   (<a>%%@~</a>) ::             <a>IndexedLens</a> i s t a b      -&gt; (i -&gt; a -&gt; (r, b)) -&gt; s -&gt; (r, t)
--   (<a>%%@~</a>) :: <a>Monoid</a> r =&gt; <a>IndexedTraversal</a> i s t a b -&gt; (i -&gt; a -&gt; (r, b)) -&gt; s -&gt; (r, t)
--   </pre>
(%%@~) :: () => IndexedLensLike i f s t a b -> i -> a -> f b -> s -> f t
infixr 4 %%@~

-- | Adjust the target of an <a>IndexedLens</a> returning the old value, or
--   adjust all of the targets of an <a>IndexedTraversal</a> and return a
--   monoidal summary of the old values along with the answer.
--   
--   <pre>
--   (<a>&lt;&lt;%@~</a>) ::             <a>IndexedLens</a> i s t a b      -&gt; (i -&gt; a -&gt; b) -&gt; s -&gt; (a, t)
--   (<a>&lt;&lt;%@~</a>) :: <a>Monoid</a> a =&gt; <a>IndexedTraversal</a> i s t a b -&gt; (i -&gt; a -&gt; b) -&gt; s -&gt; (a, t)
--   </pre>
(<<%@~) :: () => Over Indexed i (,) a s t a b -> i -> a -> b -> s -> (a, t)
infixr 4 <<%@~

-- | Adjust the target of an <a>IndexedLens</a> returning the intermediate
--   result, or adjust all of the targets of an <a>IndexedTraversal</a> and
--   return a monoidal summary along with the answer.
--   
--   <pre>
--   l <a>&lt;%~</a> f ≡ l <a>&lt;%@~</a> <a>const</a> f
--   </pre>
--   
--   When you do not need access to the index then (<a>&lt;%~</a>) is more
--   liberal in what it can accept.
--   
--   If you do not need the intermediate result, you can use (<a>%@~</a>)
--   or even (<a>%~</a>).
--   
--   <pre>
--   (<a>&lt;%@~</a>) ::             <a>IndexedLens</a> i s t a b      -&gt; (i -&gt; a -&gt; b) -&gt; s -&gt; (b, t)
--   (<a>&lt;%@~</a>) :: <a>Monoid</a> b =&gt; <a>IndexedTraversal</a> i s t a b -&gt; (i -&gt; a -&gt; b) -&gt; s -&gt; (b, t)
--   </pre>
(<%@~) :: () => Over Indexed i (,) b s t a b -> i -> a -> b -> s -> (b, t)
infixr 4 <%@~

-- | <a>over</a> for Arrows.
--   
--   Unlike <a>over</a>, <a>overA</a> can't accept a simple <a>Setter</a>,
--   but requires a full lens, or close enough.
--   
--   <pre>
--   &gt;&gt;&gt; overA _1 ((+1) *** (+2)) ((1,2),6)
--   ((2,4),6)
--   </pre>
--   
--   <pre>
--   overA :: Arrow ar =&gt; Lens s t a b -&gt; ar a b -&gt; ar s t
--   </pre>
overA :: Arrow ar => LensLike Context a b s t a b -> ar a b -> ar s t

-- | <a>mappend</a> a monoidal value onto the end of the target of a
--   <a>Lens</a> into your <tt>Monad'</tt>s state and return the result.
--   
--   When you do not need the result of the operation, (<a>&lt;&gt;=</a>)
--   is more flexible.
(<<>=) :: (MonadState s m, Monoid r) => LensLike' (,) r s r -> r -> m r
infix 4 <<>=

-- | <a>mappend</a> a monoidal value onto the end of the target of a
--   <a>Lens</a> and return the result.
--   
--   When you do not need the result of the operation, (<a>&lt;&gt;~</a>)
--   is more flexible.
(<<>~) :: Monoid m => LensLike (,) m s t m m -> m -> s -> (m, t)
infixr 4 <<>~

-- | Run a monadic action, and set the target of <a>Lens</a> to its result.
--   
--   <pre>
--   (<a>&lt;&lt;~</a>) :: <a>MonadState</a> s m =&gt; <a>Iso</a> s s a b   -&gt; m b -&gt; m b
--   (<a>&lt;&lt;~</a>) :: <a>MonadState</a> s m =&gt; <a>Lens</a> s s a b  -&gt; m b -&gt; m b
--   </pre>
--   
--   NB: This is limited to taking an actual <a>Lens</a> than admitting a
--   <a>Traversal</a> because there are potential loss of state issues
--   otherwise.
(<<~) :: MonadState s m => ALens s s a b -> m b -> m b
infixr 2 <<~

-- | Modify the target of a <a>Lens</a> into your <tt>Monad'</tt>s state by
--   <a>mappend</a>ing a value and return the <i>old</i> value that was
--   replaced.
--   
--   When you do not need the result of the operation, (<a>&lt;&gt;=</a>)
--   is more flexible.
--   
--   <pre>
--   (<a>&lt;&lt;&lt;&gt;=</a>) :: (<a>MonadState</a> s m, <a>Monoid</a> r) =&gt; <a>Lens'</a> s r -&gt; r -&gt; m r
--   (<a>&lt;&lt;&lt;&gt;=</a>) :: (<a>MonadState</a> s m, <a>Monoid</a> r) =&gt; <a>Iso'</a> s r -&gt; r -&gt; m r
--   </pre>
(<<<>=) :: (MonadState s m, Monoid r) => LensLike' (,) r s r -> r -> m r
infix 4 <<<>=

-- | Modify the target of a <a>Lens</a> into your <tt>Monad'</tt>s state by
--   taking its logical <a>&amp;&amp;</a> with a value and return the
--   <i>old</i> value that was replaced.
--   
--   When you do not need the result of the operation, (<a>&amp;&amp;=</a>)
--   is more flexible.
--   
--   <pre>
--   (<a>&lt;&lt;&amp;&amp;=</a>) :: <a>MonadState</a> s m =&gt; <a>Lens'</a> s <a>Bool</a> -&gt; <a>Bool</a> -&gt; m <a>Bool</a>
--   (<a>&lt;&lt;&amp;&amp;=</a>) :: <a>MonadState</a> s m =&gt; <a>Iso'</a> s <a>Bool</a> -&gt; <a>Bool</a> -&gt; m <a>Bool</a>
--   </pre>
(<<&&=) :: MonadState s m => LensLike' (,) Bool s Bool -> Bool -> m Bool
infix 4 <<&&=

-- | Modify the target of a <a>Lens</a> into your <tt>Monad'</tt>s state by
--   taking its logical <a>||</a> with a value and return the <i>old</i>
--   value that was replaced.
--   
--   When you do not need the result of the operation, (<a>||=</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;&lt;||=</a>) :: <a>MonadState</a> s m =&gt; <a>Lens'</a> s <a>Bool</a> -&gt; <a>Bool</a> -&gt; m <a>Bool</a>
--   (<a>&lt;&lt;||=</a>) :: <a>MonadState</a> s m =&gt; <a>Iso'</a> s <a>Bool</a> -&gt; <a>Bool</a> -&gt; m <a>Bool</a>
--   </pre>
(<<||=) :: MonadState s m => LensLike' (,) Bool s Bool -> Bool -> m Bool
infix 4 <<||=

-- | Modify the target of a <a>Lens</a> into your <tt>Monad'</tt>s state by
--   raising it by an arbitrary power and return the <i>old</i> value that
--   was replaced.
--   
--   When you do not need the result of the operation, (<a>**=</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;&lt;**=</a>) :: (<a>MonadState</a> s m, <a>Floating</a> a) =&gt; <a>Lens'</a> s a -&gt; a -&gt; m a
--   (<a>&lt;&lt;**=</a>) :: (<a>MonadState</a> s m, <a>Floating</a> a) =&gt; <a>Iso'</a> s a -&gt; a -&gt; m a
--   </pre>
(<<**=) :: (MonadState s m, Floating a) => LensLike' (,) a s a -> a -> m a
infix 4 <<**=

-- | Modify the target of a <a>Lens</a> into your <tt>Monad'</tt>s state by
--   raising it by an integral power and return the <i>old</i> value that
--   was replaced.
--   
--   When you do not need the result of the operation, (<a>^^=</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;&lt;^^=</a>) :: (<a>MonadState</a> s m, <a>Fractional</a> a, <a>Integral</a> e) =&gt; <a>Lens'</a> s a -&gt; e -&gt; m a
--   (<a>&lt;&lt;^^=</a>) :: (<a>MonadState</a> s m, <a>Fractional</a> a, <a>Integral</a> e) =&gt; <a>Iso'</a> s a -&gt; e -&gt; m a
--   </pre>
(<<^^=) :: (MonadState s m, Fractional a, Integral e) => LensLike' (,) a s a -> e -> m a
infix 4 <<^^=

-- | Modify the target of a <a>Lens</a> into your <tt>Monad'</tt>s state by
--   raising it by a non-negative power and return the <i>old</i> value
--   that was replaced.
--   
--   When you do not need the result of the operation, (<a>^=</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;&lt;^=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a, <a>Integral</a> e) =&gt; <a>Lens'</a> s a -&gt; e -&gt; m a
--   (<a>&lt;&lt;^=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a, <a>Integral</a> e) =&gt; <a>Iso'</a> s a -&gt; a -&gt; m a
--   </pre>
(<<^=) :: (MonadState s m, Num a, Integral e) => LensLike' (,) a s a -> e -> m a
infix 4 <<^=

-- | Modify the target of a <a>Lens</a> into your <a>Monad</a>s state by
--   dividing by a value and return the <i>old</i> value that was replaced.
--   
--   When you do not need the result of the operation, (<a>//=</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;&lt;//=</a>) :: (<a>MonadState</a> s m, <a>Fractional</a> a) =&gt; <a>Lens'</a> s a -&gt; a -&gt; m a
--   (<a>&lt;&lt;//=</a>) :: (<a>MonadState</a> s m, <a>Fractional</a> a) =&gt; <a>Iso'</a> s a -&gt; a -&gt; m a
--   </pre>
(<<//=) :: (MonadState s m, Fractional a) => LensLike' (,) a s a -> a -> m a
infix 4 <<//=

-- | Modify the target of a <a>Lens</a> into your <tt>Monad'</tt>s state by
--   multipling a value and return the <i>old</i> value that was replaced.
--   
--   When you do not need the result of the operation, (<a>*=</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;&lt;*=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Lens'</a> s a -&gt; a -&gt; m a
--   (<a>&lt;&lt;*=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Iso'</a> s a -&gt; a -&gt; m a
--   </pre>
(<<*=) :: (MonadState s m, Num a) => LensLike' (,) a s a -> a -> m a
infix 4 <<*=

-- | Modify the target of a <a>Lens</a> into your <tt>Monad'</tt>s state by
--   subtracting a value and return the <i>old</i> value that was replaced.
--   
--   When you do not need the result of the operation, (<a>-=</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;&lt;-=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Lens'</a> s a -&gt; a -&gt; m a
--   (<a>&lt;&lt;-=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Iso'</a> s a -&gt; a -&gt; m a
--   </pre>
(<<-=) :: (MonadState s m, Num a) => LensLike' (,) a s a -> a -> m a
infix 4 <<-=

-- | Modify the target of a <a>Lens</a> into your <tt>Monad'</tt>s state by
--   adding a value and return the <i>old</i> value that was replaced.
--   
--   When you do not need the result of the operation, (<a>+=</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;&lt;+=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Lens'</a> s a -&gt; a -&gt; m a
--   (<a>&lt;&lt;+=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Iso'</a> s a -&gt; a -&gt; m a
--   </pre>
(<<+=) :: (MonadState s m, Num a) => LensLike' (,) a s a -> a -> m a
infix 4 <<+=

-- | Replace the target of a <a>Lens</a> into your <tt>Monad'</tt>s state
--   with <a>Just</a> a user supplied value and return the <i>old</i> value
--   that was replaced.
--   
--   When applied to a <a>Traversal</a>, this will return a monoidal
--   summary of all of the old values present.
--   
--   When you do not need the result of the operation, (<a>?=</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;&lt;?=</a>) :: <a>MonadState</a> s m             =&gt; <a>Lens</a> s t a (Maybe b)      -&gt; b -&gt; m a
--   (<a>&lt;&lt;?=</a>) :: <a>MonadState</a> s m             =&gt; <a>Iso</a> s t a (Maybe b)       -&gt; b -&gt; m a
--   (<a>&lt;&lt;?=</a>) :: (<a>MonadState</a> s m, <a>Monoid</a> a) =&gt; <a>Traversal</a> s t a (Maybe b) -&gt; b -&gt; m a
--   </pre>
(<<?=) :: MonadState s m => LensLike (,) a s s a Maybe b -> b -> m a
infix 4 <<?=

-- | Replace the target of a <a>Lens</a> into your <tt>Monad'</tt>s state
--   with a user supplied value and return the <i>old</i> value that was
--   replaced.
--   
--   When applied to a <a>Traversal</a>, this will return a monoidal
--   summary of all of the old values present.
--   
--   When you do not need the result of the operation, (<a>.=</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;&lt;.=</a>) :: <a>MonadState</a> s m             =&gt; <a>Lens'</a> s a      -&gt; a -&gt; m a
--   (<a>&lt;&lt;.=</a>) :: <a>MonadState</a> s m             =&gt; <a>Iso'</a> s a       -&gt; a -&gt; m a
--   (<a>&lt;&lt;.=</a>) :: (<a>MonadState</a> s m, <a>Monoid</a> a) =&gt; <a>Traversal'</a> s a -&gt; a -&gt; m a
--   </pre>
(<<.=) :: MonadState s m => LensLike (,) a s s a b -> b -> m a
infix 4 <<.=

-- | Modify the target of a <a>Lens</a> into your <tt>Monad'</tt>s state by
--   a user supplied function and return the <i>old</i> value that was
--   replaced.
--   
--   When applied to a <a>Traversal</a>, this will return a monoidal
--   summary of all of the old values present.
--   
--   When you do not need the result of the operation, (<a>%=</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;&lt;%=</a>) :: <a>MonadState</a> s m             =&gt; <a>Lens'</a> s a      -&gt; (a -&gt; a) -&gt; m a
--   (<a>&lt;&lt;%=</a>) :: <a>MonadState</a> s m             =&gt; <a>Iso'</a> s a       -&gt; (a -&gt; a) -&gt; m a
--   (<a>&lt;&lt;%=</a>) :: (<a>MonadState</a> s m, <a>Monoid</a> a) =&gt; <a>Traversal'</a> s a -&gt; (a -&gt; a) -&gt; m a
--   </pre>
--   
--   <pre>
--   (<a>&lt;&lt;%=</a>) :: <a>MonadState</a> s m =&gt; <a>LensLike</a> ((,)a) s s a b -&gt; (a -&gt; b) -&gt; m a
--   </pre>
(<<%=) :: (Strong p, MonadState s m) => Over p (,) a s s a b -> p a b -> m a
infix 4 <<%=

-- | Logically <a>&amp;&amp;</a> a Boolean valued <a>Lens</a> into your
--   <tt>Monad'</tt>s state and return the result.
--   
--   When you do not need the result of the operation, (<a>&amp;&amp;=</a>)
--   is more flexible.
--   
--   <pre>
--   (<a>&lt;&amp;&amp;=</a>) :: <a>MonadState</a> s m =&gt; <a>Lens'</a> s <a>Bool</a> -&gt; <a>Bool</a> -&gt; m <a>Bool</a>
--   (<a>&lt;&amp;&amp;=</a>) :: <a>MonadState</a> s m =&gt; <a>Iso'</a> s <a>Bool</a>  -&gt; <a>Bool</a> -&gt; m <a>Bool</a>
--   </pre>
(<&&=) :: MonadState s m => LensLike' (,) Bool s Bool -> Bool -> m Bool
infix 4 <&&=

-- | Logically <a>||</a> a Boolean valued <a>Lens</a> into your
--   <tt>Monad'</tt>s state and return the result.
--   
--   When you do not need the result of the operation, (<a>||=</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;||=</a>) :: <a>MonadState</a> s m =&gt; <a>Lens'</a> s <a>Bool</a> -&gt; <a>Bool</a> -&gt; m <a>Bool</a>
--   (<a>&lt;||=</a>) :: <a>MonadState</a> s m =&gt; <a>Iso'</a> s <a>Bool</a>  -&gt; <a>Bool</a> -&gt; m <a>Bool</a>
--   </pre>
(<||=) :: MonadState s m => LensLike' (,) Bool s Bool -> Bool -> m Bool
infix 4 <||=

-- | Raise the target of a floating-point valued <a>Lens</a> into your
--   <tt>Monad'</tt>s state to an arbitrary power and return the result.
--   
--   When you do not need the result of the operation, (<a>**=</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;**=</a>) :: (<a>MonadState</a> s m, <a>Floating</a> a) =&gt; <a>Lens'</a> s a -&gt; a -&gt; m a
--   (<a>&lt;**=</a>) :: (<a>MonadState</a> s m, <a>Floating</a> a) =&gt; <a>Iso'</a> s a -&gt; a -&gt; m a
--   </pre>
(<**=) :: (MonadState s m, Floating a) => LensLike' (,) a s a -> a -> m a
infix 4 <**=

-- | Raise the target of a fractionally valued <a>Lens</a> into your
--   <tt>Monad'</tt>s state to an <a>Integral</a> power and return the
--   result.
--   
--   When you do not need the result of the operation, (<a>^^=</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;^^=</a>) :: (<a>MonadState</a> s m, <a>Fractional</a> b, <a>Integral</a> e) =&gt; <a>Lens'</a> s a -&gt; e -&gt; m a
--   (<a>&lt;^^=</a>) :: (<a>MonadState</a> s m, <a>Fractional</a> b, <a>Integral</a> e) =&gt; <a>Iso'</a> s a  -&gt; e -&gt; m a
--   </pre>
(<^^=) :: (MonadState s m, Fractional a, Integral e) => LensLike' (,) a s a -> e -> m a
infix 4 <^^=

-- | Raise the target of a numerically valued <a>Lens</a> into your
--   <tt>Monad'</tt>s state to a non-negative <a>Integral</a> power and
--   return the result.
--   
--   When you do not need the result of the operation, (<a>^=</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;^=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a, <a>Integral</a> e) =&gt; <a>Lens'</a> s a -&gt; e -&gt; m a
--   (<a>&lt;^=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a, <a>Integral</a> e) =&gt; <a>Iso'</a> s a -&gt; e -&gt; m a
--   </pre>
(<^=) :: (MonadState s m, Num a, Integral e) => LensLike' (,) a s a -> e -> m a
infix 4 <^=

-- | Divide the target of a fractionally valued <a>Lens</a> into your
--   <tt>Monad'</tt>s state and return the result.
--   
--   When you do not need the result of the division, (<a>//=</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;//=</a>) :: (<a>MonadState</a> s m, <a>Fractional</a> a) =&gt; <a>Lens'</a> s a -&gt; a -&gt; m a
--   (<a>&lt;//=</a>) :: (<a>MonadState</a> s m, <a>Fractional</a> a) =&gt; <a>Iso'</a> s a -&gt; a -&gt; m a
--   </pre>
(<//=) :: (MonadState s m, Fractional a) => LensLike' (,) a s a -> a -> m a
infix 4 <//=

-- | Multiply the target of a numerically valued <a>Lens</a> into your
--   <tt>Monad'</tt>s state and return the result.
--   
--   When you do not need the result of the multiplication, (<a>*=</a>) is
--   more flexible.
--   
--   <pre>
--   (<a>&lt;*=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Lens'</a> s a -&gt; a -&gt; m a
--   (<a>&lt;*=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Iso'</a> s a -&gt; a -&gt; m a
--   </pre>
(<*=) :: (MonadState s m, Num a) => LensLike' (,) a s a -> a -> m a
infix 4 <*=

-- | Subtract from the target of a numerically valued <a>Lens</a> into your
--   <tt>Monad'</tt>s state and return the result.
--   
--   When you do not need the result of the subtraction, (<a>-=</a>) is
--   more flexible.
--   
--   <pre>
--   (<a>&lt;-=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Lens'</a> s a -&gt; a -&gt; m a
--   (<a>&lt;-=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Iso'</a> s a -&gt; a -&gt; m a
--   </pre>
(<-=) :: (MonadState s m, Num a) => LensLike' (,) a s a -> a -> m a
infix 4 <-=

-- | Add to the target of a numerically valued <a>Lens</a> into your
--   <tt>Monad'</tt>s state and return the result.
--   
--   When you do not need the result of the addition, (<a>+=</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;+=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Lens'</a> s a -&gt; a -&gt; m a
--   (<a>&lt;+=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Iso'</a> s a -&gt; a -&gt; m a
--   </pre>
(<+=) :: (MonadState s m, Num a) => LensLike' (,) a s a -> a -> m a
infix 4 <+=

-- | Modify the target of a <a>Lens</a> into your <tt>Monad'</tt>s state by
--   a user supplied function and return the result.
--   
--   When applied to a <a>Traversal</a>, it this will return a monoidal
--   summary of all of the intermediate results.
--   
--   When you do not need the result of the operation, (<a>%=</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;%=</a>) :: <a>MonadState</a> s m             =&gt; <a>Lens'</a> s a      -&gt; (a -&gt; a) -&gt; m a
--   (<a>&lt;%=</a>) :: <a>MonadState</a> s m             =&gt; <a>Iso'</a> s a       -&gt; (a -&gt; a) -&gt; m a
--   (<a>&lt;%=</a>) :: (<a>MonadState</a> s m, <a>Monoid</a> a) =&gt; <a>Traversal'</a> s a -&gt; (a -&gt; a) -&gt; m a
--   </pre>
(<%=) :: MonadState s m => LensLike (,) b s s a b -> a -> b -> m b
infix 4 <%=

-- | Modify the target of a monoidally valued <a>Lens</a> by
--   <a>mappend</a>ing a new value and return the old value.
--   
--   When you do not need the old value, (<a>&lt;&gt;~</a>) is more
--   flexible.
--   
--   <pre>
--   &gt;&gt;&gt; (Sum a,b) &amp; _1 &lt;&lt;&lt;&gt;~ Sum c
--   (Sum {getSum = a},(Sum {getSum = a + c},b))
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; _2 &lt;&lt;&lt;&gt;~ ", 007" $ ("James", "Bond")
--   ("Bond",("James","Bond, 007"))
--   </pre>
--   
--   <pre>
--   (<a>&lt;&lt;&lt;&gt;~</a>) :: <a>Monoid</a> r =&gt; <a>Lens'</a> s r -&gt; r -&gt; s -&gt; (r, s)
--   (<a>&lt;&lt;&lt;&gt;~</a>) :: <a>Monoid</a> r =&gt; <a>Iso'</a> s r -&gt; r -&gt; s -&gt; (r, s)
--   </pre>
(<<<>~) :: Monoid r => LensLike' (,) r s r -> r -> s -> (r, s)
infixr 4 <<<>~

-- | Logically <a>&amp;&amp;</a> the target of a <a>Bool</a>-valued
--   <a>Lens</a> and return the old value.
--   
--   When you do not need the old value, (<a>&amp;&amp;~</a>) is more
--   flexible.
--   
--   <pre>
--   &gt;&gt;&gt; (False,6) &amp; _1 &lt;&lt;&amp;&amp;~ True
--   (False,(False,6))
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; ("hello",True) &amp; _2 &lt;&lt;&amp;&amp;~ False
--   (True,("hello",False))
--   </pre>
--   
--   <pre>
--   (<a>&lt;&lt;&amp;&amp;~</a>) :: <a>Lens'</a> s Bool -&gt; Bool -&gt; s -&gt; (Bool, s)
--   (<a>&lt;&lt;&amp;&amp;~</a>) :: <a>Iso'</a> s Bool -&gt; Bool -&gt; s -&gt; (Bool, s)
--   </pre>
(<<&&~) :: () => LensLike' (,) Bool s Bool -> Bool -> s -> (Bool, s)
infixr 4 <<&&~

-- | Logically <a>||</a> the target of a <a>Bool</a>-valued <a>Lens</a> and
--   return the old value.
--   
--   When you do not need the old value, (<a>||~</a>) is more flexible.
--   
--   <pre>
--   &gt;&gt;&gt; (False,6) &amp; _1 &lt;&lt;||~ True
--   (False,(True,6))
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; ("hello",True) &amp; _2 &lt;&lt;||~ False
--   (True,("hello",True))
--   </pre>
--   
--   <pre>
--   (<a>&lt;&lt;||~</a>) :: <a>Lens'</a> s <a>Bool</a> -&gt; <a>Bool</a> -&gt; s -&gt; (<a>Bool</a>, s)
--   (<a>&lt;&lt;||~</a>) :: <a>Iso'</a> s <a>Bool</a> -&gt; <a>Bool</a> -&gt; s -&gt; (<a>Bool</a>, s)
--   </pre>
(<<||~) :: () => LensLike' (,) Bool s Bool -> Bool -> s -> (Bool, s)
infixr 4 <<||~

-- | Raise the target of a floating-point valued <a>Lens</a> to an
--   arbitrary power and return the old value.
--   
--   When you do not need the old value, (<a>**~</a>) is more flexible.
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; _1 &lt;&lt;**~ c
--   (a,(a**c,b))
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; _2 &lt;&lt;**~ c
--   (b,(a,b**c))
--   </pre>
--   
--   <pre>
--   (<a>&lt;&lt;**~</a>) :: <a>Floating</a> a =&gt; <a>Lens'</a> s a -&gt; a -&gt; s -&gt; (a, s)
--   (<a>&lt;&lt;**~</a>) :: <a>Floating</a> a =&gt; <a>Iso'</a> s a -&gt; a -&gt; s -&gt; (a, s)
--   </pre>
(<<**~) :: Floating a => LensLike' (,) a s a -> a -> s -> (a, s)
infixr 4 <<**~

-- | Raise the target of a fractionally valued <a>Lens</a> to an integral
--   power and return the old value.
--   
--   When you do not need the old value, (<a>^^~</a>) is more flexible.
--   
--   <pre>
--   (<a>&lt;&lt;^^~</a>) :: (<a>Fractional</a> a, <a>Integral</a> e) =&gt; <a>Lens'</a> s a -&gt; e -&gt; s -&gt; (a, s)
--   (<a>&lt;&lt;^^~</a>) :: (<a>Fractional</a> a, <a>Integral</a> e) =&gt; <a>Iso'</a> s a -&gt; e -&gt; S -&gt; (a, s)
--   </pre>
(<<^^~) :: (Fractional a, Integral e) => LensLike' (,) a s a -> e -> s -> (a, s)
infixr 4 <<^^~

-- | Raise the target of a numerically valued <a>Lens</a> to a non-negative
--   power and return the old value.
--   
--   When you do not need the old value, (<a>^~</a>) is more flexible.
--   
--   <pre>
--   (<a>&lt;&lt;^~</a>) :: (<a>Num</a> a, <a>Integral</a> e) =&gt; <a>Lens'</a> s a -&gt; e -&gt; s -&gt; (a, s)
--   (<a>&lt;&lt;^~</a>) :: (<a>Num</a> a, <a>Integral</a> e) =&gt; <a>Iso'</a> s a -&gt; e -&gt; s -&gt; (a, s)
--   </pre>
(<<^~) :: (Num a, Integral e) => LensLike' (,) a s a -> e -> s -> (a, s)
infixr 4 <<^~

-- | Divide the target of a numerically valued <a>Lens</a> and return the
--   old value.
--   
--   When you do not need the old value, (<a>//~</a>) is more flexible.
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; _1 &lt;&lt;//~ c
--   (a,(a / c,b))
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; ("Hawaii",10) &amp; _2 &lt;&lt;//~ 2
--   (10.0,("Hawaii",5.0))
--   </pre>
--   
--   <pre>
--   (<a>&lt;&lt;//~</a>) :: Fractional a =&gt; <a>Lens'</a> s a -&gt; a -&gt; s -&gt; (a, s)
--   (<a>&lt;&lt;//~</a>) :: Fractional a =&gt; <a>Iso'</a> s a -&gt; a -&gt; s -&gt; (a, s)
--   </pre>
(<<//~) :: Fractional a => LensLike' (,) a s a -> a -> s -> (a, s)
infixr 4 <<//~

-- | Multiply the target of a numerically valued <a>Lens</a> and return the
--   old value.
--   
--   When you do not need the old value, (<a>-~</a>) is more flexible.
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; _1 &lt;&lt;*~ c
--   (a,(a * c,b))
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; _2 &lt;&lt;*~ c
--   (b,(a,b * c))
--   </pre>
--   
--   <pre>
--   (<a>&lt;&lt;*~</a>) :: <a>Num</a> a =&gt; <a>Lens'</a> s a -&gt; a -&gt; s -&gt; (a, s)
--   (<a>&lt;&lt;*~</a>) :: <a>Num</a> a =&gt; <a>Iso'</a> s a -&gt; a -&gt; s -&gt; (a, s)
--   </pre>
(<<*~) :: Num a => LensLike' (,) a s a -> a -> s -> (a, s)
infixr 4 <<*~

-- | Decrement the target of a numerically valued <a>Lens</a> and return
--   the old value.
--   
--   When you do not need the old value, (<a>-~</a>) is more flexible.
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; _1 &lt;&lt;-~ c
--   (a,(a - c,b))
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; _2 &lt;&lt;-~ c
--   (b,(a,b - c))
--   </pre>
--   
--   <pre>
--   (<a>&lt;&lt;-~</a>) :: <a>Num</a> a =&gt; <a>Lens'</a> s a -&gt; a -&gt; s -&gt; (a, s)
--   (<a>&lt;&lt;-~</a>) :: <a>Num</a> a =&gt; <a>Iso'</a> s a -&gt; a -&gt; s -&gt; (a, s)
--   </pre>
(<<-~) :: Num a => LensLike' (,) a s a -> a -> s -> (a, s)
infixr 4 <<-~

-- | Increment the target of a numerically valued <a>Lens</a> and return
--   the old value.
--   
--   When you do not need the old value, (<a>+~</a>) is more flexible.
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; _1 &lt;&lt;+~ c
--   (a,(a + c,b))
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; _2 &lt;&lt;+~ c
--   (b,(a,b + c))
--   </pre>
--   
--   <pre>
--   (<a>&lt;&lt;+~</a>) :: <a>Num</a> a =&gt; <a>Lens'</a> s a -&gt; a -&gt; s -&gt; (a, s)
--   (<a>&lt;&lt;+~</a>) :: <a>Num</a> a =&gt; <a>Iso'</a> s a -&gt; a -&gt; s -&gt; (a, s)
--   </pre>
(<<+~) :: Num a => LensLike' (,) a s a -> a -> s -> (a, s)
infixr 4 <<+~

-- | Replace the target of a <a>Lens</a> with a <a>Just</a> value, but
--   return the old value.
--   
--   If you do not need the old value (<a>?~</a>) is more flexible.
--   
--   <pre>
--   &gt;&gt;&gt; import Data.Map as Map
--   
--   &gt;&gt;&gt; _2.at "hello" &lt;&lt;?~ "world" $ (42,Map.fromList [("goodnight","gracie")])
--   (Nothing,(42,fromList [("goodnight","gracie"),("hello","world")]))
--   </pre>
--   
--   <pre>
--   (<a>&lt;&lt;?~</a>) :: <a>Iso</a> s t a (<a>Maybe</a> b)       -&gt; b -&gt; s -&gt; (a, t)
--   (<a>&lt;&lt;?~</a>) :: <a>Lens</a> s t a (<a>Maybe</a> b)      -&gt; b -&gt; s -&gt; (a, t)
--   (<a>&lt;&lt;?~</a>) :: <a>Traversal</a> s t a (<a>Maybe</a> b) -&gt; b -&gt; s -&gt; (a, t)
--   </pre>
(<<?~) :: () => LensLike (,) a s t a Maybe b -> b -> s -> (a, t)
infixr 4 <<?~

-- | Replace the target of a <a>Lens</a>, but return the old value.
--   
--   When you do not need the old value, (<a>.~</a>) is more flexible.
--   
--   <pre>
--   (<a>&lt;&lt;.~</a>) ::             <a>Lens</a> s t a b      -&gt; b -&gt; s -&gt; (a, t)
--   (<a>&lt;&lt;.~</a>) ::             <a>Iso</a> s t a b       -&gt; b -&gt; s -&gt; (a, t)
--   (<a>&lt;&lt;.~</a>) :: <a>Monoid</a> a =&gt; <a>Traversal</a> s t a b -&gt; b -&gt; s -&gt; (a, t)
--   </pre>
(<<.~) :: () => LensLike (,) a s t a b -> b -> s -> (a, t)
infixr 4 <<.~

-- | Modify the target of a <a>Lens</a>, but return the old value.
--   
--   When you do not need the old value, (<a>%~</a>) is more flexible.
--   
--   <pre>
--   (<a>&lt;&lt;%~</a>) ::             <a>Lens</a> s t a b      -&gt; (a -&gt; b) -&gt; s -&gt; (a, t)
--   (<a>&lt;&lt;%~</a>) ::             <a>Iso</a> s t a b       -&gt; (a -&gt; b) -&gt; s -&gt; (a, t)
--   (<a>&lt;&lt;%~</a>) :: <a>Monoid</a> a =&gt; <a>Traversal</a> s t a b -&gt; (a -&gt; b) -&gt; s -&gt; (a, t)
--   </pre>
(<<%~) :: () => LensLike (,) a s t a b -> a -> b -> s -> (a, t)
infixr 4 <<%~

-- | Logically <a>&amp;&amp;</a> a Boolean valued <a>Lens</a> and return
--   the result.
--   
--   When you do not need the result of the operation, (<a>&amp;&amp;~</a>)
--   is more flexible.
--   
--   <pre>
--   (<a>&lt;&amp;&amp;~</a>) :: <a>Lens'</a> s <a>Bool</a> -&gt; <a>Bool</a> -&gt; s -&gt; (<a>Bool</a>, s)
--   (<a>&lt;&amp;&amp;~</a>) :: <a>Iso'</a> s <a>Bool</a>  -&gt; <a>Bool</a> -&gt; s -&gt; (<a>Bool</a>, s)
--   </pre>
(<&&~) :: () => LensLike (,) Bool s t Bool Bool -> Bool -> s -> (Bool, t)
infixr 4 <&&~

-- | Logically <a>||</a> a Boolean valued <a>Lens</a> and return the
--   result.
--   
--   When you do not need the result of the operation, (<a>||~</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;||~</a>) :: <a>Lens'</a> s <a>Bool</a> -&gt; <a>Bool</a> -&gt; s -&gt; (<a>Bool</a>, s)
--   (<a>&lt;||~</a>) :: <a>Iso'</a> s <a>Bool</a>  -&gt; <a>Bool</a> -&gt; s -&gt; (<a>Bool</a>, s)
--   </pre>
(<||~) :: () => LensLike (,) Bool s t Bool Bool -> Bool -> s -> (Bool, t)
infixr 4 <||~

-- | Raise the target of a floating-point valued <a>Lens</a> to an
--   arbitrary power and return the result.
--   
--   When you do not need the result of the operation, (<a>**~</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;**~</a>) :: <a>Floating</a> a =&gt; <a>Lens'</a> s a -&gt; a -&gt; s -&gt; (a, s)
--   (<a>&lt;**~</a>) :: <a>Floating</a> a =&gt; <a>Iso'</a> s a  -&gt; a -&gt; s -&gt; (a, s)
--   </pre>
(<**~) :: Floating a => LensLike (,) a s t a a -> a -> s -> (a, t)
infixr 4 <**~

-- | Raise the target of a fractionally valued <a>Lens</a> to an
--   <a>Integral</a> power and return the result.
--   
--   When you do not need the result of the operation, (<a>^^~</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;^^~</a>) :: (<a>Fractional</a> a, <a>Integral</a> e) =&gt; <a>Lens'</a> s a -&gt; e -&gt; s -&gt; (a, s)
--   (<a>&lt;^^~</a>) :: (<a>Fractional</a> a, <a>Integral</a> e) =&gt; <a>Iso'</a> s a -&gt; e -&gt; s -&gt; (a, s)
--   </pre>
(<^^~) :: (Fractional a, Integral e) => LensLike (,) a s t a a -> e -> s -> (a, t)
infixr 4 <^^~

-- | Raise the target of a numerically valued <a>Lens</a> to a non-negative
--   <a>Integral</a> power and return the result.
--   
--   When you do not need the result of the operation, (<a>^~</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;^~</a>) :: (<a>Num</a> a, <a>Integral</a> e) =&gt; <a>Lens'</a> s a -&gt; e -&gt; s -&gt; (a, s)
--   (<a>&lt;^~</a>) :: (<a>Num</a> a, <a>Integral</a> e) =&gt; <a>Iso'</a> s a -&gt; e -&gt; s -&gt; (a, s)
--   </pre>
(<^~) :: (Num a, Integral e) => LensLike (,) a s t a a -> e -> s -> (a, t)
infixr 4 <^~

-- | Divide the target of a fractionally valued <a>Lens</a> and return the
--   result.
--   
--   When you do not need the result of the division, (<a>//~</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;//~</a>) :: <a>Fractional</a> a =&gt; <a>Lens'</a> s a -&gt; a -&gt; s -&gt; (a, s)
--   (<a>&lt;//~</a>) :: <a>Fractional</a> a =&gt; <a>Iso'</a>  s a -&gt; a -&gt; s -&gt; (a, s)
--   </pre>
(<//~) :: Fractional a => LensLike (,) a s t a a -> a -> s -> (a, t)
infixr 4 <//~

-- | Multiply the target of a numerically valued <a>Lens</a> and return the
--   result.
--   
--   When you do not need the result of the multiplication, (<a>*~</a>) is
--   more flexible.
--   
--   <pre>
--   (<a>&lt;*~</a>) :: <a>Num</a> a =&gt; <a>Lens'</a> s a -&gt; a -&gt; s -&gt; (a, s)
--   (<a>&lt;*~</a>) :: <a>Num</a> a =&gt; <a>Iso'</a>  s a -&gt; a -&gt; s -&gt; (a, s)
--   </pre>
(<*~) :: Num a => LensLike (,) a s t a a -> a -> s -> (a, t)
infixr 4 <*~

-- | Decrement the target of a numerically valued <a>Lens</a> and return
--   the result.
--   
--   When you do not need the result of the subtraction, (<a>-~</a>) is
--   more flexible.
--   
--   <pre>
--   (<a>&lt;-~</a>) :: <a>Num</a> a =&gt; <a>Lens'</a> s a -&gt; a -&gt; s -&gt; (a, s)
--   (<a>&lt;-~</a>) :: <a>Num</a> a =&gt; <a>Iso'</a> s a  -&gt; a -&gt; s -&gt; (a, s)
--   </pre>
(<-~) :: Num a => LensLike (,) a s t a a -> a -> s -> (a, t)
infixr 4 <-~

-- | Increment the target of a numerically valued <a>Lens</a> and return
--   the result.
--   
--   When you do not need the result of the addition, (<a>+~</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;+~</a>) :: <a>Num</a> a =&gt; <a>Lens'</a> s a -&gt; a -&gt; s -&gt; (a, s)
--   (<a>&lt;+~</a>) :: <a>Num</a> a =&gt; <a>Iso'</a> s a  -&gt; a -&gt; s -&gt; (a, s)
--   </pre>
(<+~) :: Num a => LensLike (,) a s t a a -> a -> s -> (a, t)
infixr 4 <+~

-- | Modify the target of a <a>Lens</a> and return the result.
--   
--   When you do not need the result of the operation, (<a>%~</a>) is more
--   flexible.
--   
--   <pre>
--   (<a>&lt;%~</a>) ::             <a>Lens</a> s t a b      -&gt; (a -&gt; b) -&gt; s -&gt; (b, t)
--   (<a>&lt;%~</a>) ::             <a>Iso</a> s t a b       -&gt; (a -&gt; b) -&gt; s -&gt; (b, t)
--   (<a>&lt;%~</a>) :: <a>Monoid</a> b =&gt; <a>Traversal</a> s t a b -&gt; (a -&gt; b) -&gt; s -&gt; (b, t)
--   </pre>
(<%~) :: () => LensLike (,) b s t a b -> a -> b -> s -> (b, t)
infixr 4 <%~

-- | Clone an <a>IndexedLens</a> as an <a>IndexedLens</a> with the same
--   index.
cloneIndexedLens :: () => AnIndexedLens i s t a b -> IndexedLens i s t a b

-- | Clone a <a>Lens</a> as an <tt>IndexedPreservingLens</tt> that just
--   passes through whatever index is on any <a>IndexedLens</a>,
--   <a>IndexedFold</a>, <a>IndexedGetter</a> or <a>IndexedTraversal</a> it
--   is composed with.
cloneIndexPreservingLens :: () => ALens s t a b -> IndexPreservingLens s t a b

-- | Cloning a <a>Lens</a> is one way to make sure you aren't given
--   something weaker, such as a <a>Traversal</a> and can be used as a way
--   to pass around lenses that have to be monomorphic in <tt>f</tt>.
--   
--   Note: This only accepts a proper <a>Lens</a>.
--   
--   <pre>
--   &gt;&gt;&gt; let example l x = set (cloneLens l) (x^.cloneLens l + 1) x in example _2 ("hello",1,"you")
--   ("hello",2,"you")
--   </pre>
cloneLens :: () => ALens s t a b -> Lens s t a b

-- | This <a>Lens</a> lets you <tt>view</tt> the current <tt>pos</tt> of
--   any indexed store comonad and <tt>seek</tt> to a new position. This
--   reduces the API for working these instances to a single <a>Lens</a>.
--   
--   <pre>
--   <a>ipos</a> w ≡ w <a>^.</a> <a>locus</a>
--   <a>iseek</a> s w ≡ w <a>&amp;</a> <a>locus</a> <a>.~</a> s
--   <a>iseeks</a> f w ≡ w <a>&amp;</a> <a>locus</a> <a>%~</a> f
--   </pre>
--   
--   <pre>
--   <a>locus</a> :: <a>Lens'</a> (<a>Context'</a> a s) a
--   <a>locus</a> :: <a>Conjoined</a> p =&gt; <a>Lens'</a> (<a>Pretext'</a> p a s) a
--   <a>locus</a> :: <a>Conjoined</a> p =&gt; <a>Lens'</a> (<a>PretextT'</a> p g a s) a
--   </pre>
locus :: IndexedComonadStore p => Lens p a c s p b c s a b

-- | <a>alongside</a> makes a <a>Lens</a> from two other lenses or a
--   <a>Getter</a> from two other getters by executing them on their
--   respective halves of a product.
--   
--   <pre>
--   &gt;&gt;&gt; (Left a, Right b)^.alongside chosen chosen
--   (a,b)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (Left a, Right b) &amp; alongside chosen chosen .~ (c,d)
--   (Left c,Right d)
--   </pre>
--   
--   <pre>
--   <a>alongside</a> :: <a>Lens</a>   s t a b -&gt; <a>Lens</a>   s' t' a' b' -&gt; <a>Lens</a>   (s,s') (t,t') (a,a') (b,b')
--   <a>alongside</a> :: <a>Getter</a> s t a b -&gt; <a>Getter</a> s' t' a' b' -&gt; <a>Getter</a> (s,s') (t,t') (a,a') (b,b')
--   </pre>
alongside :: () => LensLike AlongsideLeft f b' s t a b -> LensLike AlongsideRight f t s' t' a' b' -> LensLike f (s, s') (t, t') (a, a') (b, b')

-- | This is a <a>Lens</a> that updates either side of an <a>Either</a>,
--   where both sides have the same type.
--   
--   <pre>
--   <a>chosen</a> ≡ <a>choosing</a> <a>id</a> <a>id</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Left a^.chosen
--   a
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Right a^.chosen
--   a
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Right "hello"^.chosen
--   "hello"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Right a &amp; chosen *~ b
--   Right (a * b)
--   </pre>
--   
--   <pre>
--   <a>chosen</a> :: <a>Lens</a> (<a>Either</a> a a) (<a>Either</a> b b) a b
--   <a>chosen</a> f (<a>Left</a> a)  = <a>Left</a> <a>&lt;$&gt;</a> f a
--   <a>chosen</a> f (<a>Right</a> a) = <a>Right</a> <a>&lt;$&gt;</a> f a
--   </pre>
chosen :: (Conjoined p, Functor f) => p a f b -> p Either a a f Either b b

-- | Merge two lenses, getters, setters, folds or traversals.
--   
--   <pre>
--   <a>chosen</a> ≡ <a>choosing</a> <a>id</a> <a>id</a>
--   </pre>
--   
--   <pre>
--   <a>choosing</a> :: <a>Getter</a> s a     -&gt; <a>Getter</a> s' a     -&gt; <a>Getter</a> (<a>Either</a> s s') a
--   <a>choosing</a> :: <a>Fold</a> s a       -&gt; <a>Fold</a> s' a       -&gt; <a>Fold</a> (<a>Either</a> s s') a
--   <a>choosing</a> :: <a>Lens'</a> s a      -&gt; <a>Lens'</a> s' a      -&gt; <a>Lens'</a> (<a>Either</a> s s') a
--   <a>choosing</a> :: <a>Traversal'</a> s a -&gt; <a>Traversal'</a> s' a -&gt; <a>Traversal'</a> (<a>Either</a> s s') a
--   <a>choosing</a> :: <a>Setter'</a> s a    -&gt; <a>Setter'</a> s' a    -&gt; <a>Setter'</a> (<a>Either</a> s s') a
--   </pre>
choosing :: Functor f => LensLike f s t a b -> LensLike f s' t' a b -> LensLike f Either s s' Either t t' a b

-- | Lift a <a>Lens</a> so it can run under a function (or other
--   corepresentable profunctor).
--   
--   <pre>
--   <a>inside</a> :: <a>Lens</a> s t a b -&gt; <a>Lens</a> (e -&gt; s) (e -&gt; t) (e -&gt; a) (e -&gt; b)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (\x -&gt; (x-1,x+1)) ^. inside _1 $ 5
--   4
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; runState (modify (1:) &gt;&gt; modify (2:)) ^. (inside _2) $ []
--   [2,1]
--   </pre>
inside :: Corepresentable p => ALens s t a b -> Lens p e s p e t p e a p e b

-- | This is convenient to <a>flip</a> argument order of composite
--   functions defined as:
--   
--   <pre>
--   fab ?? a = fmap ($ a) fab
--   </pre>
--   
--   For the <a>Functor</a> instance <tt>f = ((-&gt;) r)</tt> you can
--   reason about this function as if the definition was <tt>(<a>??</a>) ≡
--   <a>flip</a></tt>:
--   
--   <pre>
--   &gt;&gt;&gt; (h ?? x) a
--   h a x
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; execState ?? [] $ modify (1:)
--   [1]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; over _2 ?? ("hello","world") $ length
--   ("hello",5)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; over ?? length ?? ("hello","world") $ _2
--   ("hello",5)
--   </pre>
(??) :: Functor f => f a -> b -> a -> f b
infixl 1 ??

-- | Modify the target of a <a>Lens</a> in the current state returning some
--   extra information of type <tt>r</tt> or modify all targets of a
--   <a>Traversal</a> in the current state, extracting extra information of
--   type <tt>r</tt> and return a monoidal summary of the changes.
--   
--   <pre>
--   &gt;&gt;&gt; runState (_1 %%= \x -&gt; (f x, g x)) (a,b)
--   (f a,(g a,b))
--   </pre>
--   
--   <pre>
--   (<a>%%=</a>) ≡ (<a>state</a> <a>.</a>)
--   </pre>
--   
--   It may be useful to think of (<a>%%=</a>), instead, as having either
--   of the following more restricted type signatures:
--   
--   <pre>
--   (<a>%%=</a>) :: <a>MonadState</a> s m             =&gt; <a>Iso</a> s s a b       -&gt; (a -&gt; (r, b)) -&gt; m r
--   (<a>%%=</a>) :: <a>MonadState</a> s m             =&gt; <a>Lens</a> s s a b      -&gt; (a -&gt; (r, b)) -&gt; m r
--   (<a>%%=</a>) :: (<a>MonadState</a> s m, <a>Monoid</a> r) =&gt; <a>Traversal</a> s s a b -&gt; (a -&gt; (r, b)) -&gt; m r
--   </pre>
(%%=) :: MonadState s m => Over p (,) r s s a b -> p a (r, b) -> m r
infix 4 %%=

-- | (<a>%%~</a>) can be used in one of two scenarios:
--   
--   When applied to a <a>Lens</a>, it can edit the target of the
--   <a>Lens</a> in a structure, extracting a functorial result.
--   
--   When applied to a <a>Traversal</a>, it can edit the targets of the
--   traversals, extracting an applicative summary of its actions.
--   
--   <pre>
--   &gt;&gt;&gt; [66,97,116,109,97,110] &amp; each %%~ \a -&gt; ("na", chr a)
--   ("nananananana","Batman")
--   </pre>
--   
--   For all that the definition of this combinator is just:
--   
--   <pre>
--   (<a>%%~</a>) ≡ <a>id</a>
--   </pre>
--   
--   It may be beneficial to think about it as if it had these even more
--   restricted types, however:
--   
--   <pre>
--   (<a>%%~</a>) :: <a>Functor</a> f =&gt;     <a>Iso</a> s t a b       -&gt; (a -&gt; f b) -&gt; s -&gt; f t
--   (<a>%%~</a>) :: <a>Functor</a> f =&gt;     <a>Lens</a> s t a b      -&gt; (a -&gt; f b) -&gt; s -&gt; f t
--   (<a>%%~</a>) :: <a>Applicative</a> f =&gt; <a>Traversal</a> s t a b -&gt; (a -&gt; f b) -&gt; s -&gt; f t
--   </pre>
--   
--   When applied to a <a>Traversal</a>, it can edit the targets of the
--   traversals, extracting a supplemental monoidal summary of its actions,
--   by choosing <tt>f = ((,) m)</tt>
--   
--   <pre>
--   (<a>%%~</a>) ::             <a>Iso</a> s t a b       -&gt; (a -&gt; (r, b)) -&gt; s -&gt; (r, t)
--   (<a>%%~</a>) ::             <a>Lens</a> s t a b      -&gt; (a -&gt; (r, b)) -&gt; s -&gt; (r, t)
--   (<a>%%~</a>) :: <a>Monoid</a> m =&gt; <a>Traversal</a> s t a b -&gt; (a -&gt; (m, b)) -&gt; s -&gt; (m, t)
--   </pre>
(%%~) :: () => LensLike f s t a b -> a -> f b -> s -> f t
infixr 4 %%~

-- | This can be used to chain lens operations using <tt>op=</tt> syntax
--   rather than <tt>op~</tt> syntax for simple non-type-changing cases.
--   
--   <pre>
--   &gt;&gt;&gt; (10,20) &amp; _1 .~ 30 &amp; _2 .~ 40
--   (30,40)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (10,20) &amp;~ do _1 .= 30; _2 .= 40
--   (30,40)
--   </pre>
--   
--   This does not support type-changing assignment, <i>e.g.</i>
--   
--   <pre>
--   &gt;&gt;&gt; (10,20) &amp; _1 .~ "hello"
--   ("hello",20)
--   </pre>
(&~) :: () => s -> State s a -> s
infixl 1 &~

-- | Build an <a>IndexedLens</a> from a <a>Getter</a> and a <a>Setter</a>.
ilens :: () => s -> (i, a) -> s -> b -> t -> IndexedLens i s t a b

-- | Build an index-preserving <a>Lens</a> from a <a>Getter</a> and a
--   <a>Setter</a>.
iplens :: () => s -> a -> s -> b -> t -> IndexPreservingLens s t a b

-- | Build a <a>Lens</a> from a getter and a setter.
--   
--   <pre>
--   <a>lens</a> :: <a>Functor</a> f =&gt; (s -&gt; a) -&gt; (s -&gt; b -&gt; t) -&gt; (a -&gt; f b) -&gt; s -&gt; f t
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; s ^. lens getter setter
--   getter s
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; s &amp; lens getter setter .~ b
--   setter s b
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; s &amp; lens getter setter %~ f
--   setter s (f (getter s))
--   </pre>
--   
--   <pre>
--   <a>lens</a> :: (s -&gt; a) -&gt; (s -&gt; a -&gt; s) -&gt; <a>Lens'</a> s a
--   </pre>
lens :: () => s -> a -> s -> b -> t -> Lens s t a b

-- | When you see this as an argument to a function, it expects a
--   <a>Lens</a>.
--   
--   This type can also be used when you need to store a <a>Lens</a> in a
--   container, since it is rank-1. You can turn them back into a
--   <a>Lens</a> with <a>cloneLens</a>, or use it directly with combinators
--   like <a>storing</a> and (<a>^#</a>).
type ALens s t a b = LensLike Pretext ((->) :: * -> * -> *) a b s t a b

-- | <pre>
--   type <a>ALens'</a> = <a>Simple</a> <a>ALens</a>
--   </pre>
type ALens' s a = ALens s s a a

-- | When you see this as an argument to a function, it expects an
--   <a>IndexedLens</a>
type AnIndexedLens i s t a b = Optical Indexed i ((->) :: * -> * -> *) Pretext Indexed i a b s t a b

-- | <pre>
--   type <a>AnIndexedLens'</a> = <a>Simple</a> (<a>AnIndexedLens</a> i)
--   </pre>
type AnIndexedLens' i s a = AnIndexedLens i s s a a

-- | Map with index. (Deprecated alias for <a>iover</a>).
--   
--   When you do not need access to the index, then <a>mapOf</a> is more
--   liberal in what it can accept.
--   
--   <pre>
--   <a>mapOf</a> l ≡ <a>imapOf</a> l <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>imapOf</a> :: <a>IndexedSetter</a> i s t a b    -&gt; (i -&gt; a -&gt; b) -&gt; s -&gt; t
--   <a>imapOf</a> :: <a>IndexedLens</a> i s t a b      -&gt; (i -&gt; a -&gt; b) -&gt; s -&gt; t
--   <a>imapOf</a> :: <a>IndexedTraversal</a> i s t a b -&gt; (i -&gt; a -&gt; b) -&gt; s -&gt; t
--   </pre>
imapOf :: () => AnIndexedSetter i s t a b -> i -> a -> b -> s -> t

-- | <a>mapOf</a> is a deprecated alias for <a>over</a>.
mapOf :: () => ASetter s t a b -> a -> b -> s -> t

-- | Run an arrow command and use the output to set all the targets of a
--   <a>Lens</a>, <a>Setter</a> or <a>Traversal</a> to the result.
--   
--   <a>assignA</a> can be used very similarly to (<a>&lt;~</a>), except
--   that the type of the object being modified can change; for example:
--   
--   <pre>
--   runKleisli action ((), (), ()) where
--     action =      assignA _1 (Kleisli (const getVal1))
--              &gt;&gt;&gt; assignA _2 (Kleisli (const getVal2))
--              &gt;&gt;&gt; assignA _3 (Kleisli (const getVal3))
--     getVal1 :: Either String Int
--     getVal1 = ...
--     getVal2 :: Either String Bool
--     getVal2 = ...
--     getVal3 :: Either String Char
--     getVal3 = ...
--   </pre>
--   
--   has the type <tt><a>Either</a> <a>String</a> (<a>Int</a>, <a>Bool</a>,
--   <a>Char</a>)</tt>
--   
--   <pre>
--   <a>assignA</a> :: <a>Arrow</a> p =&gt; <a>Iso</a> s t a b       -&gt; p s b -&gt; p s t
--   <a>assignA</a> :: <a>Arrow</a> p =&gt; <a>Lens</a> s t a b      -&gt; p s b -&gt; p s t
--   <a>assignA</a> :: <a>Arrow</a> p =&gt; <a>Traversal</a> s t a b -&gt; p s b -&gt; p s t
--   <a>assignA</a> :: <a>Arrow</a> p =&gt; <a>Setter</a> s t a b    -&gt; p s b -&gt; p s t
--   </pre>
assignA :: Arrow p => ASetter s t a b -> p s b -> p s t

-- | Replace every target in the current state of an <a>IndexedSetter</a>,
--   <a>IndexedLens</a> or <a>IndexedTraversal</a> with access to the
--   index.
--   
--   When you do not need access to the index then (<a>.=</a>) is more
--   liberal in what it can accept.
--   
--   <pre>
--   l <a>.=</a> b ≡ l <a>.@=</a> <a>const</a> b
--   </pre>
--   
--   <pre>
--   (<a>.@=</a>) :: <a>MonadState</a> s m =&gt; <a>IndexedSetter</a> i s s a b    -&gt; (i -&gt; b) -&gt; m ()
--   (<a>.@=</a>) :: <a>MonadState</a> s m =&gt; <a>IndexedLens</a> i s s a b      -&gt; (i -&gt; b) -&gt; m ()
--   (<a>.@=</a>) :: <a>MonadState</a> s m =&gt; <a>IndexedTraversal</a> i s t a b -&gt; (i -&gt; b) -&gt; m ()
--   </pre>
(.@=) :: MonadState s m => AnIndexedSetter i s s a b -> i -> b -> m ()
infix 4 .@=

-- | This is an alias for (<a>%@=</a>).
imodifying :: MonadState s m => AnIndexedSetter i s s a b -> i -> a -> b -> m ()

-- | Adjust every target in the current state of an <a>IndexedSetter</a>,
--   <a>IndexedLens</a> or <a>IndexedTraversal</a> with access to the
--   index.
--   
--   When you do not need access to the index then (<a>%=</a>) is more
--   liberal in what it can accept.
--   
--   <pre>
--   l <a>%=</a> f ≡ l <a>%@=</a> <a>const</a> f
--   </pre>
--   
--   <pre>
--   (<a>%@=</a>) :: <a>MonadState</a> s m =&gt; <a>IndexedSetter</a> i s s a b    -&gt; (i -&gt; a -&gt; b) -&gt; m ()
--   (<a>%@=</a>) :: <a>MonadState</a> s m =&gt; <a>IndexedLens</a> i s s a b      -&gt; (i -&gt; a -&gt; b) -&gt; m ()
--   (<a>%@=</a>) :: <a>MonadState</a> s m =&gt; <a>IndexedTraversal</a> i s t a b -&gt; (i -&gt; a -&gt; b) -&gt; m ()
--   </pre>
(%@=) :: MonadState s m => AnIndexedSetter i s s a b -> i -> a -> b -> m ()
infix 4 %@=

-- | Replace every target of an <a>IndexedSetter</a>, <a>IndexedLens</a> or
--   <a>IndexedTraversal</a> with access to the index.
--   
--   <pre>
--   (<a>.@~</a>) ≡ <a>iset</a>
--   </pre>
--   
--   When you do not need access to the index then (<a>.~</a>) is more
--   liberal in what it can accept.
--   
--   <pre>
--   l <a>.~</a> b ≡ l <a>.@~</a> <a>const</a> b
--   </pre>
--   
--   <pre>
--   (<a>.@~</a>) :: <a>IndexedSetter</a> i s t a b    -&gt; (i -&gt; b) -&gt; s -&gt; t
--   (<a>.@~</a>) :: <a>IndexedLens</a> i s t a b      -&gt; (i -&gt; b) -&gt; s -&gt; t
--   (<a>.@~</a>) :: <a>IndexedTraversal</a> i s t a b -&gt; (i -&gt; b) -&gt; s -&gt; t
--   </pre>
(.@~) :: () => AnIndexedSetter i s t a b -> i -> b -> s -> t
infixr 4 .@~

-- | Adjust every target of an <a>IndexedSetter</a>, <a>IndexedLens</a> or
--   <a>IndexedTraversal</a> with access to the index.
--   
--   <pre>
--   (<a>%@~</a>) ≡ <a>iover</a>
--   </pre>
--   
--   When you do not need access to the index then (<a>%~</a>) is more
--   liberal in what it can accept.
--   
--   <pre>
--   l <a>%~</a> f ≡ l <a>%@~</a> <a>const</a> f
--   </pre>
--   
--   <pre>
--   (<a>%@~</a>) :: <a>IndexedSetter</a> i s t a b    -&gt; (i -&gt; a -&gt; b) -&gt; s -&gt; t
--   (<a>%@~</a>) :: <a>IndexedLens</a> i s t a b      -&gt; (i -&gt; a -&gt; b) -&gt; s -&gt; t
--   (<a>%@~</a>) :: <a>IndexedTraversal</a> i s t a b -&gt; (i -&gt; a -&gt; b) -&gt; s -&gt; t
--   </pre>
(%@~) :: () => AnIndexedSetter i s t a b -> i -> a -> b -> s -> t
infixr 4 %@~

-- | Build an <a>IndexedSetter</a> from an <a>imap</a>-like function.
--   
--   Your supplied function <tt>f</tt> is required to satisfy:
--   
--   <pre>
--   f <a>id</a> ≡ <a>id</a>
--   f g <a>.</a> f h ≡ f (g <a>.</a> h)
--   </pre>
--   
--   Equational reasoning:
--   
--   <pre>
--   <a>isets</a> <a>.</a> <a>iover</a> ≡ <a>id</a>
--   <a>iover</a> <a>.</a> <a>isets</a> ≡ <a>id</a>
--   </pre>
--   
--   Another way to view <a>isets</a> is that it takes a "semantic editor
--   combinator" which has been modified to carry an index and transforms
--   it into a <a>IndexedSetter</a>.
isets :: () => i -> a -> b -> s -> t -> IndexedSetter i s t a b

-- | Set with index. Equivalent to <a>iover</a> with the current value
--   ignored.
--   
--   When you do not need access to the index, then <a>set</a> is more
--   liberal in what it can accept.
--   
--   <pre>
--   <a>set</a> l ≡ <a>iset</a> l <a>.</a> <a>const</a>
--   </pre>
--   
--   <pre>
--   <a>iset</a> :: <a>IndexedSetter</a> i s t a b    -&gt; (i -&gt; b) -&gt; s -&gt; t
--   <a>iset</a> :: <a>IndexedLens</a> i s t a b      -&gt; (i -&gt; b) -&gt; s -&gt; t
--   <a>iset</a> :: <a>IndexedTraversal</a> i s t a b -&gt; (i -&gt; b) -&gt; s -&gt; t
--   </pre>
iset :: () => AnIndexedSetter i s t a b -> i -> b -> s -> t

-- | Map with index. This is an alias for <a>imapOf</a>.
--   
--   When you do not need access to the index, then <a>over</a> is more
--   liberal in what it can accept.
--   
--   <pre>
--   <a>over</a> l ≡ <a>iover</a> l <a>.</a> <a>const</a>
--   <a>iover</a> l ≡ <a>over</a> l <a>.</a> <a>Indexed</a>
--   </pre>
--   
--   <pre>
--   <a>iover</a> :: <a>IndexedSetter</a> i s t a b    -&gt; (i -&gt; a -&gt; b) -&gt; s -&gt; t
--   <a>iover</a> :: <a>IndexedLens</a> i s t a b      -&gt; (i -&gt; a -&gt; b) -&gt; s -&gt; t
--   <a>iover</a> :: <a>IndexedTraversal</a> i s t a b -&gt; (i -&gt; a -&gt; b) -&gt; s -&gt; t
--   </pre>
iover :: () => AnIndexedSetter i s t a b -> i -> a -> b -> s -> t

-- | This is a generalization of <a>censor</a> that alows you to
--   <a>censor</a> just a portion of the resulting <a>MonadWriter</a>, with
--   access to the index of an <a>IndexedSetter</a>.
icensoring :: MonadWriter w m => IndexedSetter i w w u v -> i -> u -> v -> m a -> m a

-- | This is a generalization of <a>censor</a> that alows you to
--   <a>censor</a> just a portion of the resulting <a>MonadWriter</a>.
censoring :: MonadWriter w m => Setter w w u v -> u -> v -> m a -> m a

-- | This is a generalization of <a>pass</a> that alows you to modify just
--   a portion of the resulting <a>MonadWriter</a> with access to the index
--   of an <a>IndexedSetter</a>.
ipassing :: MonadWriter w m => IndexedSetter i w w u v -> m (a, i -> u -> v) -> m a

-- | This is a generalization of <a>pass</a> that alows you to modify just
--   a portion of the resulting <a>MonadWriter</a>.
passing :: MonadWriter w m => Setter w w u v -> m (a, u -> v) -> m a

-- | Write to a fragment of a larger <tt>Writer</tt> format.
scribe :: (MonadWriter t m, Monoid s) => ASetter s t a b -> b -> m ()

-- | Modify the target(s) of a <a>Lens'</a>, <a>Iso</a>, <a>Setter</a> or
--   <a>Traversal</a> by <a>mappend</a>ing a value.
--   
--   <pre>
--   &gt;&gt;&gt; execState (do _1 &lt;&gt;= Sum c; _2 &lt;&gt;= Product d) (Sum a,Product b)
--   (Sum {getSum = a + c},Product {getProduct = b * d})
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; execState (both &lt;&gt;= "!!!") ("hello","world")
--   ("hello!!!","world!!!")
--   </pre>
--   
--   <pre>
--   (<a>&lt;&gt;=</a>) :: (<a>MonadState</a> s m, <a>Monoid</a> a) =&gt; <a>Setter'</a> s a -&gt; a -&gt; m ()
--   (<a>&lt;&gt;=</a>) :: (<a>MonadState</a> s m, <a>Monoid</a> a) =&gt; <a>Iso'</a> s a -&gt; a -&gt; m ()
--   (<a>&lt;&gt;=</a>) :: (<a>MonadState</a> s m, <a>Monoid</a> a) =&gt; <a>Lens'</a> s a -&gt; a -&gt; m ()
--   (<a>&lt;&gt;=</a>) :: (<a>MonadState</a> s m, <a>Monoid</a> a) =&gt; <a>Traversal'</a> s a -&gt; a -&gt; m ()
--   </pre>
(<>=) :: (MonadState s m, Monoid a) => ASetter' s a -> a -> m ()
infix 4 <>=

-- | Modify the target of a monoidally valued by <a>mappend</a>ing another
--   value.
--   
--   <pre>
--   &gt;&gt;&gt; (Sum a,b) &amp; _1 &lt;&gt;~ Sum c
--   (Sum {getSum = a + c},b)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (Sum a,Sum b) &amp; both &lt;&gt;~ Sum c
--   (Sum {getSum = a + c},Sum {getSum = b + c})
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; both &lt;&gt;~ "!!!" $ ("hello","world")
--   ("hello!!!","world!!!")
--   </pre>
--   
--   <pre>
--   (<a>&lt;&gt;~</a>) :: <a>Monoid</a> a =&gt; <a>Setter</a> s t a a    -&gt; a -&gt; s -&gt; t
--   (<a>&lt;&gt;~</a>) :: <a>Monoid</a> a =&gt; <a>Iso</a> s t a a       -&gt; a -&gt; s -&gt; t
--   (<a>&lt;&gt;~</a>) :: <a>Monoid</a> a =&gt; <a>Lens</a> s t a a      -&gt; a -&gt; s -&gt; t
--   (<a>&lt;&gt;~</a>) :: <a>Monoid</a> a =&gt; <a>Traversal</a> s t a a -&gt; a -&gt; s -&gt; t
--   </pre>
(<>~) :: Monoid a => ASetter s t a a -> a -> s -> t
infixr 4 <>~

-- | Set <a>Just</a> a value with pass-through
--   
--   This is useful for chaining assignment without round-tripping through
--   your <a>Monad</a> stack.
--   
--   <pre>
--   do x &lt;- <a>at</a> "foo" <a>&lt;?=</a> ninety_nine_bottles_of_beer_on_the_wall
--   </pre>
--   
--   If you do not need a copy of the intermediate result, then using <tt>l
--   <a>?=</a> d</tt> will avoid unused binding warnings.
--   
--   <pre>
--   (<a>&lt;?=</a>) :: <a>MonadState</a> s m =&gt; <a>Setter</a> s s a (<a>Maybe</a> b)    -&gt; b -&gt; m b
--   (<a>&lt;?=</a>) :: <a>MonadState</a> s m =&gt; <a>Iso</a> s s a (<a>Maybe</a> b)       -&gt; b -&gt; m b
--   (<a>&lt;?=</a>) :: <a>MonadState</a> s m =&gt; <a>Lens</a> s s a (<a>Maybe</a> b)      -&gt; b -&gt; m b
--   (<a>&lt;?=</a>) :: <a>MonadState</a> s m =&gt; <a>Traversal</a> s s a (<a>Maybe</a> b) -&gt; b -&gt; m b
--   </pre>
(<?=) :: MonadState s m => ASetter s s a Maybe b -> b -> m b
infix 4 <?=

-- | Set with pass-through
--   
--   This is useful for chaining assignment without round-tripping through
--   your <a>Monad</a> stack.
--   
--   <pre>
--   do x &lt;- <a>_2</a> <a>&lt;.=</a> ninety_nine_bottles_of_beer_on_the_wall
--   </pre>
--   
--   If you do not need a copy of the intermediate result, then using <tt>l
--   <a>.=</a> d</tt> will avoid unused binding warnings.
--   
--   <pre>
--   (<a>&lt;.=</a>) :: <a>MonadState</a> s m =&gt; <a>Setter</a> s s a b    -&gt; b -&gt; m b
--   (<a>&lt;.=</a>) :: <a>MonadState</a> s m =&gt; <a>Iso</a> s s a b       -&gt; b -&gt; m b
--   (<a>&lt;.=</a>) :: <a>MonadState</a> s m =&gt; <a>Lens</a> s s a b      -&gt; b -&gt; m b
--   (<a>&lt;.=</a>) :: <a>MonadState</a> s m =&gt; <a>Traversal</a> s s a b -&gt; b -&gt; m b
--   </pre>
(<.=) :: MonadState s m => ASetter s s a b -> b -> m b
infix 4 <.=

-- | Run a monadic action, and set all of the targets of a <a>Lens</a>,
--   <a>Setter</a> or <a>Traversal</a> to its result.
--   
--   <pre>
--   (<a>&lt;~</a>) :: <a>MonadState</a> s m =&gt; <a>Iso</a> s s a b       -&gt; m b -&gt; m ()
--   (<a>&lt;~</a>) :: <a>MonadState</a> s m =&gt; <a>Lens</a> s s a b      -&gt; m b -&gt; m ()
--   (<a>&lt;~</a>) :: <a>MonadState</a> s m =&gt; <a>Traversal</a> s s a b -&gt; m b -&gt; m ()
--   (<a>&lt;~</a>) :: <a>MonadState</a> s m =&gt; <a>Setter</a> s s a b    -&gt; m b -&gt; m ()
--   </pre>
--   
--   As a reasonable mnemonic, this lets you store the result of a monadic
--   action in a <a>Lens</a> rather than in a local variable.
--   
--   <pre>
--   do foo &lt;- bar
--      ...
--   </pre>
--   
--   will store the result in a variable, while
--   
--   <pre>
--   do foo <a>&lt;~</a> bar
--      ...
--   </pre>
--   
--   will store the result in a <a>Lens</a>, <a>Setter</a>, or
--   <a>Traversal</a>.
(<~) :: MonadState s m => ASetter s s a b -> m b -> m ()
infixr 2 <~

-- | Modify the target(s) of a <a>Lens'</a>, 'Iso, <a>Setter</a> or
--   <a>Traversal</a> by taking their logical <a>||</a> with a value.
--   
--   <pre>
--   &gt;&gt;&gt; execState (do _1 ||= True; _2 ||= False; _3 ||= True; _4 ||= False) (True,True,False,False)
--   (True,True,True,False)
--   </pre>
--   
--   <pre>
--   (<a>||=</a>) :: <a>MonadState</a> s m =&gt; <a>Setter'</a> s <a>Bool</a>    -&gt; <a>Bool</a> -&gt; m ()
--   (<a>||=</a>) :: <a>MonadState</a> s m =&gt; <a>Iso'</a> s <a>Bool</a>       -&gt; <a>Bool</a> -&gt; m ()
--   (<a>||=</a>) :: <a>MonadState</a> s m =&gt; <a>Lens'</a> s <a>Bool</a>      -&gt; <a>Bool</a> -&gt; m ()
--   (<a>||=</a>) :: <a>MonadState</a> s m =&gt; <a>Traversal'</a> s <a>Bool</a> -&gt; <a>Bool</a> -&gt; m ()
--   </pre>
(||=) :: MonadState s m => ASetter' s Bool -> Bool -> m ()
infix 4 ||=

-- | Modify the target(s) of a <a>Lens'</a>, <a>Iso</a>, <a>Setter</a> or
--   <a>Traversal</a> by taking their logical <a>&amp;&amp;</a> with a
--   value.
--   
--   <pre>
--   &gt;&gt;&gt; execState (do _1 &amp;&amp;= True; _2 &amp;&amp;= False; _3 &amp;&amp;= True; _4 &amp;&amp;= False) (True,True,False,False)
--   (True,False,False,False)
--   </pre>
--   
--   <pre>
--   (<a>&amp;&amp;=</a>) :: <a>MonadState</a> s m =&gt; <a>Setter'</a> s <a>Bool</a>    -&gt; <a>Bool</a> -&gt; m ()
--   (<a>&amp;&amp;=</a>) :: <a>MonadState</a> s m =&gt; <a>Iso'</a> s <a>Bool</a>       -&gt; <a>Bool</a> -&gt; m ()
--   (<a>&amp;&amp;=</a>) :: <a>MonadState</a> s m =&gt; <a>Lens'</a> s <a>Bool</a>      -&gt; <a>Bool</a> -&gt; m ()
--   (<a>&amp;&amp;=</a>) :: <a>MonadState</a> s m =&gt; <a>Traversal'</a> s <a>Bool</a> -&gt; <a>Bool</a> -&gt; m ()
--   </pre>
(&&=) :: MonadState s m => ASetter' s Bool -> Bool -> m ()
infix 4 &&=

-- | Raise the target(s) of a numerically valued <a>Lens</a>, <a>Setter</a>
--   or <a>Traversal</a> to an arbitrary power
--   
--   <pre>
--   &gt;&gt;&gt; execState (do _1 **= c; _2 **= d) (a,b)
--   (a**c,b**d)
--   </pre>
--   
--   <pre>
--   (<a>**=</a>) ::  (<a>MonadState</a> s m, <a>Floating</a> a) =&gt; <a>Setter'</a> s a    -&gt; a -&gt; m ()
--   (<a>**=</a>) ::  (<a>MonadState</a> s m, <a>Floating</a> a) =&gt; <a>Iso'</a> s a       -&gt; a -&gt; m ()
--   (<a>**=</a>) ::  (<a>MonadState</a> s m, <a>Floating</a> a) =&gt; <a>Lens'</a> s a      -&gt; a -&gt; m ()
--   (<a>**=</a>) ::  (<a>MonadState</a> s m, <a>Floating</a> a) =&gt; <a>Traversal'</a> s a -&gt; a -&gt; m ()
--   </pre>
(**=) :: (MonadState s m, Floating a) => ASetter' s a -> a -> m ()
infix 4 **=

-- | Raise the target(s) of a numerically valued <a>Lens</a>, <a>Setter</a>
--   or <a>Traversal</a> to an integral power.
--   
--   <pre>
--   (<a>^^=</a>) ::  (<a>MonadState</a> s m, <a>Fractional</a> a, <a>Integral</a> e) =&gt; <a>Setter'</a> s a    -&gt; e -&gt; m ()
--   (<a>^^=</a>) ::  (<a>MonadState</a> s m, <a>Fractional</a> a, <a>Integral</a> e) =&gt; <a>Iso'</a> s a       -&gt; e -&gt; m ()
--   (<a>^^=</a>) ::  (<a>MonadState</a> s m, <a>Fractional</a> a, <a>Integral</a> e) =&gt; <a>Lens'</a> s a      -&gt; e -&gt; m ()
--   (<a>^^=</a>) ::  (<a>MonadState</a> s m, <a>Fractional</a> a, <a>Integral</a> e) =&gt; <a>Traversal'</a> s a -&gt; e -&gt; m ()
--   </pre>
(^^=) :: (MonadState s m, Fractional a, Integral e) => ASetter' s a -> e -> m ()
infix 4 ^^=

-- | Raise the target(s) of a numerically valued <a>Lens</a>, <a>Setter</a>
--   or <a>Traversal</a> to a non-negative integral power.
--   
--   <pre>
--   (<a>^=</a>) ::  (<a>MonadState</a> s m, <a>Num</a> a, <a>Integral</a> e) =&gt; <a>Setter'</a> s a    -&gt; e -&gt; m ()
--   (<a>^=</a>) ::  (<a>MonadState</a> s m, <a>Num</a> a, <a>Integral</a> e) =&gt; <a>Iso'</a> s a       -&gt; e -&gt; m ()
--   (<a>^=</a>) ::  (<a>MonadState</a> s m, <a>Num</a> a, <a>Integral</a> e) =&gt; <a>Lens'</a> s a      -&gt; e -&gt; m ()
--   (<a>^=</a>) ::  (<a>MonadState</a> s m, <a>Num</a> a, <a>Integral</a> e) =&gt; <a>Traversal'</a> s a -&gt; e -&gt; m ()
--   </pre>
(^=) :: (MonadState s m, Num a, Integral e) => ASetter' s a -> e -> m ()
infix 4 ^=

-- | Modify the target(s) of a <a>Lens'</a>, <a>Iso</a>, <a>Setter</a> or
--   <a>Traversal</a> by dividing by a value.
--   
--   <pre>
--   &gt;&gt;&gt; execState (do _1 //= c; _2 //= d) (a,b)
--   (a / c,b / d)
--   </pre>
--   
--   <pre>
--   (<a>//=</a>) :: (<a>MonadState</a> s m, <a>Fractional</a> a) =&gt; <a>Setter'</a> s a    -&gt; a -&gt; m ()
--   (<a>//=</a>) :: (<a>MonadState</a> s m, <a>Fractional</a> a) =&gt; <a>Iso'</a> s a       -&gt; a -&gt; m ()
--   (<a>//=</a>) :: (<a>MonadState</a> s m, <a>Fractional</a> a) =&gt; <a>Lens'</a> s a      -&gt; a -&gt; m ()
--   (<a>//=</a>) :: (<a>MonadState</a> s m, <a>Fractional</a> a) =&gt; <a>Traversal'</a> s a -&gt; a -&gt; m ()
--   </pre>
(//=) :: (MonadState s m, Fractional a) => ASetter' s a -> a -> m ()
infix 4 //=

-- | Modify the target(s) of a <a>Lens'</a>, <a>Iso</a>, <a>Setter</a> or
--   <a>Traversal</a> by multiplying by value.
--   
--   <pre>
--   &gt;&gt;&gt; execState (do _1 *= c; _2 *= d) (a,b)
--   (a * c,b * d)
--   </pre>
--   
--   <pre>
--   (<a>*=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Setter'</a> s a    -&gt; a -&gt; m ()
--   (<a>*=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Iso'</a> s a       -&gt; a -&gt; m ()
--   (<a>*=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Lens'</a> s a      -&gt; a -&gt; m ()
--   (<a>*=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Traversal'</a> s a -&gt; a -&gt; m ()
--   </pre>
(*=) :: (MonadState s m, Num a) => ASetter' s a -> a -> m ()
infix 4 *=

-- | Modify the target(s) of a <a>Lens'</a>, <a>Iso</a>, <a>Setter</a> or
--   <a>Traversal</a> by subtracting a value.
--   
--   <pre>
--   &gt;&gt;&gt; execState (do _1 -= c; _2 -= d) (a,b)
--   (a - c,b - d)
--   </pre>
--   
--   <pre>
--   (<a>-=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Setter'</a> s a    -&gt; a -&gt; m ()
--   (<a>-=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Iso'</a> s a       -&gt; a -&gt; m ()
--   (<a>-=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Lens'</a> s a      -&gt; a -&gt; m ()
--   (<a>-=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Traversal'</a> s a -&gt; a -&gt; m ()
--   </pre>
(-=) :: (MonadState s m, Num a) => ASetter' s a -> a -> m ()
infix 4 -=

-- | Modify the target(s) of a <a>Lens'</a>, <a>Iso</a>, <a>Setter</a> or
--   <a>Traversal</a> by adding a value.
--   
--   Example:
--   
--   <pre>
--   <tt>fresh</tt> :: <a>MonadState</a> <a>Int</a> m =&gt; m <a>Int</a>
--   <tt>fresh</tt> = do
--     <a>id</a> <a>+=</a> 1
--     <a>use</a> <a>id</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; execState (do _1 += c; _2 += d) (a,b)
--   (a + c,b + d)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; execState (do _1.at 1.non 0 += 10) (Map.fromList [(2,100)],"hello")
--   (fromList [(1,10),(2,100)],"hello")
--   </pre>
--   
--   <pre>
--   (<a>+=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Setter'</a> s a    -&gt; a -&gt; m ()
--   (<a>+=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Iso'</a> s a       -&gt; a -&gt; m ()
--   (<a>+=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Lens'</a> s a      -&gt; a -&gt; m ()
--   (<a>+=</a>) :: (<a>MonadState</a> s m, <a>Num</a> a) =&gt; <a>Traversal'</a> s a -&gt; a -&gt; m ()
--   </pre>
(+=) :: (MonadState s m, Num a) => ASetter' s a -> a -> m ()
infix 4 +=

-- | Replace the target of a <a>Lens</a> or all of the targets of a
--   <a>Setter</a> or <a>Traversal</a> in our monadic state with
--   <a>Just</a> a new value, irrespective of the old.
--   
--   <pre>
--   &gt;&gt;&gt; execState (do at 1 ?= a; at 2 ?= b) Map.empty
--   fromList [(1,a),(2,b)]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; execState (do _1 ?= b; _2 ?= c) (Just a, Nothing)
--   (Just b,Just c)
--   </pre>
--   
--   <pre>
--   (<a>?=</a>) :: <a>MonadState</a> s m =&gt; <a>Iso'</a> s (<a>Maybe</a> a)       -&gt; a -&gt; m ()
--   (<a>?=</a>) :: <a>MonadState</a> s m =&gt; <a>Lens'</a> s (<a>Maybe</a> a)      -&gt; a -&gt; m ()
--   (<a>?=</a>) :: <a>MonadState</a> s m =&gt; <a>Traversal'</a> s (<a>Maybe</a> a) -&gt; a -&gt; m ()
--   (<a>?=</a>) :: <a>MonadState</a> s m =&gt; <a>Setter'</a> s (<a>Maybe</a> a)    -&gt; a -&gt; m ()
--   </pre>
(?=) :: MonadState s m => ASetter s s a Maybe b -> b -> m ()
infix 4 ?=

-- | This is an alias for (<a>%=</a>).
modifying :: MonadState s m => ASetter s s a b -> a -> b -> m ()

-- | Map over the target of a <a>Lens</a> or all of the targets of a
--   <a>Setter</a> or <a>Traversal</a> in our monadic state.
--   
--   <pre>
--   &gt;&gt;&gt; execState (do _1 %= f;_2 %= g) (a,b)
--   (f a,g b)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; execState (do both %= f) (a,b)
--   (f a,f b)
--   </pre>
--   
--   <pre>
--   (<a>%=</a>) :: <a>MonadState</a> s m =&gt; <a>Iso'</a> s a       -&gt; (a -&gt; a) -&gt; m ()
--   (<a>%=</a>) :: <a>MonadState</a> s m =&gt; <a>Lens'</a> s a      -&gt; (a -&gt; a) -&gt; m ()
--   (<a>%=</a>) :: <a>MonadState</a> s m =&gt; <a>Traversal'</a> s a -&gt; (a -&gt; a) -&gt; m ()
--   (<a>%=</a>) :: <a>MonadState</a> s m =&gt; <a>Setter'</a> s a    -&gt; (a -&gt; a) -&gt; m ()
--   </pre>
--   
--   <pre>
--   (<a>%=</a>) :: <a>MonadState</a> s m =&gt; <a>ASetter</a> s s a b -&gt; (a -&gt; b) -&gt; m ()
--   </pre>
(%=) :: MonadState s m => ASetter s s a b -> a -> b -> m ()
infix 4 %=

-- | Replace the target of a <a>Lens</a> or all of the targets of a
--   <a>Setter</a> or <a>Traversal</a> in our monadic state with a new
--   value, irrespective of the old.
--   
--   This is an infix version of <a>assign</a>.
--   
--   <pre>
--   &gt;&gt;&gt; execState (do _1 .= c; _2 .= d) (a,b)
--   (c,d)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; execState (both .= c) (a,b)
--   (c,c)
--   </pre>
--   
--   <pre>
--   (<a>.=</a>) :: <a>MonadState</a> s m =&gt; <a>Iso'</a> s a       -&gt; a -&gt; m ()
--   (<a>.=</a>) :: <a>MonadState</a> s m =&gt; <a>Lens'</a> s a      -&gt; a -&gt; m ()
--   (<a>.=</a>) :: <a>MonadState</a> s m =&gt; <a>Traversal'</a> s a -&gt; a -&gt; m ()
--   (<a>.=</a>) :: <a>MonadState</a> s m =&gt; <a>Setter'</a> s a    -&gt; a -&gt; m ()
--   </pre>
--   
--   <i>It puts the state in the monad or it gets the hose again.</i>
(.=) :: MonadState s m => ASetter s s a b -> b -> m ()
infix 4 .=

-- | Replace the target of a <a>Lens</a> or all of the targets of a
--   <a>Setter</a> or <a>Traversal</a> in our monadic state with a new
--   value, irrespective of the old.
--   
--   This is an alias for (<a>.=</a>).
--   
--   <pre>
--   &gt;&gt;&gt; execState (do assign _1 c; assign _2 d) (a,b)
--   (c,d)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; execState (both .= c) (a,b)
--   (c,c)
--   </pre>
--   
--   <pre>
--   <a>assign</a> :: <a>MonadState</a> s m =&gt; <a>Iso'</a> s a       -&gt; a -&gt; m ()
--   <a>assign</a> :: <a>MonadState</a> s m =&gt; <a>Lens'</a> s a      -&gt; a -&gt; m ()
--   <a>assign</a> :: <a>MonadState</a> s m =&gt; <a>Traversal'</a> s a -&gt; a -&gt; m ()
--   <a>assign</a> :: <a>MonadState</a> s m =&gt; <a>Setter'</a> s a    -&gt; a -&gt; m ()
--   </pre>
assign :: MonadState s m => ASetter s s a b -> b -> m ()

-- | Logically <a>&amp;&amp;</a> the target(s) of a <a>Bool</a>-valued
--   <a>Lens</a> or <a>Setter</a>.
--   
--   <pre>
--   &gt;&gt;&gt; both &amp;&amp;~ True $ (False, True)
--   (False,True)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; both &amp;&amp;~ False $ (False, True)
--   (False,False)
--   </pre>
--   
--   <pre>
--   (<a>&amp;&amp;~</a>) :: <a>Setter'</a> s <a>Bool</a>    -&gt; <a>Bool</a> -&gt; s -&gt; s
--   (<a>&amp;&amp;~</a>) :: <a>Iso'</a> s <a>Bool</a>       -&gt; <a>Bool</a> -&gt; s -&gt; s
--   (<a>&amp;&amp;~</a>) :: <a>Lens'</a> s <a>Bool</a>      -&gt; <a>Bool</a> -&gt; s -&gt; s
--   (<a>&amp;&amp;~</a>) :: <a>Traversal'</a> s <a>Bool</a> -&gt; <a>Bool</a> -&gt; s -&gt; s
--   </pre>
(&&~) :: () => ASetter s t Bool Bool -> Bool -> s -> t
infixr 4 &&~

-- | Logically <a>||</a> the target(s) of a <a>Bool</a>-valued <a>Lens</a>
--   or <a>Setter</a>.
--   
--   <pre>
--   &gt;&gt;&gt; both ||~ True $ (False,True)
--   (True,True)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; both ||~ False $ (False,True)
--   (False,True)
--   </pre>
--   
--   <pre>
--   (<a>||~</a>) :: <a>Setter'</a> s <a>Bool</a>    -&gt; <a>Bool</a> -&gt; s -&gt; s
--   (<a>||~</a>) :: <a>Iso'</a> s <a>Bool</a>       -&gt; <a>Bool</a> -&gt; s -&gt; s
--   (<a>||~</a>) :: <a>Lens'</a> s <a>Bool</a>      -&gt; <a>Bool</a> -&gt; s -&gt; s
--   (<a>||~</a>) :: <a>Traversal'</a> s <a>Bool</a> -&gt; <a>Bool</a> -&gt; s -&gt; s
--   </pre>
(||~) :: () => ASetter s t Bool Bool -> Bool -> s -> t
infixr 4 ||~

-- | Raise the target(s) of a floating-point valued <a>Lens</a>,
--   <a>Setter</a> or <a>Traversal</a> to an arbitrary power.
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; _1 **~ c
--   (a**c,b)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; both **~ c
--   (a**c,b**c)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; _2 **~ 10 $ (3,2)
--   (3,1024.0)
--   </pre>
--   
--   <pre>
--   (<a>**~</a>) :: <a>Floating</a> a =&gt; <a>Setter'</a> s a    -&gt; a -&gt; s -&gt; s
--   (<a>**~</a>) :: <a>Floating</a> a =&gt; <a>Iso'</a> s a       -&gt; a -&gt; s -&gt; s
--   (<a>**~</a>) :: <a>Floating</a> a =&gt; <a>Lens'</a> s a      -&gt; a -&gt; s -&gt; s
--   (<a>**~</a>) :: <a>Floating</a> a =&gt; <a>Traversal'</a> s a -&gt; a -&gt; s -&gt; s
--   </pre>
(**~) :: Floating a => ASetter s t a a -> a -> s -> t
infixr 4 **~

-- | Raise the target(s) of a fractionally valued <a>Lens</a>,
--   <a>Setter</a> or <a>Traversal</a> to an integral power.
--   
--   <pre>
--   &gt;&gt;&gt; (1,2) &amp; _2 ^^~ (-1)
--   (1,0.5)
--   </pre>
--   
--   <pre>
--   (<a>^^~</a>) :: (<a>Fractional</a> a, <a>Integral</a> e) =&gt; <a>Setter'</a> s a    -&gt; e -&gt; s -&gt; s
--   (<a>^^~</a>) :: (<a>Fractional</a> a, <a>Integral</a> e) =&gt; <a>Iso'</a> s a       -&gt; e -&gt; s -&gt; s
--   (<a>^^~</a>) :: (<a>Fractional</a> a, <a>Integral</a> e) =&gt; <a>Lens'</a> s a      -&gt; e -&gt; s -&gt; s
--   (<a>^^~</a>) :: (<a>Fractional</a> a, <a>Integral</a> e) =&gt; <a>Traversal'</a> s a -&gt; e -&gt; s -&gt; s
--   </pre>
(^^~) :: (Fractional a, Integral e) => ASetter s t a a -> e -> s -> t
infixr 4 ^^~

-- | Raise the target(s) of a numerically valued <a>Lens</a>, <a>Setter</a>
--   or <a>Traversal</a> to a non-negative integral power.
--   
--   <pre>
--   &gt;&gt;&gt; (1,3) &amp; _2 ^~ 2
--   (1,9)
--   </pre>
--   
--   <pre>
--   (<a>^~</a>) :: (<a>Num</a> a, <a>Integral</a> e) =&gt; <a>Setter'</a> s a    -&gt; e -&gt; s -&gt; s
--   (<a>^~</a>) :: (<a>Num</a> a, <a>Integral</a> e) =&gt; <a>Iso'</a> s a       -&gt; e -&gt; s -&gt; s
--   (<a>^~</a>) :: (<a>Num</a> a, <a>Integral</a> e) =&gt; <a>Lens'</a> s a      -&gt; e -&gt; s -&gt; s
--   (<a>^~</a>) :: (<a>Num</a> a, <a>Integral</a> e) =&gt; <a>Traversal'</a> s a -&gt; e -&gt; s -&gt; s
--   </pre>
(^~) :: (Num a, Integral e) => ASetter s t a a -> e -> s -> t
infixr 4 ^~

-- | Divide the target(s) of a numerically valued <a>Lens</a>, <a>Iso</a>,
--   <a>Setter</a> or <a>Traversal</a>.
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; _1 //~ c
--   (a / c,b)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; both //~ c
--   (a / c,b / c)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; ("Hawaii",10) &amp; _2 //~ 2
--   ("Hawaii",5.0)
--   </pre>
--   
--   <pre>
--   (<a>//~</a>) :: <a>Fractional</a> a =&gt; <a>Setter'</a> s a    -&gt; a -&gt; s -&gt; s
--   (<a>//~</a>) :: <a>Fractional</a> a =&gt; <a>Iso'</a> s a       -&gt; a -&gt; s -&gt; s
--   (<a>//~</a>) :: <a>Fractional</a> a =&gt; <a>Lens'</a> s a      -&gt; a -&gt; s -&gt; s
--   (<a>//~</a>) :: <a>Fractional</a> a =&gt; <a>Traversal'</a> s a -&gt; a -&gt; s -&gt; s
--   </pre>
(//~) :: Fractional a => ASetter s t a a -> a -> s -> t
infixr 4 //~

-- | Decrement the target(s) of a numerically valued <a>Lens</a>,
--   <a>Iso</a>, <a>Setter</a> or <a>Traversal</a>.
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; _1 -~ c
--   (a - c,b)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; both -~ c
--   (a - c,b - c)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; _1 -~ 2 $ (1,2)
--   (-1,2)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; mapped.mapped -~ 1 $ [[4,5],[6,7]]
--   [[3,4],[5,6]]
--   </pre>
--   
--   <pre>
--   (<a>-~</a>) :: <a>Num</a> a =&gt; <a>Setter'</a> s a    -&gt; a -&gt; s -&gt; s
--   (<a>-~</a>) :: <a>Num</a> a =&gt; <a>Iso'</a> s a       -&gt; a -&gt; s -&gt; s
--   (<a>-~</a>) :: <a>Num</a> a =&gt; <a>Lens'</a> s a      -&gt; a -&gt; s -&gt; s
--   (<a>-~</a>) :: <a>Num</a> a =&gt; <a>Traversal'</a> s a -&gt; a -&gt; s -&gt; s
--   </pre>
(-~) :: Num a => ASetter s t a a -> a -> s -> t
infixr 4 -~

-- | Multiply the target(s) of a numerically valued <a>Lens</a>,
--   <a>Iso</a>, <a>Setter</a> or <a>Traversal</a>.
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; _1 *~ c
--   (a * c,b)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; both *~ c
--   (a * c,b * c)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (1,2) &amp; _2 *~ 4
--   (1,8)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Just 24 &amp; mapped *~ 2
--   Just 48
--   </pre>
--   
--   <pre>
--   (<a>*~</a>) :: <a>Num</a> a =&gt; <a>Setter'</a> s a    -&gt; a -&gt; s -&gt; s
--   (<a>*~</a>) :: <a>Num</a> a =&gt; <a>Iso'</a> s a       -&gt; a -&gt; s -&gt; s
--   (<a>*~</a>) :: <a>Num</a> a =&gt; <a>Lens'</a> s a      -&gt; a -&gt; s -&gt; s
--   (<a>*~</a>) :: <a>Num</a> a =&gt; <a>Traversal'</a> s a -&gt; a -&gt; s -&gt; s
--   </pre>
(*~) :: Num a => ASetter s t a a -> a -> s -> t
infixr 4 *~

-- | Increment the target(s) of a numerically valued <a>Lens</a>,
--   <a>Setter</a> or <a>Traversal</a>.
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; _1 +~ c
--   (a + c,b)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; both +~ c
--   (a + c,b + c)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (1,2) &amp; _2 +~ 1
--   (1,3)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [(a,b),(c,d)] &amp; traverse.both +~ e
--   [(a + e,b + e),(c + e,d + e)]
--   </pre>
--   
--   <pre>
--   (<a>+~</a>) :: <a>Num</a> a =&gt; <a>Setter'</a> s a    -&gt; a -&gt; s -&gt; s
--   (<a>+~</a>) :: <a>Num</a> a =&gt; <a>Iso'</a> s a       -&gt; a -&gt; s -&gt; s
--   (<a>+~</a>) :: <a>Num</a> a =&gt; <a>Lens'</a> s a      -&gt; a -&gt; s -&gt; s
--   (<a>+~</a>) :: <a>Num</a> a =&gt; <a>Traversal'</a> s a -&gt; a -&gt; s -&gt; s
--   </pre>
(+~) :: Num a => ASetter s t a a -> a -> s -> t
infixr 4 +~

-- | Set to <a>Just</a> a value with pass-through.
--   
--   This is mostly present for consistency, but may be useful for for
--   chaining assignments.
--   
--   If you do not need a copy of the intermediate result, then using <tt>l
--   <a>?~</a> d</tt> directly is a good idea.
--   
--   <pre>
--   &gt;&gt;&gt; import Data.Map as Map
--   
--   &gt;&gt;&gt; _2.at "hello" &lt;?~ "world" $ (42,Map.fromList [("goodnight","gracie")])
--   ("world",(42,fromList [("goodnight","gracie"),("hello","world")]))
--   </pre>
--   
--   <pre>
--   (<a>&lt;?~</a>) :: <a>Setter</a> s t a (<a>Maybe</a> b)    -&gt; b -&gt; s -&gt; (b, t)
--   (<a>&lt;?~</a>) :: <a>Iso</a> s t a (<a>Maybe</a> b)       -&gt; b -&gt; s -&gt; (b, t)
--   (<a>&lt;?~</a>) :: <a>Lens</a> s t a (<a>Maybe</a> b)      -&gt; b -&gt; s -&gt; (b, t)
--   (<a>&lt;?~</a>) :: <a>Traversal</a> s t a (<a>Maybe</a> b) -&gt; b -&gt; s -&gt; (b, t)
--   </pre>
(<?~) :: () => ASetter s t a Maybe b -> b -> s -> (b, t)
infixr 4 <?~

-- | Set with pass-through.
--   
--   This is mostly present for consistency, but may be useful for chaining
--   assignments.
--   
--   If you do not need a copy of the intermediate result, then using <tt>l
--   <a>.~</a> t</tt> directly is a good idea.
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; _1 &lt;.~ c
--   (c,(c,b))
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; ("good","morning","vietnam") &amp; _3 &lt;.~ "world"
--   ("world",("good","morning","world"))
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (42,Map.fromList [("goodnight","gracie")]) &amp; _2.at "hello" &lt;.~ Just "world"
--   (Just "world",(42,fromList [("goodnight","gracie"),("hello","world")]))
--   </pre>
--   
--   <pre>
--   (<a>&lt;.~</a>) :: <a>Setter</a> s t a b    -&gt; b -&gt; s -&gt; (b, t)
--   (<a>&lt;.~</a>) :: <a>Iso</a> s t a b       -&gt; b -&gt; s -&gt; (b, t)
--   (<a>&lt;.~</a>) :: <a>Lens</a> s t a b      -&gt; b -&gt; s -&gt; (b, t)
--   (<a>&lt;.~</a>) :: <a>Traversal</a> s t a b -&gt; b -&gt; s -&gt; (b, t)
--   </pre>
(<.~) :: () => ASetter s t a b -> b -> s -> (b, t)
infixr 4 <.~

-- | Set the target of a <a>Lens</a>, <a>Traversal</a> or <a>Setter</a> to
--   <a>Just</a> a value.
--   
--   <pre>
--   l <a>?~</a> t ≡ <a>set</a> l (<a>Just</a> t)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Nothing &amp; id ?~ a
--   Just a
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Map.empty &amp; at 3 ?~ x
--   fromList [(3,x)]
--   </pre>
--   
--   <pre>
--   (<a>?~</a>) :: <a>Setter</a> s t a (<a>Maybe</a> b)    -&gt; b -&gt; s -&gt; t
--   (<a>?~</a>) :: <a>Iso</a> s t a (<a>Maybe</a> b)       -&gt; b -&gt; s -&gt; t
--   (<a>?~</a>) :: <a>Lens</a> s t a (<a>Maybe</a> b)      -&gt; b -&gt; s -&gt; t
--   (<a>?~</a>) :: <a>Traversal</a> s t a (<a>Maybe</a> b) -&gt; b -&gt; s -&gt; t
--   </pre>
(?~) :: () => ASetter s t a Maybe b -> b -> s -> t
infixr 4 ?~

-- | Replace the target of a <a>Lens</a> or all of the targets of a
--   <a>Setter</a> or <a>Traversal</a> with a constant value.
--   
--   This is an infix version of <a>set</a>, provided for consistency with
--   (<a>.=</a>).
--   
--   <pre>
--   f <a>&lt;$</a> a ≡ <a>mapped</a> <a>.~</a> f <a>$</a> a
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (a,b,c,d) &amp; _4 .~ e
--   (a,b,c,e)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (42,"world") &amp; _1 .~ "hello"
--   ("hello","world")
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; both .~ c
--   (c,c)
--   </pre>
--   
--   <pre>
--   (<a>.~</a>) :: <a>Setter</a> s t a b    -&gt; b -&gt; s -&gt; t
--   (<a>.~</a>) :: <a>Iso</a> s t a b       -&gt; b -&gt; s -&gt; t
--   (<a>.~</a>) :: <a>Lens</a> s t a b      -&gt; b -&gt; s -&gt; t
--   (<a>.~</a>) :: <a>Traversal</a> s t a b -&gt; b -&gt; s -&gt; t
--   </pre>
(.~) :: () => ASetter s t a b -> b -> s -> t
infixr 4 .~

-- | Modifies the target of a <a>Lens</a> or all of the targets of a
--   <a>Setter</a> or <a>Traversal</a> with a user supplied function.
--   
--   This is an infix version of <a>over</a>.
--   
--   <pre>
--   <a>fmap</a> f ≡ <a>mapped</a> <a>%~</a> f
--   <a>fmapDefault</a> f ≡ <a>traverse</a> <a>%~</a> f
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (a,b,c) &amp; _3 %~ f
--   (a,b,f c)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (a,b) &amp; both %~ f
--   (f a,f b)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; _2 %~ length $ (1,"hello")
--   (1,5)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; traverse %~ f $ [a,b,c]
--   [f a,f b,f c]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; traverse %~ even $ [1,2,3]
--   [False,True,False]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; traverse.traverse %~ length $ [["hello","world"],["!!!"]]
--   [[5,5],[3]]
--   </pre>
--   
--   <pre>
--   (<a>%~</a>) :: <a>Setter</a> s t a b    -&gt; (a -&gt; b) -&gt; s -&gt; t
--   (<a>%~</a>) :: <a>Iso</a> s t a b       -&gt; (a -&gt; b) -&gt; s -&gt; t
--   (<a>%~</a>) :: <a>Lens</a> s t a b      -&gt; (a -&gt; b) -&gt; s -&gt; t
--   (<a>%~</a>) :: <a>Traversal</a> s t a b -&gt; (a -&gt; b) -&gt; s -&gt; t
--   </pre>
(%~) :: () => ASetter s t a b -> a -> b -> s -> t
infixr 4 %~

-- | Replace the target of a <a>Lens</a> or all of the targets of a
--   <a>Setter'</a> or <a>Traversal</a> with a constant value, without
--   changing its type.
--   
--   This is a type restricted version of <a>set</a>, which retains the
--   type of the original.
--   
--   <pre>
--   &gt;&gt;&gt; set' mapped x [a,b,c,d]
--   [x,x,x,x]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; set' _2 "hello" (1,"world")
--   (1,"hello")
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; set' mapped 0 [1,2,3,4]
--   [0,0,0,0]
--   </pre>
--   
--   Note: Attempting to adjust <a>set'</a> a <a>Fold</a> or <a>Getter</a>
--   will fail at compile time with an relatively nice error message.
--   
--   <pre>
--   <a>set'</a> :: <a>Setter'</a> s a    -&gt; a -&gt; s -&gt; s
--   <a>set'</a> :: <a>Iso'</a> s a       -&gt; a -&gt; s -&gt; s
--   <a>set'</a> :: <a>Lens'</a> s a      -&gt; a -&gt; s -&gt; s
--   <a>set'</a> :: <a>Traversal'</a> s a -&gt; a -&gt; s -&gt; s
--   </pre>
set' :: () => ASetter' s a -> a -> s -> s

-- | Replace the target of a <a>Lens</a> or all of the targets of a
--   <a>Setter</a> or <a>Traversal</a> with a constant value.
--   
--   <pre>
--   (<a>&lt;$</a>) ≡ <a>set</a> <a>mapped</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; set _2 "hello" (1,())
--   (1,"hello")
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; set mapped () [1,2,3,4]
--   [(),(),(),()]
--   </pre>
--   
--   Note: Attempting to <a>set</a> a <a>Fold</a> or <a>Getter</a> will
--   fail at compile time with an relatively nice error message.
--   
--   <pre>
--   <a>set</a> :: <a>Setter</a> s t a b    -&gt; b -&gt; s -&gt; t
--   <a>set</a> :: <a>Iso</a> s t a b       -&gt; b -&gt; s -&gt; t
--   <a>set</a> :: <a>Lens</a> s t a b      -&gt; b -&gt; s -&gt; t
--   <a>set</a> :: <a>Traversal</a> s t a b -&gt; b -&gt; s -&gt; t
--   </pre>
set :: () => ASetter s t a b -> b -> s -> t

-- | Modify the target of a <a>Lens</a> or all the targets of a
--   <a>Setter</a> or <a>Traversal</a> with a function.
--   
--   <pre>
--   <a>fmap</a> ≡ <a>over</a> <a>mapped</a>
--   <a>fmapDefault</a> ≡ <a>over</a> <a>traverse</a>
--   <a>sets</a> <a>.</a> <a>over</a> ≡ <a>id</a>
--   <a>over</a> <a>.</a> <a>sets</a> ≡ <a>id</a>
--   </pre>
--   
--   Given any valid <a>Setter</a> <tt>l</tt>, you can also rely on the
--   law:
--   
--   <pre>
--   <a>over</a> l f <a>.</a> <a>over</a> l g = <a>over</a> l (f <a>.</a> g)
--   </pre>
--   
--   <i>e.g.</i>
--   
--   <pre>
--   &gt;&gt;&gt; over mapped f (over mapped g [a,b,c]) == over mapped (f . g) [a,b,c]
--   True
--   </pre>
--   
--   Another way to view <a>over</a> is to say that it transforms a
--   <a>Setter</a> into a "semantic editor combinator".
--   
--   <pre>
--   &gt;&gt;&gt; over mapped f (Just a)
--   Just (f a)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; over mapped (*10) [1,2,3]
--   [10,20,30]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; over _1 f (a,b)
--   (f a,b)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; over _1 show (10,20)
--   ("10",20)
--   </pre>
--   
--   <pre>
--   <a>over</a> :: <a>Setter</a> s t a b -&gt; (a -&gt; b) -&gt; s -&gt; t
--   <a>over</a> :: <a>ASetter</a> s t a b -&gt; (a -&gt; b) -&gt; s -&gt; t
--   </pre>
over :: () => ASetter s t a b -> a -> b -> s -> t

-- | Clone an <a>IndexedSetter</a>.
cloneIndexedSetter :: () => AnIndexedSetter i s t a b -> IndexedSetter i s t a b

-- | Build an <a>IndexPreservingSetter</a> from any <a>Setter</a>.
cloneIndexPreservingSetter :: () => ASetter s t a b -> IndexPreservingSetter s t a b

-- | Restore <a>ASetter</a> to a full <a>Setter</a>.
cloneSetter :: () => ASetter s t a b -> Setter s t a b

-- | Build a <a>Setter</a>, <a>IndexedSetter</a> or
--   <a>IndexPreservingSetter</a> depending on your choice of
--   <a>Profunctor</a>.
--   
--   <pre>
--   <a>sets</a> :: ((a -&gt; b) -&gt; s -&gt; t) -&gt; <a>Setter</a> s t a b
--   </pre>
sets :: (Profunctor p, Profunctor q, Settable f) => p a b -> q s t -> Optical p q f s t a b

-- | Build an index-preserving <a>Setter</a> from a map-like function.
--   
--   Your supplied function <tt>f</tt> is required to satisfy:
--   
--   <pre>
--   f <a>id</a> ≡ <a>id</a>
--   f g <a>.</a> f h ≡ f (g <a>.</a> h)
--   </pre>
--   
--   Equational reasoning:
--   
--   <pre>
--   <a>setting</a> <a>.</a> <a>over</a> ≡ <a>id</a>
--   <a>over</a> <a>.</a> <a>setting</a> ≡ <a>id</a>
--   </pre>
--   
--   Another way to view <a>sets</a> is that it takes a "semantic editor
--   combinator" and transforms it into a <a>Setter</a>.
--   
--   <pre>
--   <a>setting</a> :: ((a -&gt; b) -&gt; s -&gt; t) -&gt; <a>Setter</a> s t a b
--   </pre>
setting :: () => a -> b -> s -> t -> IndexPreservingSetter s t a b

-- | This <a>Setter</a> can be used to map over the input of a
--   <a>Profunctor</a>.
--   
--   The most common <a>Profunctor</a> to use this with is
--   <tt>(-&gt;)</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; (argument %~ f) g x
--   g (f x)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (argument %~ show) length [1,2,3]
--   7
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (argument %~ f) h x y
--   h (f x) y
--   </pre>
--   
--   Map over the argument of the result of a function -- i.e., its second
--   argument:
--   
--   <pre>
--   &gt;&gt;&gt; (mapped.argument %~ f) h x y
--   h x (f y)
--   </pre>
--   
--   <pre>
--   <a>argument</a> :: <a>Setter</a> (b -&gt; r) (a -&gt; r) a b
--   </pre>
argument :: Profunctor p => Setter p b r p a r a b

-- | This <a>Setter</a> can be used to map over all of the inputs to a
--   <a>Contravariant</a>.
--   
--   <pre>
--   <a>contramap</a> ≡ <a>over</a> <a>contramapped</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; getPredicate (over contramapped (*2) (Predicate even)) 5
--   True
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; getOp (over contramapped (*5) (Op show)) 100
--   "500"
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; Prelude.map ($ 1) $ over (mapped . _Unwrapping' Op . contramapped) (*12) [(*2),(+1),(^3)]
--   [24,13,1728]
--   </pre>
contramapped :: Contravariant f => Setter f b f a a b

-- | This <tt>setter</tt> can be used to modify all of the values in a
--   <a>Monad</a>.
--   
--   You sometimes have to use this rather than <a>mapped</a> -- due to
--   temporary insanity <a>Functor</a> was not a superclass of <a>Monad</a>
--   until GHC 7.10.
--   
--   <pre>
--   <a>liftM</a> ≡ <a>over</a> <a>lifted</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; over lifted f [a,b,c]
--   [f a,f b,f c]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; set lifted b (Just a)
--   Just b
--   </pre>
--   
--   If you want an <a>IndexPreservingSetter</a> use <tt><a>setting</a>
--   <a>liftM</a></tt>.
lifted :: Monad m => Setter m a m b a b

-- | This <a>Setter</a> can be used to map over all of the values in a
--   <a>Functor</a>.
--   
--   <pre>
--   <a>fmap</a> ≡ <a>over</a> <a>mapped</a>
--   <a>fmapDefault</a> ≡ <a>over</a> <a>traverse</a>
--   (<a>&lt;$</a>) ≡ <a>set</a> <a>mapped</a>
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; over mapped f [a,b,c]
--   [f a,f b,f c]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; over mapped (+1) [1,2,3]
--   [2,3,4]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; set mapped x [a,b,c]
--   [x,x,x]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [[a,b],[c]] &amp; mapped.mapped +~ x
--   [[a + x,b + x],[c + x]]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; over (mapped._2) length [("hello","world"),("leaders","!!!")]
--   [("hello",5),("leaders",3)]
--   </pre>
--   
--   <pre>
--   <a>mapped</a> :: <a>Functor</a> f =&gt; <a>Setter</a> (f a) (f b) a b
--   </pre>
--   
--   If you want an <a>IndexPreservingSetter</a> use <tt><a>setting</a>
--   <a>fmap</a></tt>.
mapped :: Functor f => Setter f a f b a b

-- | Running a <a>Setter</a> instantiates it to a concrete type.
--   
--   When consuming a setter directly to perform a mapping, you can use
--   this type, but most user code will not need to use this type.
type ASetter s t a b = a -> Identity b -> s -> Identity t

-- | This is a useful alias for use when consuming a <a>Setter'</a>.
--   
--   Most user code will never have to use this type.
--   
--   <pre>
--   type <a>ASetter'</a> = <a>Simple</a> <a>ASetter</a>
--   </pre>
type ASetter' s a = ASetter s s a a

-- | Running an <a>IndexedSetter</a> instantiates it to a concrete type.
--   
--   When consuming a setter directly to perform a mapping, you can use
--   this type, but most user code will not need to use this type.
type AnIndexedSetter i s t a b = Indexed i a Identity b -> s -> Identity t

-- | <pre>
--   type <a>AnIndexedSetter'</a> i = <a>Simple</a> (<a>AnIndexedSetter</a> i)
--   </pre>
type AnIndexedSetter' i s a = AnIndexedSetter i s s a a

-- | This is a convenient alias when defining highly polymorphic code that
--   takes both <a>ASetter</a> and <a>AnIndexedSetter</a> as appropriate.
--   If a function takes this it is expecting one of those two things based
--   on context.
type Setting (p :: * -> * -> *) s t a b = p a Identity b -> s -> Identity t

-- | This is a convenient alias when defining highly polymorphic code that
--   takes both <a>ASetter'</a> and <a>AnIndexedSetter'</a> as appropriate.
--   If a function takes this it is expecting one of those two things based
--   on context.
type Setting' (p :: * -> * -> *) s a = Setting p s s a a

-- | A <a>Lens</a> is actually a lens family as described in
--   <a>http://comonad.com/reader/2012/mirrored-lenses/</a>.
--   
--   With great power comes great responsibility and a <a>Lens</a> is
--   subject to the three common sense <a>Lens</a> laws:
--   
--   1) You get back what you put in:
--   
--   <pre>
--   <a>view</a> l (<a>set</a> l v s)  ≡ v
--   </pre>
--   
--   2) Putting back what you got doesn't change anything:
--   
--   <pre>
--   <a>set</a> l (<a>view</a> l s) s  ≡ s
--   </pre>
--   
--   3) Setting twice is the same as setting once:
--   
--   <pre>
--   <a>set</a> l v' (<a>set</a> l v s) ≡ <a>set</a> l v' s
--   </pre>
--   
--   These laws are strong enough that the 4 type parameters of a
--   <a>Lens</a> cannot vary fully independently. For more on how they
--   interact, read the "Why is it a Lens Family?" section of
--   <a>http://comonad.com/reader/2012/mirrored-lenses/</a>.
--   
--   There are some emergent properties of these laws:
--   
--   1) <tt><a>set</a> l s</tt> must be injective for every <tt>s</tt> This
--   is a consequence of law #1
--   
--   2) <tt><a>set</a> l</tt> must be surjective, because of law #2, which
--   indicates that it is possible to obtain any <tt>v</tt> from some
--   <tt>s</tt> such that <tt><a>set</a> s v = s</tt>
--   
--   3) Given just the first two laws you can prove a weaker form of law #3
--   where the values <tt>v</tt> that you are setting match:
--   
--   <pre>
--   <a>set</a> l v (<a>set</a> l v s) ≡ <a>set</a> l v s
--   </pre>
--   
--   Every <a>Lens</a> can be used directly as a <a>Setter</a> or
--   <a>Traversal</a>.
--   
--   You can also use a <a>Lens</a> for <a>Getting</a> as if it were a
--   <a>Fold</a> or <a>Getter</a>.
--   
--   Since every <a>Lens</a> is a valid <a>Traversal</a>, the
--   <a>Traversal</a> laws are required of any <a>Lens</a> you create:
--   
--   <pre>
--   l <a>pure</a> ≡ <a>pure</a>
--   <a>fmap</a> (l f) <tt>.</tt> l g ≡ <a>getCompose</a> <tt>.</tt> l (<a>Compose</a> <tt>.</tt> <a>fmap</a> f <tt>.</tt> g)
--   </pre>
--   
--   <pre>
--   type <a>Lens</a> s t a b = forall f. <a>Functor</a> f =&gt; <a>LensLike</a> f s t a b
--   </pre>
type Lens s t a b = forall (f :: * -> *). Functor f => a -> f b -> s -> f t

-- | <pre>
--   type <a>Lens'</a> = <a>Simple</a> <a>Lens</a>
--   </pre>
type Lens' s a = Lens s s a a

-- | Every <a>IndexedLens</a> is a valid <a>Lens</a> and a valid
--   <a>IndexedTraversal</a>.
type IndexedLens i s t a b = forall (f :: * -> *) (p :: * -> * -> *). (Indexable i p, Functor f) => p a f b -> s -> f t

-- | <pre>
--   type <a>IndexedLens'</a> i = <a>Simple</a> (<a>IndexedLens</a> i)
--   </pre>
type IndexedLens' i s a = IndexedLens i s s a a

-- | An <a>IndexPreservingLens</a> leaves any index it is composed with
--   alone.
type IndexPreservingLens s t a b = forall (p :: * -> * -> *) (f :: * -> *). (Conjoined p, Functor f) => p a f b -> p s f t

-- | <pre>
--   type <a>IndexPreservingLens'</a> = <a>Simple</a> <a>IndexPreservingLens</a>
--   </pre>
type IndexPreservingLens' s a = IndexPreservingLens s s a a

-- | A <a>Traversal</a> can be used directly as a <a>Setter</a> or a
--   <a>Fold</a> (but not as a <a>Lens</a>) and provides the ability to
--   both read and update multiple fields, subject to some relatively weak
--   <a>Traversal</a> laws.
--   
--   These have also been known as multilenses, but they have the signature
--   and spirit of
--   
--   <pre>
--   <a>traverse</a> :: <a>Traversable</a> f =&gt; <a>Traversal</a> (f a) (f b) a b
--   </pre>
--   
--   and the more evocative name suggests their application.
--   
--   Most of the time the <a>Traversal</a> you will want to use is just
--   <a>traverse</a>, but you can also pass any <a>Lens</a> or <a>Iso</a>
--   as a <a>Traversal</a>, and composition of a <a>Traversal</a> (or
--   <a>Lens</a> or <a>Iso</a>) with a <a>Traversal</a> (or <a>Lens</a> or
--   <a>Iso</a>) using (<tt>.</tt>) forms a valid <a>Traversal</a>.
--   
--   The laws for a <a>Traversal</a> <tt>t</tt> follow from the laws for
--   <a>Traversable</a> as stated in "The Essence of the Iterator Pattern".
--   
--   <pre>
--   t <a>pure</a> ≡ <a>pure</a>
--   <a>fmap</a> (t f) <tt>.</tt> t g ≡ <a>getCompose</a> <tt>.</tt> t (<a>Compose</a> <tt>.</tt> <a>fmap</a> f <tt>.</tt> g)
--   </pre>
--   
--   One consequence of this requirement is that a <a>Traversal</a> needs
--   to leave the same number of elements as a candidate for subsequent
--   <a>Traversal</a> that it started with. Another testament to the
--   strength of these laws is that the caveat expressed in section 5.5 of
--   the "Essence of the Iterator Pattern" about exotic <a>Traversable</a>
--   instances that <a>traverse</a> the same entry multiple times was
--   actually already ruled out by the second law in that same paper!
type Traversal s t a b = forall (f :: * -> *). Applicative f => a -> f b -> s -> f t

-- | <pre>
--   type <a>Traversal'</a> = <a>Simple</a> <a>Traversal</a>
--   </pre>
type Traversal' s a = Traversal s s a a
type Traversal1 s t a b = forall (f :: * -> *). Apply f => a -> f b -> s -> f t
type Traversal1' s a = Traversal1 s s a a

-- | Every <a>IndexedTraversal</a> is a valid <a>Traversal</a> or
--   <a>IndexedFold</a>.
--   
--   The <a>Indexed</a> constraint is used to allow an
--   <a>IndexedTraversal</a> to be used directly as a <a>Traversal</a>.
--   
--   The <a>Traversal</a> laws are still required to hold.
--   
--   In addition, the index <tt>i</tt> should satisfy the requirement that
--   it stays unchanged even when modifying the value <tt>a</tt>, otherwise
--   traversals like <tt>indices</tt> break the <a>Traversal</a> laws.
type IndexedTraversal i s t a b = forall (p :: * -> * -> *) (f :: * -> *). (Indexable i p, Applicative f) => p a f b -> s -> f t

-- | <pre>
--   type <a>IndexedTraversal'</a> i = <a>Simple</a> (<a>IndexedTraversal</a> i)
--   </pre>
type IndexedTraversal' i s a = IndexedTraversal i s s a a
type IndexedTraversal1 i s t a b = forall (p :: * -> * -> *) (f :: * -> *). (Indexable i p, Apply f) => p a f b -> s -> f t
type IndexedTraversal1' i s a = IndexedTraversal1 i s s a a

-- | An <a>IndexPreservingLens</a> leaves any index it is composed with
--   alone.
type IndexPreservingTraversal s t a b = forall (p :: * -> * -> *) (f :: * -> *). (Conjoined p, Applicative f) => p a f b -> p s f t

-- | <pre>
--   type <a>IndexPreservingTraversal'</a> = <a>Simple</a> <a>IndexPreservingTraversal</a>
--   </pre>
type IndexPreservingTraversal' s a = IndexPreservingTraversal s s a a
type IndexPreservingTraversal1 s t a b = forall (p :: * -> * -> *) (f :: * -> *). (Conjoined p, Apply f) => p a f b -> p s f t
type IndexPreservingTraversal1' s a = IndexPreservingTraversal1 s s a a

-- | The only <a>LensLike</a> law that can apply to a <a>Setter</a>
--   <tt>l</tt> is that
--   
--   <pre>
--   <a>set</a> l y (<a>set</a> l x a) ≡ <a>set</a> l y a
--   </pre>
--   
--   You can't <a>view</a> a <a>Setter</a> in general, so the other two
--   laws are irrelevant.
--   
--   However, two <a>Functor</a> laws apply to a <a>Setter</a>:
--   
--   <pre>
--   <a>over</a> l <tt>id</tt> ≡ <tt>id</tt>
--   <a>over</a> l f <tt>.</tt> <a>over</a> l g ≡ <a>over</a> l (f <tt>.</tt> g)
--   </pre>
--   
--   These can be stated more directly:
--   
--   <pre>
--   l <a>pure</a> ≡ <a>pure</a>
--   l f <tt>.</tt> <a>untainted</a> <tt>.</tt> l g ≡ l (f <tt>.</tt> <a>untainted</a> <tt>.</tt> g)
--   </pre>
--   
--   You can compose a <a>Setter</a> with a <a>Lens</a> or a
--   <a>Traversal</a> using (<tt>.</tt>) from the <tt>Prelude</tt> and the
--   result is always only a <a>Setter</a> and nothing more.
--   
--   <pre>
--   &gt;&gt;&gt; over traverse f [a,b,c,d]
--   [f a,f b,f c,f d]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; over _1 f (a,b)
--   (f a,b)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; over (traverse._1) f [(a,b),(c,d)]
--   [(f a,b),(f c,d)]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; over both f (a,b)
--   (f a,f b)
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; over (traverse.both) f [(a,b),(c,d)]
--   [(f a,f b),(f c,f d)]
--   </pre>
type Setter s t a b = forall (f :: * -> *). Settable f => a -> f b -> s -> f t

-- | A <a>Setter'</a> is just a <a>Setter</a> that doesn't change the
--   types.
--   
--   These are particularly common when talking about monomorphic
--   containers. <i>e.g.</i>
--   
--   <pre>
--   <tt>sets</tt> Data.Text.map :: <a>Setter'</a> <a>Text</a> <tt>Char</tt>
--   </pre>
--   
--   <pre>
--   type <a>Setter'</a> = <a>Simple</a> <a>Setter</a>
--   </pre>
type Setter' s a = Setter s s a a

-- | Every <a>IndexedSetter</a> is a valid <a>Setter</a>.
--   
--   The <a>Setter</a> laws are still required to hold.
type IndexedSetter i s t a b = forall (f :: * -> *) (p :: * -> * -> *). (Indexable i p, Settable f) => p a f b -> s -> f t

-- | <pre>
--   type <a>IndexedSetter'</a> i = <a>Simple</a> (<a>IndexedSetter</a> i)
--   </pre>
type IndexedSetter' i s a = IndexedSetter i s s a a

-- | An <a>IndexPreservingSetter</a> can be composed with a
--   <a>IndexedSetter</a>, <a>IndexedTraversal</a> or <a>IndexedLens</a>
--   and leaves the index intact, yielding an <a>IndexedSetter</a>.
type IndexPreservingSetter s t a b = forall (p :: * -> * -> *) (f :: * -> *). (Conjoined p, Settable f) => p a f b -> p s f t

-- | <pre>
--   type <tt>IndexedPreservingSetter'</tt> i = <a>Simple</a> <tt>IndexedPreservingSetter</tt>
--   </pre>
type IndexPreservingSetter' s a = IndexPreservingSetter s s a a

-- | Isomorphism families can be composed with another <a>Lens</a> using
--   (<tt>.</tt>) and <tt>id</tt>.
--   
--   Since every <a>Iso</a> is both a valid <a>Lens</a> and a valid
--   <a>Prism</a>, the laws for those types imply the following laws for an
--   <a>Iso</a> <tt>f</tt>:
--   
--   <pre>
--   f <tt>.</tt> <a>from</a> f ≡ <tt>id</tt>
--   <a>from</a> f <tt>.</tt> f ≡ <tt>id</tt>
--   </pre>
--   
--   Note: Composition with an <a>Iso</a> is index- and measure-
--   preserving.
type Iso s t a b = forall (p :: * -> * -> *) (f :: * -> *). (Profunctor p, Functor f) => p a f b -> p s f t

-- | <pre>
--   type <a>Iso'</a> = <a>Simple</a> <a>Iso</a>
--   </pre>
type Iso' s a = Iso s s a a

-- | This is a limited form of a <a>Prism</a> that can only be used for
--   <tt>re</tt> operations.
--   
--   Like with a <a>Getter</a>, there are no laws to state for a
--   <a>Review</a>.
--   
--   You can generate a <a>Review</a> by using <tt>unto</tt>. You can also
--   use any <a>Prism</a> or <a>Iso</a> directly as a <a>Review</a>.
type Review t b = forall (p :: * -> * -> *) (f :: * -> *). (Choice p, Bifunctor p, Settable f) => Optic' p f t b

-- | If you see this in a signature for a function, the function is
--   expecting a <a>Review</a> (in practice, this usually means a
--   <a>Prism</a>).
type AReview t b = Optic' (Tagged :: * -> * -> *) Identity t b

-- | A <a>Prism</a> <tt>l</tt> is a <a>Traversal</a> that can also be
--   turned around with <a>re</a> to obtain a <a>Getter</a> in the opposite
--   direction.
--   
--   There are two laws that a <a>Prism</a> should satisfy:
--   
--   First, if I <a>re</a> or <a>review</a> a value with a <a>Prism</a> and
--   then <a>preview</a> or use (<a>^?</a>), I will get it back:
--   
--   <pre>
--   <a>preview</a> l (<a>review</a> l b) ≡ <tt>Just</tt> b
--   </pre>
--   
--   Second, if you can extract a value <tt>a</tt> using a <a>Prism</a>
--   <tt>l</tt> from a value <tt>s</tt>, then the value <tt>s</tt> is
--   completely described by <tt>l</tt> and <tt>a</tt>:
--   
--   If <tt><a>preview</a> l s ≡ <tt>Just</tt> a</tt> then
--   <tt><a>review</a> l a ≡ s</tt>
--   
--   These two laws imply that the <a>Traversal</a> laws hold for every
--   <a>Prism</a> and that we <a>traverse</a> at most 1 element:
--   
--   <pre>
--   <a>lengthOf</a> l x <tt>&lt;=</tt> 1
--   </pre>
--   
--   It may help to think of this as a <a>Iso</a> that can be partial in
--   one direction.
--   
--   Every <a>Prism</a> is a valid <a>Traversal</a>.
--   
--   Every <a>Iso</a> is a valid <a>Prism</a>.
--   
--   For example, you might have a <tt><a>Prism'</a> <tt>Integer</tt>
--   <a>Natural</a></tt> allows you to always go from a <a>Natural</a> to
--   an <tt>Integer</tt>, and provide you with tools to check if an
--   <tt>Integer</tt> is a <a>Natural</a> and/or to edit one if it is.
--   
--   <pre>
--   <tt>nat</tt> :: <a>Prism'</a> <tt>Integer</tt> <a>Natural</a>
--   <tt>nat</tt> = <a>prism</a> <tt>toInteger</tt> <tt>$</tt> \ i -&gt;
--      if i <tt>&lt;</tt> 0
--      then <tt>Left</tt> i
--      else <tt>Right</tt> (<tt>fromInteger</tt> i)
--   </pre>
--   
--   Now we can ask if an <tt>Integer</tt> is a <a>Natural</a>.
--   
--   <pre>
--   &gt;&gt;&gt; 5^?nat
--   Just 5
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; (-5)^?nat
--   Nothing
--   </pre>
--   
--   We can update the ones that are:
--   
--   <pre>
--   &gt;&gt;&gt; (-3,4) &amp; both.nat *~ 2
--   (-3,8)
--   </pre>
--   
--   And we can then convert from a <a>Natural</a> to an <tt>Integer</tt>.
--   
--   <pre>
--   &gt;&gt;&gt; 5 ^. re nat -- :: Natural
--   5
--   </pre>
--   
--   Similarly we can use a <a>Prism</a> to <a>traverse</a> the
--   <tt>Left</tt> half of an <tt>Either</tt>:
--   
--   <pre>
--   &gt;&gt;&gt; Left "hello" &amp; _Left %~ length
--   Left 5
--   </pre>
--   
--   or to construct an <tt>Either</tt>:
--   
--   <pre>
--   &gt;&gt;&gt; 5^.re _Left
--   Left 5
--   </pre>
--   
--   such that if you query it with the <a>Prism</a>, you will get your
--   original input back.
--   
--   <pre>
--   &gt;&gt;&gt; 5^.re _Left ^? _Left
--   Just 5
--   </pre>
--   
--   Another interesting way to think of a <a>Prism</a> is as the
--   categorical dual of a <a>Lens</a> -- a co-<a>Lens</a>, so to speak.
--   This is what permits the construction of <a>outside</a>.
--   
--   Note: Composition with a <a>Prism</a> is index-preserving.
type Prism s t a b = forall (p :: * -> * -> *) (f :: * -> *). (Choice p, Applicative f) => p a f b -> p s f t

-- | A <a>Simple</a> <a>Prism</a>.
type Prism' s a = Prism s s a a

-- | A witness that <tt>(a ~ s, b ~ t)</tt>.
--   
--   Note: Composition with an <a>Equality</a> is index-preserving.
type Equality (s :: k1) (t :: k2) (a :: k1) (b :: k2) = forall k3 (p :: k1 -> k3 -> *) (f :: k2 -> k3). () => p a f b -> p s f t

-- | A <a>Simple</a> <a>Equality</a>.
type Equality' (s :: k2) (a :: k2) = Equality s s a a

-- | Composable <tt>asTypeOf</tt>. Useful for constraining excess
--   polymorphism, <tt>foo . (id :: As Int) . bar</tt>.
type As (a :: k2) = Equality' a a

-- | A <a>Getter</a> describes how to retrieve a single value in a way that
--   can be composed with other <a>LensLike</a> constructions.
--   
--   Unlike a <a>Lens</a> a <a>Getter</a> is read-only. Since a
--   <a>Getter</a> cannot be used to write back there are no <a>Lens</a>
--   laws that can be applied to it. In fact, it is isomorphic to an
--   arbitrary function from <tt>(s -&gt; a)</tt>.
--   
--   Moreover, a <a>Getter</a> can be used directly as a <a>Fold</a>, since
--   it just ignores the <a>Applicative</a>.
type Getter s a = forall (f :: * -> *). (Contravariant f, Functor f) => a -> f a -> s -> f s

-- | Every <a>IndexedGetter</a> is a valid <a>IndexedFold</a> and can be
--   used for <a>Getting</a> like a <a>Getter</a>.
type IndexedGetter i s a = forall (p :: * -> * -> *) (f :: * -> *). (Indexable i p, Contravariant f, Functor f) => p a f a -> s -> f s

-- | An <a>IndexPreservingGetter</a> can be used as a <a>Getter</a>, but
--   when composed with an <a>IndexedTraversal</a>, <a>IndexedFold</a>, or
--   <a>IndexedLens</a> yields an <a>IndexedFold</a>, <a>IndexedFold</a> or
--   <a>IndexedGetter</a> respectively.
type IndexPreservingGetter s a = forall (p :: * -> * -> *) (f :: * -> *). (Conjoined p, Contravariant f, Functor f) => p a f a -> p s f s

-- | A <a>Fold</a> describes how to retrieve multiple values in a way that
--   can be composed with other <a>LensLike</a> constructions.
--   
--   A <tt><a>Fold</a> s a</tt> provides a structure with operations very
--   similar to those of the <a>Foldable</a> typeclass, see
--   <a>foldMapOf</a> and the other <a>Fold</a> combinators.
--   
--   By convention, if there exists a <tt>foo</tt> method that expects a
--   <tt><a>Foldable</a> (f a)</tt>, then there should be a <tt>fooOf</tt>
--   method that takes a <tt><a>Fold</a> s a</tt> and a value of type
--   <tt>s</tt>.
--   
--   A <a>Getter</a> is a legal <a>Fold</a> that just ignores the supplied
--   <a>Monoid</a>.
--   
--   Unlike a <a>Traversal</a> a <a>Fold</a> is read-only. Since a
--   <a>Fold</a> cannot be used to write back there are no <a>Lens</a> laws
--   that apply.
type Fold s a = forall (f :: * -> *). (Contravariant f, Applicative f) => a -> f a -> s -> f s

-- | Every <a>IndexedFold</a> is a valid <a>Fold</a> and can be used for
--   <a>Getting</a>.
type IndexedFold i s a = forall (p :: * -> * -> *) (f :: * -> *). (Indexable i p, Contravariant f, Applicative f) => p a f a -> s -> f s

-- | An <a>IndexPreservingFold</a> can be used as a <a>Fold</a>, but when
--   composed with an <a>IndexedTraversal</a>, <a>IndexedFold</a>, or
--   <a>IndexedLens</a> yields an <a>IndexedFold</a> respectively.
type IndexPreservingFold s a = forall (p :: * -> * -> *) (f :: * -> *). (Conjoined p, Contravariant f, Applicative f) => p a f a -> p s f s

-- | A relevant Fold (aka <a>Fold1</a>) has one or more targets.
type Fold1 s a = forall (f :: * -> *). (Contravariant f, Apply f) => a -> f a -> s -> f s
type IndexedFold1 i s a = forall (p :: * -> * -> *) (f :: * -> *). (Indexable i p, Contravariant f, Apply f) => p a f a -> s -> f s
type IndexPreservingFold1 s a = forall (p :: * -> * -> *) (f :: * -> *). (Conjoined p, Contravariant f, Apply f) => p a f a -> p s f s

-- | A <a>Simple</a> <a>Lens</a>, <a>Simple</a> <a>Traversal</a>, ... can
--   be used instead of a <a>Lens</a>,<a>Traversal</a>, ... whenever the
--   type variables don't change upon setting a value.
--   
--   <pre>
--   <a>_imagPart</a> :: <a>Simple</a> <a>Lens</a> (<a>Complex</a> a) a
--   <a>traversed</a> :: <a>Simple</a> (<a>IndexedTraversal</a> <tt>Int</tt>) [a] a
--   </pre>
--   
--   Note: To use this alias in your own code with <tt><a>LensLike</a>
--   f</tt> or <a>Setter</a>, you may have to turn on
--   <tt>LiberalTypeSynonyms</tt>.
--   
--   This is commonly abbreviated as a "prime" marker, <i>e.g.</i>
--   <a>Lens'</a> = <a>Simple</a> <a>Lens</a>.
type Simple (f :: k -> k -> k1 -> k1 -> k2) (s :: k) (a :: k1) = f s s a a

-- | A valid <a>Optic</a> <tt>l</tt> should satisfy the laws:
--   
--   <pre>
--   l <a>pure</a> ≡ <a>pure</a>
--   l (<tt>Procompose</tt> f g) = <tt>Procompose</tt> (l f) (l g)
--   </pre>
--   
--   This gives rise to the laws for <a>Equality</a>, <a>Iso</a>,
--   <a>Prism</a>, <a>Lens</a>, <a>Traversal</a>, <a>Traversal1</a>,
--   <a>Setter</a>, <a>Fold</a>, <a>Fold1</a>, and <a>Getter</a> as well
--   along with their index-preserving variants.
--   
--   <pre>
--   type <a>LensLike</a> f s t a b = <a>Optic</a> (-&gt;) f s t a b
--   </pre>
type Optic (p :: k1 -> k -> *) (f :: k2 -> k) (s :: k1) (t :: k2) (a :: k1) (b :: k2) = p a f b -> p s f t

-- | <pre>
--   type <a>Optic'</a> p f s a = <a>Simple</a> (<a>Optic</a> p f) s a
--   </pre>
type Optic' (p :: k1 -> k -> *) (f :: k1 -> k) (s :: k1) (a :: k1) = Optic p f s s a a

-- | <pre>
--   type <a>LensLike</a> f s t a b = <a>Optical</a> (-&gt;) (-&gt;) f s t a b
--   </pre>
--   
--   <pre>
--   type <a>Over</a> p f s t a b = <a>Optical</a> p (-&gt;) f s t a b
--   </pre>
--   
--   <pre>
--   type <a>Optic</a> p f s t a b = <a>Optical</a> p p f s t a b
--   </pre>
type Optical (p :: k2 -> k -> *) (q :: k1 -> k -> *) (f :: k3 -> k) (s :: k1) (t :: k3) (a :: k2) (b :: k3) = p a f b -> q s f t

-- | <pre>
--   type <a>Optical'</a> p q f s a = <a>Simple</a> (<a>Optical</a> p q f) s a
--   </pre>
type Optical' (p :: k1 -> k -> *) (q :: k1 -> k -> *) (f :: k1 -> k) (s :: k1) (a :: k1) = Optical p q f s s a a

-- | Many combinators that accept a <a>Lens</a> can also accept a
--   <a>Traversal</a> in limited situations.
--   
--   They do so by specializing the type of <a>Functor</a> that they
--   require of the caller.
--   
--   If a function accepts a <tt><a>LensLike</a> f s t a b</tt> for some
--   <a>Functor</a> <tt>f</tt>, then they may be passed a <a>Lens</a>.
--   
--   Further, if <tt>f</tt> is an <a>Applicative</a>, they may also be
--   passed a <a>Traversal</a>.
type LensLike (f :: k -> *) s (t :: k) a (b :: k) = a -> f b -> s -> f t

-- | <pre>
--   type <a>LensLike'</a> f = <a>Simple</a> (<a>LensLike</a> f)
--   </pre>
type LensLike' (f :: * -> *) s a = LensLike f s s a a

-- | Convenient alias for constructing indexed lenses and their ilk.
type IndexedLensLike i (f :: k -> *) s (t :: k) a (b :: k) = forall (p :: * -> * -> *). Indexable i p => p a f b -> s -> f t

-- | Convenient alias for constructing simple indexed lenses and their ilk.
type IndexedLensLike' i (f :: * -> *) s a = IndexedLensLike i f s s a a

-- | This is a convenient alias for use when you need to consume either
--   indexed or non-indexed lens-likes based on context.
type Over (p :: k -> * -> *) (f :: k1 -> *) s (t :: k1) (a :: k) (b :: k1) = p a f b -> s -> f t

-- | This is a convenient alias for use when you need to consume either
--   indexed or non-indexed lens-likes based on context.
--   
--   <pre>
--   type <a>Over'</a> p f = <a>Simple</a> (<a>Over</a> p f)
--   </pre>
type Over' (p :: * -> * -> *) (f :: * -> *) s a = Over p f s s a a

-- | Anything <a>Settable</a> must be isomorphic to the <a>Identity</a>
--   <a>Functor</a>.
class (Applicative f, Distributive f, Traversable f) => Settable (f :: * -> *)

-- | This is a profunctor used internally to implement <a>Review</a>
--   
--   It plays a role similar to that of <a>Accessor</a> or <tt>Const</tt>
--   do for <a>Control.Lens.Getter</a>
retagged :: (Profunctor p, Bifunctor p) => p a b -> p s b

-- | This class is provided mostly for backwards compatibility with lens
--   3.8, but it can also shorten type signatures.
class (Profunctor p, Bifunctor p) => Reviewable (p :: * -> * -> *)

-- | This provides a way to peek at the internal structure of a
--   <a>Traversal</a> or <a>IndexedTraversal</a>
data Magma i t b a

-- | This data type represents a path-compressed copy of one level of a
--   source data structure. We can safely use path-compression because we
--   know the depth of the tree.
--   
--   Path compression is performed by viewing a <a>Level</a> as a PATRICIA
--   trie of the paths into the structure to leaves at a given depth,
--   similar in many ways to a <a>IntMap</a>, but unlike a regular PATRICIA
--   trie we do not need to store the mask bits merely the depth of the
--   fork.
--   
--   One invariant of this structure is that underneath a <a>Two</a> node
--   you will not find any <a>Zero</a> nodes, so <a>Zero</a> can only occur
--   at the root.
data Level i a

-- | This class provides a generalized notion of list reversal extended to
--   other containers.
class Reversing t
reversing :: Reversing t => t -> t

-- | This is used to characterize a <a>Traversal</a>.
--   
--   a.k.a. indexed Cartesian store comonad, indexed Kleene store comonad,
--   or an indexed <tt>FunList</tt>.
--   
--   <a>http://twanvl.nl/blog/haskell/non-regular1</a>
--   
--   A <a>Bazaar</a> is like a <a>Traversal</a> that has already been
--   applied to some structure.
--   
--   Where a <tt><a>Context</a> a b t</tt> holds an <tt>a</tt> and a
--   function from <tt>b</tt> to <tt>t</tt>, a <tt><a>Bazaar</a> a b t</tt>
--   holds <tt>N</tt> <tt>a</tt>s and a function from <tt>N</tt>
--   <tt>b</tt>s to <tt>t</tt>, (where <tt>N</tt> might be infinite).
--   
--   Mnemonically, a <a>Bazaar</a> holds many stores and you can easily add
--   more.
--   
--   This is a final encoding of <a>Bazaar</a>.
newtype Bazaar (p :: * -> * -> *) a b t
Bazaar :: forall (f :: * -> *). Applicative f => p a f b -> f t -> Bazaar a b t
[runBazaar] :: Bazaar a b t -> forall (f :: * -> *). Applicative f => p a f b -> f t

-- | This alias is helpful when it comes to reducing repetition in type
--   signatures.
--   
--   <pre>
--   type <a>Bazaar'</a> p a t = <a>Bazaar</a> p a a t
--   </pre>
type Bazaar' (p :: * -> * -> *) a = Bazaar p a a

-- | This is used to characterize a <a>Traversal</a>.
--   
--   a.k.a. indexed Cartesian store comonad, indexed Kleene store comonad,
--   or an indexed <tt>FunList</tt>.
--   
--   <a>http://twanvl.nl/blog/haskell/non-regular1</a>
--   
--   A <a>Bazaar1</a> is like a <a>Traversal</a> that has already been
--   applied to some structure.
--   
--   Where a <tt><a>Context</a> a b t</tt> holds an <tt>a</tt> and a
--   function from <tt>b</tt> to <tt>t</tt>, a <tt><a>Bazaar1</a> a b
--   t</tt> holds <tt>N</tt> <tt>a</tt>s and a function from <tt>N</tt>
--   <tt>b</tt>s to <tt>t</tt>, (where <tt>N</tt> might be infinite).
--   
--   Mnemonically, a <a>Bazaar1</a> holds many stores and you can easily
--   add more.
--   
--   This is a final encoding of <a>Bazaar1</a>.
newtype Bazaar1 (p :: * -> * -> *) a b t
Bazaar1 :: forall (f :: * -> *). Apply f => p a f b -> f t -> Bazaar1 a b t
[runBazaar1] :: Bazaar1 a b t -> forall (f :: * -> *). Apply f => p a f b -> f t

-- | This alias is helpful when it comes to reducing repetition in type
--   signatures.
--   
--   <pre>
--   type <a>Bazaar1'</a> p a t = <a>Bazaar1</a> p a a t
--   </pre>
type Bazaar1' (p :: * -> * -> *) a = Bazaar1 p a a

-- | The indexed store can be used to characterize a <a>Lens</a> and is
--   used by <a>cloneLens</a>.
--   
--   <tt><a>Context</a> a b t</tt> is isomorphic to <tt>newtype
--   <a>Context</a> a b t = <a>Context</a> { runContext :: forall f.
--   <a>Functor</a> f =&gt; (a -&gt; f b) -&gt; f t }</tt>, and to
--   <tt>exists s. (s, <a>Lens</a> s t a b)</tt>.
--   
--   A <a>Context</a> is like a <a>Lens</a> that has already been applied
--   to a some structure.
data Context a b t
Context :: b -> t -> a -> Context a b t

-- | <pre>
--   type <a>Context'</a> a s = <a>Context</a> a a s
--   </pre>
type Context' a = Context a a

-- | When composed with an <tt>IndexedFold</tt> or
--   <tt>IndexedTraversal</tt> this yields an (<a>Indexed</a>)
--   <tt>Fold</tt> of the indices.
asIndex :: (Indexable i p, Contravariant f, Functor f) => p i f i -> Indexed i s f s

-- | Fold a container with indices returning both the indices and the
--   values.
--   
--   The result is only valid to compose in a <tt>Traversal</tt>, if you
--   don't edit the index as edits to the index have no effect.
--   
--   <pre>
--   &gt;&gt;&gt; [10, 20, 30] ^.. ifolded . withIndex
--   [(0,10),(1,20),(2,30)]
--   </pre>
--   
--   <pre>
--   &gt;&gt;&gt; [10, 20, 30] ^.. ifolded . withIndex . alongside negated (re _Show)
--   [(0,"10"),(-1,"20"),(-2,"30")]
--   </pre>
withIndex :: (Indexable i p, Functor f) => p (i, s) f (j, t) -> Indexed i s f t

-- | Transform a <a>Traversal</a> into an <a>IndexedTraversal</a> or a
--   <a>Fold</a> into an <a>IndexedFold</a>, etc.
--   
--   This combinator is like <a>indexing</a> except that it handles large
--   traversals and folds gracefully.
--   
--   <pre>
--   <a>indexing64</a> :: <a>Traversal</a> s t a b -&gt; <a>IndexedTraversal</a> <a>Int64</a> s t a b
--   <a>indexing64</a> :: <a>Prism</a> s t a b     -&gt; <a>IndexedTraversal</a> <a>Int64</a> s t a b
--   <a>indexing64</a> :: <a>Lens</a> s t a b      -&gt; <a>IndexedLens</a> <a>Int64</a> s t a b
--   <a>indexing64</a> :: <a>Iso</a> s t a b       -&gt; <a>IndexedLens</a> <a>Int64</a> s t a b
--   <a>indexing64</a> :: <a>Fold</a> s a          -&gt; <a>IndexedFold</a> <a>Int64</a> s a
--   <a>indexing64</a> :: <a>Getter</a> s a        -&gt; <a>IndexedGetter</a> <a>Int64</a> s a
--   </pre>
--   
--   <pre>
--   <a>indexing64</a> :: <a>Indexable</a> <a>Int64</a> p =&gt; <a>LensLike</a> (<a>Indexing64</a> f) s t a b -&gt; <a>Over</a> p f s t a b
--   </pre>
indexing64 :: Indexable Int64 p => a -> Indexing64 f b -> s -> Indexing64 f t -> p a f b -> s -> f t

-- | Transform a <a>Traversal</a> into an <a>IndexedTraversal</a> or a
--   <a>Fold</a> into an <a>IndexedFold</a>, etc.
--   
--   <pre>
--   <a>indexing</a> :: <a>Traversal</a> s t a b -&gt; <a>IndexedTraversal</a> <a>Int</a> s t a b
--   <a>indexing</a> :: <a>Prism</a> s t a b     -&gt; <a>IndexedTraversal</a> <a>Int</a> s t a b
--   <a>indexing</a> :: <a>Lens</a> s t a b      -&gt; <a>IndexedLens</a> <a>Int</a>  s t a b
--   <a>indexing</a> :: <a>Iso</a> s t a b       -&gt; <a>IndexedLens</a> <a>Int</a> s t a b
--   <a>indexing</a> :: <a>Fold</a> s a          -&gt; <a>IndexedFold</a> <a>Int</a> s a
--   <a>indexing</a> :: <a>Getter</a> s a        -&gt; <a>IndexedGetter</a> <a>Int</a> s a
--   </pre>
--   
--   <pre>
--   <a>indexing</a> :: <a>Indexable</a> <a>Int</a> p =&gt; <a>LensLike</a> (<a>Indexing</a> f) s t a b -&gt; <a>Over</a> p f s t a b
--   </pre>
indexing :: Indexable Int p => a -> Indexing f b -> s -> Indexing f t -> p a f b -> s -> f t

-- | This is a <a>Profunctor</a> that is both <a>Corepresentable</a> by
--   <tt>f</tt> and <a>Representable</a> by <tt>g</tt> such that <tt>f</tt>
--   is left adjoint to <tt>g</tt>. From this you can derive a lot of
--   structure due to the preservation of limits and colimits.
class (Choice p, Corepresentable p, Comonad Corep p, Traversable Corep p, Strong p, Representable p, Monad Rep p, MonadFix Rep p, Distributive Rep p, Costrong p, ArrowLoop p, ArrowApply p, ArrowChoice p, Closed p) => Conjoined (p :: * -> * -> *)

-- | <a>Conjoined</a> is strong enough to let us distribute every
--   <a>Conjoined</a> <a>Profunctor</a> over every Haskell <a>Functor</a>.
--   This is effectively a generalization of <a>fmap</a>.
distrib :: (Conjoined p, Functor f) => p a b -> p f a f b

-- | This permits us to make a decision at an outermost point about whether
--   or not we use an index.
--   
--   Ideally any use of this function should be done in such a way so that
--   you compute the same answer, but this cannot be enforced at the type
--   level.
conjoined :: Conjoined p => p ~ ((->) :: * -> * -> *) -> q a -> b r -> q p a b r -> q p a b r

-- | This class permits overloading of function application for things that
--   also admit a notion of a key or index.
class Conjoined p => Indexable i (p :: * -> * -> *)

-- | Build a function from an <a>indexed</a> function.
indexed :: Indexable i p => p a b -> i -> a -> b

-- | A function with access to a index. This constructor may be useful when
--   you need to store an <a>Indexable</a> in a container to avoid
--   <tt>ImpredicativeTypes</tt>.
--   
--   <pre>
--   index :: Indexed i a b -&gt; i -&gt; a -&gt; b
--   </pre>
newtype Indexed i a b
Indexed :: i -> a -> b -> Indexed i a b
[runIndexed] :: Indexed i a b -> i -> a -> b

-- | Used internally by <a>traverseOf_</a> and the like.
--   
--   The argument <tt>a</tt> of the result should not be used!
data Traversed a (f :: * -> *)

-- | Used internally by <a>mapM_</a> and the like.
--   
--   The argument <tt>a</tt> of the result should not be used!
--   
--   See 4.16 Changelog entry for the explanation of "why not Apply f
--   =&gt;"?
data Sequenced a (m :: * -> *)

-- | Used for <a>preview</a>.
data Leftmost a

-- | Used for <a>lastOf</a>.
data Rightmost a
class (Foldable1 t, Traversable t) => Traversable1 (t :: * -> *)
traverse1 :: (Traversable1 t, Apply f) => a -> f b -> t a -> f t b
foldBy :: Foldable t => a -> a -> a -> a -> t a -> a
foldMapBy :: Foldable t => r -> r -> r -> r -> a -> r -> t a -> r
traverseBy :: Traversable t => forall x. () => x -> f x -> forall x y. () => f x -> y -> f x -> f y -> a -> f b -> t a -> f t b
sequenceBy :: Traversable t => forall x. () => x -> f x -> forall x y. () => f x -> y -> f x -> f y -> t f a -> f t a
class Profunctor (p :: * -> * -> *)
dimap :: Profunctor p => a -> b -> c -> d -> p b c -> p a d
lmap :: Profunctor p => a -> b -> p b c -> p a c
rmap :: Profunctor p => b -> c -> p a b -> p a c
class Profunctor p => Choice (p :: * -> * -> *)
left' :: Choice p => p a b -> p Either a c Either b c
right' :: Choice p => p a b -> p Either c a Either c b
class Contravariant (f :: * -> *)
contramap :: Contravariant f => a -> b -> f b -> f a
(>$) :: Contravariant f => b -> f b -> f a

-- | The counter-part to <a>isn't</a>, but more general as it takes a
--   <a>Getting</a> instead.
--   
--   <pre>
--   <a>is</a> = <a>has</a>
--   </pre>
is :: Getting Any s a -> s -> Bool

-- | A re-write of <a>isn't</a> to be more general by taking a
--   <a>Getting</a> instead.
--   
--   <pre>
--   <a>isn't</a> = <a>hasn't</a>
--   </pre>
isn't :: Getting All s a -> s -> Bool

-- | Check to see if this <a>Fold</a> or <a>Traversal</a> matches 1 or more
--   entries in the current state.
--   
--   <pre>
--   <a>hasuse</a> = <a>gets</a> . <a>has</a>
--   </pre>
hasuse :: MonadState s m => Getting Any s a -> m Bool

-- | Check to see if this <a>Fold</a> or <a>Traversal</a> has no matches in
--   the current state.
--   
--   <pre>
--   <a>hasn'tuse</a> = <a>gets</a> . <a>hasn't</a>
--   </pre>
hasn'tuse :: MonadState s m => Getting All s a -> m Bool

-- | A companion to <a>filtered</a> that, rather than using a predicate,
--   filters on the given lens for matches.
filteredBy :: Eq b => Lens' a b -> b -> Traversal' a a


-- | Humanise type class for displaying data structures to a human.
module Data.String.Humanise
class Humanise a
humanise :: Humanise a => a -> Text
instance Data.String.Humanise.Humanise Data.Text.Internal.Text
instance Data.String.Humanise.Humanise a => Data.String.Humanise.Humanise [a]


-- | Extra utility functions for working with the interpolate Quasi Quoter.
module Data.String.Interpolate.Extra
iFile :: QuasiQuoter


-- | A response is used as a return result of calling the <tt>werewolf</tt>
--   binary. Each response has a list of associated messages.
--   
--   <tt>werewolf</tt> was designed to be ambivalent to the playing chat
--   client. The response-message structure reflects this by staying away
--   from anything that could be construed as client-specific. This
--   includes features such as emoji support.
module Game.Werewolf.Response

-- | When a user sends a command to the <tt>werewolf</tt> binary, a
--   response is always returned.
--   
--   The chat interface should then relay any <tt>messages</tt> from the
--   response. Whether or not the command was valid (indicated by the
--   <tt>ok</tt> flag) is often irrelevant as the returned
--   <tt>messages</tt> will include errors to the user.
data Response
Response :: Bool -> [Message] -> Response

-- | Boolean flag to indicate success.
[ok] :: Response -> Bool

-- | List of messages.
[messages] :: Response -> [Message]

-- | A successful, empty response.
success :: Response

-- | An unsuccessful, empty response.
failure :: Response

-- | Exits fast with the given response. The response is encoded as JSON,
--   printed to <tt>stdout</tt> and then the program is exited with
--   <tt>0</tt> (success).
--   
--   The program always exits with success even if the response was a
--   failure one. This is to distinguish between bad calls to the binary
--   and bad commands to the werewolf engine.
exitWith :: MonadIO m => Response -> m a

-- | A message may be either public or private, indicated by its
--   <tt>to</tt> field.
--   
--   Each message contains a single text field. This field is permitted to
--   contain special characters such as new lines and tabs.
data Message
Message :: Maybe Text -> Text -> Message

-- | The message recipient: <a>Nothing</a> for a public message,
--   <a>Just</a> for a private message.
[to] :: Message -> Maybe Text

-- | The message text.
[message] :: Message -> Text

-- | Creates a public message with the given text.
publicMessage :: Text -> Message

-- | <pre>
--   privateMessage to message
--   </pre>
--   
--   Creates a private message to <tt>to</tt> with the given text.
privateMessage :: Text -> Text -> Message

-- | <pre>
--   groupMessages tos message
--   </pre>
--   
--   Creates multiple private messages (1 to each recipient) with the given
--   text.
groupMessages :: [Text] -> Text -> [Message]
instance GHC.Show.Show Game.Werewolf.Response.Response
instance GHC.Generics.Generic Game.Werewolf.Response.Response
instance GHC.Classes.Eq Game.Werewolf.Response.Response
instance GHC.Show.Show Game.Werewolf.Response.Message
instance GHC.Generics.Generic Game.Werewolf.Response.Message
instance GHC.Classes.Eq Game.Werewolf.Response.Message
instance Data.Aeson.Types.FromJSON.FromJSON Game.Werewolf.Response.Response
instance Data.Aeson.Types.ToJSON.ToJSON Game.Werewolf.Response.Response
instance Data.Aeson.Types.FromJSON.FromJSON Game.Werewolf.Response.Message
instance Data.Aeson.Types.ToJSON.ToJSON Game.Werewolf.Response.Message


-- | Roles are split into four categories:
--   
--   <ul>
--   <li>The Ambiguous.</li>
--   <li>The Loners.</li>
--   <li>The Villagers.</li>
--   <li>The Werewolves.</li>
--   </ul>
module Game.Werewolf.Role

-- | Role definitions require only a few pieces of information.
--   
--   The <tt>balance</tt> attribute on a role indicates the allegiance it
--   favours. For example, a Simple Werewolf has a balance of -4 while the
--   Seer has a balance of 2. A balance of 0 means it favours neither
--   allegiance.
--   
--   N.B., role equality is defined on just the <a>tag</a> as a role's
--   <a>allegiance</a> may change throughout the game.
data Role
tag :: Lens' Role Text
name :: Lens' Role Text
allegiance :: Lens' Role Allegiance
balance :: Lens' Role Int
activity :: Lens' Role Activity
description :: Lens' Role Text
rules :: Lens' Role Text

-- | The <a>NoOne</a> allegiance is used for the Loners. It is not used to
--   determine who has won (i.e., if one Loner wins, the others still
--   lose).
data Allegiance
NoOne :: Allegiance
Necromancer :: Allegiance
Villagers :: Allegiance
Werewolves :: Allegiance
_NoOne :: Prism' Allegiance ()
_Necromancer :: Prism' Allegiance ()
_Villagers :: Prism' Allegiance ()
_Werewolves :: Prism' Allegiance ()

-- | Defines whether a role is diurnal or nocturnal. I.e., if the role's
--   turn occurs during the day or night.
data Activity
Diurnal :: Activity
Nocturnal :: Activity
_Diurnal :: Prism' Activity ()
_Nocturnal :: Prism' Activity ()

-- | A list containing all the roles defined in this file.
allRoles :: [Role]

-- | A list containing roles that are restricted to a single instance per
--   <tt>Game</tt>.
--   
--   <pre>
--   <a>restrictedRoles</a> = <a>allRoles</a> \\ [<a>simpleVillagerRole</a>, <a>simpleWerewolfRole</a>, <a>spitefulVillagerRole</a>, <a>zombieRole</a>]
--   
--   </pre>
restrictedRoles :: [Role]

-- | <i>Abandoned by their parents as a child, with no-one wanting to look
--   after another mouth to</i> <i>feed, the Orphan was left to fend for
--   themself. No-one looked twice at the Orphan and even</i> <i>fewer
--   showed kindness towards the lonely child. One day however, one
--   townsperson changed all</i> <i>this. He offered the Orphan food, water
--   and a roof over their head. Grateful for his chairty</i> <i>and
--   affection, the Orphan made him their role model. Pray that no ill
--   should befall their</i> <i>role model, for they are the only one
--   conforming the Orphan as a Villager.</i>
--   
--   On the first night, the Orphan chooses a player to become their role
--   model. So long as the role model is alive, the Orphan is a Villager.
--   If however the role model is eliminated, then the Orphan becomes a
--   Werewolf.
orphanRole :: Role

-- | <i>Hah, maybe not as liked as the Jester, but the Drunk sure does
--   their fair share of stupid</i> <i>things in the night! No-one knows if
--   they even actually make it home; sometimes people see</i> <i>them
--   sleeping outside the Blacksmith's home, others say they see them
--   wandering towards the</i> <i>woods. It's pointless quizzing the
--   Village Drunk in the morning about their doings; they can</i> <i>never
--   remember what they did!</i>
--   
--   The Village Drunk is initially aligned with the Villagers.
--   
--   On the third night the Village Drunk sobers up and is randomly
--   assigned a new alignment, either Villagers or Werewolves.
villageDrunkRole :: Role

-- | <i>Normally the Dullahan carries their head under one arm, however
--   while amongst the Villagers,</i> <i>they ere on the side of caution
--   and rest it in a more traditional place. The Dullahan rides a</i>
--   <i>black horse as dark as night and hunts down travellers in the
--   countryside. Beware if the</i> <i>Dullahan knows your name, for you
--   are then marked for death and you should avoid them at all</i> /costs.
--   
--   The Dullahan is given a list of player names at the start of the game.
--   To win, they must eliminate all of them before the end of the game.
dullahanRole :: Role

-- | <i>Long ago during the War in Heaven, angels fell from the sky as one
--   by one those that followed</i> <i>Lucifer were defeated. For centuries
--   they lived amongst mortal Villagers as punishment for</i> <i>their
--   sins and wrongdoings. The Fallen Angel was one such being and is now
--   one of the few</i> <i>angels left on Earth. Nothing is worse
--   punishment for them, the Fallen Angel yearns for death</i> <i>to once
--   again be free!</i>
--   
--   The Fallen Angel wins if they manage to get lynched by the Villagers
--   before the end of the game.
fallenAngelRole :: Role

-- | <i>The dead are feared among the living; the dead outnumber the
--   living. In most villages the</i> <i>dead remain that way, but not when
--   the Necromancer is present. The Necromancer devoted their</i> <i>life
--   to learning black magic and methods of bringing people back to life.
--   Unfortunately this</i> <i>art is hard to perfect and all they can
--   manage to bring back are soulless Zombies.</i>
--   
--   Once per game the Necromancer can choose to resurrect all dead players
--   as Zombies. The Zombies are aligned with the Necromancer and they
--   cannot be lynched or devoured.
--   
--   If the Necromancer is killed, all Zombies die with them.
--   
--   The Necromancer and Zombies win if they are the last ones alive.
necromancerRole :: Role

-- | <i>A loyal follower of the Necromancer. A Zombie has no mind of its
--   own and blindly obeys every</i> <i>command of their master.</i>
--   
--   A Zombie wins with the Necromancer. They cannot be killed, however
--   they die when the Necromancer dies.
zombieRole :: Role

-- | <i>Awareness comes easy to the Beholder. They listen to their senses
--   and trust their hunches.</i> <i>Over the years the Beholder has grown
--   to know a certain few of the village just by paying</i> <i>attention.
--   Little cues here and there, the way someone talks, the way they move -
--   it all</i> <i>gives clues as to their true nature and role.</i>
--   
--   At the start of the game the Beholder is informed the Seer's identity.
beholderRole :: Role

-- | <i>Never trust a politician. Nor a Crooked Senator for that matter.
--   The Crooked Senator may seem</i> <i>like he has the village's best
--   interests at heart, but let's be honest, when put in a tough</i>
--   <i>situation he looks after no-one but himself. Even when safe, the
--   Crooked Senator may decide</i> <i>to toy with the Villagers' emotions
--   and try pit them against one another.</i>
--   
--   The Crooked Senator looks at the village votes as they come in.
crookedSenatorRole :: Role

-- | <i>How honoured we are to be in the presence of such a noble leader.
--   The return of the Druid</i> <i>marks an exceptional time in Fougères's
--   history! Friend of the woodland creatures, practiced</i>
--   <i>philosopher and now, with the help of Ferina their companion, a
--   bane to the Werewolves</i> <i>themselves! My does she have a nose on
--   her, strong enough to sniff out lycanthropes in close</i>
--   <i>proximity! Listen for her grunt and heed her warning for she will
--   not let you down.</i>
--   
--   Each morning when Ferina wakes from her slumber she will be alert and
--   cautious. If the Druid is next to a Werewolf in the player
--   <tt>circle</tt> then Ferina will grunt in warning.
druidRole :: Role

-- | <i>A skilled marksman with quick reflexes. In the unfortunate
--   situation that they are jumped and</i> <i>killed unjustly, they let
--   off a shot at their attacker, killing them instantly. The Hunter</i>
--   <i>never misses.</i>
--   
--   If the Hunter is killed they choose one player, believed to be an
--   attacker, to kill immediately.
hunterRole :: Role

-- | <i>Every village needs a Jester; they're so stupid, but provide so
--   much entertainment! The</i> <i>Jester may not have any special
--   abilities, but at least no-one in the village wants to hurt</i>
--   <i>them.</i>
--   
--   If the village votes to lynch the Jester, their identity is revealed.
--   The village realise there's no point in burning them and so they are
--   set free.
--   
--   The Jester continues to play but may no longer vote as no-one can take
--   them seriously.
jesterRole :: Role

-- | <i>Traditionally a Werewolf once transformed loses all memories and
--   personality. Over years of</i> <i>transforming, the Lycan has slowly
--   evolved and learnt how to retain themself. Night after</i> <i>night of
--   devouring with the other Werewolves took its toll. The screams alone
--   were enough to</i> <i>turn the Lycan and make them question their true
--   nature.</i>
--   
--   The Lycan is aligned with the Villagers, but appears to nature-seeing
--   roles (e.g., the Seer) as a Werewolf.
lycanRole :: Role

-- | <i>A beautiful flirt, the Medusa is aligned with the Villagers but
--   harbours a terrifying secret.</i> <i>During the day they are well
--   known in the village of Fougères for their stunning appearance</i>
--   <i>which captures the eye and love of all the townsfolk. However when
--   their secret takes ahold</i> <i>at sundown, their true self is
--   revealed. Any who gaze upon her true form would see live</i> <i>snakes
--   for hair and the few that further look into her eyes are turned to
--   stone.</i>
--   
--   If Medusa attracts the attention of a Werewolf during the night and is
--   devoured, the first Werewolf to their left in the player
--   <tt>circle</tt> will catch their gaze and turn to stone, instantly
--   killing the lupine predator.
medusaRole :: Role

-- | <i>Originally rejected by the townsfolk, the Oracle's prophetic
--   divinations has earned trust</i> <i>within the village. With constant
--   precognition - and concern for the future - the Oracle</i> <i>knows
--   the village will only live if they work together.</i>
--   
--   Each night the Oracle chooses a player to divine. They are then
--   informed of the player's role the following morning. This wisdom is
--   for the Oracle to use to ensure the future of Fougères.
oracleRole :: Role

-- | <i>The Protector is one of the few pure of heart and altruistic
--   Villagers; they are forever</i> <i>putting others needs above their
--   own. Each night they fight against the Werewolves with</i> <i>naught
--   but a sword and shield, potentially saving an innocents life.</i>
--   
--   Each night the Protector chooses a player deemed worthy of their
--   protection. That player is safe for that night (and only that night)
--   against the Werewolves.
--   
--   The Protector may not protect the same player two nights in a row.
protectorRole :: Role

-- | <i>The Saint, also historically known as a hallow, is recognized as
--   having an exceptional degree of</i> <i>holiness and likeness to God.
--   They are a humble Villager and shine light on these dark times.</i>
--   <i>Extinguishing this light would not be wise</i>
--   
--   If the Saint is lynched by the village, all who voted for them die.
saintRole :: Role

-- | <i>Werewolves don't just spring up out of the ground! That's where
--   dwarves come from. Clearly</i> <i>someone is to blame for this
--   affliction to Fougères. Unluckily for the Scapegoat, since</i>
--   <i>no-one actually knows who brought them here, the blame is always
--   laid upon them!</i>
--   
--   If the village's vote ends in a tie, it's the Scapegoat who is
--   eliminated instead of no-one.
--   
--   In this event, the Scapegoat has one last task to complete: they must
--   choose whom is permitted to vote or not on the next day.
scapegoatRole :: Role

-- | <i>The Seer has the ability to see into fellow townsfolk and determine
--   their true nature. This</i> <i>ability to see is not given out
--   lightly, for certain it is a gift! The visions will always be</i>
--   <i>true, but only for the present as not even the Seer knows what the
--   future holds.</i>
--   
--   Each night the Seer sees the allegiance of one player of their choice.
seerRole :: Role

-- | <i>A simple, ordinary townsperson in every way. Some may be cobblers,
--   others bakers or even</i> <i>nobles. No matter their differences
--   though, the plight of Werewolves in Fougères unites all</i> <i>the
--   Villagers in this unfortunate time.</i>
--   
--   The Simple Villager has no special abilities, they must use their
--   guile to determine whom among them is not who they say they are.
simpleVillagerRole :: Role

-- | <i>A simple, ordinary townsperson in every way. Some may be cobblers,
--   others bakers or even</i> <i>nobles. No matter their differences
--   though, the plight of Werewolves in Fougères unites all</i> <i>the
--   Villagers in this unfortunate time.</i>
--   
--   <i>Yet the Spiteful Villager has no loyalty in the afterlife; whoever
--   causes them harm may find</i> <i>themselves in trouble.</i>
--   
--   When the Spiteful Villager is killed, they are informed of everyone's
--   roles and may haunt the village as they wish.
spitefulVillagerRole :: Role

-- | <i>The True Villager has a heart and soul as clear as day! Their
--   allegiance and devotion to the</i> <i>village are beyond reproach. If
--   there is one person whom you should confide in, listen to and</i>
--   <i>trust, it is the True Villager.</i>
--   
--   At the start of the game the True Villager's identity is revealed.
trueVillagerRole :: Role

-- | <i>Somehow forgotten with the coming of the Werewolves, the Witch has
--   a chance to prove themself</i> <i>valuable to the village and maybe
--   abolish the absurd pastime of burning and drowning their</i> <i>cult.
--   The Witch is blessed (or maybe cursed) with the ability to make two
--   powerful potions;</i> <i>one of which heals a victim of the
--   Werewolves, the other poisons a player.</i>
--   
--   The Witch is called after the Werewolves. They are able to heal and
--   poison one player per game. There is no restriction on using both
--   potions in one night or on healing themself.
witchRole :: Role

-- | <i>The Alpha Wolf leads the Werewolves in the raids against Fougères
--   each night and not even the</i> <i>Seer can see them coming. If the
--   Werewolves caused the Villagers to question and accuse one</i>
--   <i>another beforehand, the Alpha Wolf eliminates any shred of humanity
--   left. No-one can be</i> <i>trusted anymore and no-one knows the
--   truth.</i>
--   
--   The Alpha Wolf appears to nature-seeing roles (e.g., the Seer) as a
--   Villager.
alphaWolfRole :: Role

-- | <i>The Simple Werewolf is a fearsome lupine, cunning like no other
--   creature that roams the</i> <i>forest. Their origin is unknown, but
--   that matters little, for they present a grave threat to</i>
--   <i>Fougères. While each day they hide in plain sight as an ordinary
--   Villager, each night they</i> <i>transform and devour an innocent.
--   There is little hope left for the village.</i>
--   
--   A Werewolf may never devour another Werewolf.
simpleWerewolfRole :: Role
instance GHC.Classes.Eq Game.Werewolf.Role.Role
instance Data.String.Humanise.Humanise Game.Werewolf.Role.Role
instance GHC.Show.Show Game.Werewolf.Role.Role
instance GHC.Read.Read Game.Werewolf.Role.Role
instance GHC.Show.Show Game.Werewolf.Role.Activity
instance GHC.Read.Read Game.Werewolf.Role.Activity
instance GHC.Classes.Eq Game.Werewolf.Role.Activity
instance GHC.Show.Show Game.Werewolf.Role.Allegiance
instance GHC.Read.Read Game.Werewolf.Role.Allegiance
instance GHC.Classes.Eq Game.Werewolf.Role.Allegiance
instance Data.String.Humanise.Humanise Game.Werewolf.Role.Activity
instance Data.String.Humanise.Humanise Game.Werewolf.Role.Allegiance


-- | Players are quite simple in themselves. They have a <a>name</a>,
--   <a>role</a> and <a>state</a>.
module Game.Werewolf.Player

-- | A player has a <a>name</a>, <a>role</a> and <a>state</a>. Any stateful
--   information needed for a player's <tt>role</tt> is held on the
--   <tt>Game</tt> itself.
--   
--   N.B., player equality is defined on just the <a>name</a>.
data Player
name :: Lens' Player Text
role :: Lens' Player Role
state :: Lens' Player State

-- | Surprise surprise, players may be <a>Dead</a> or <a>Alive</a>.
data State
Alive :: State
Dead :: State
_Alive :: Prism' State ()
_Dead :: Prism' State ()

-- | Creates a new <a>Alive</a> player.
newPlayer :: Text -> Role -> Player

-- | The traversal of <a>Player</a>s with an <a>alphaWolfRole</a>.
--   
--   <pre>
--   <a>alphaWolf</a> = <a>role</a> . <a>only</a> <a>alphaWolfRole</a>
--   </pre>
alphaWolf :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>beholderRole</a>.
--   
--   <pre>
--   <a>beholder</a> = <a>role</a> . <a>only</a> <a>beholderRole</a>
--   </pre>
beholder :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>crookedSenatorRole</a>.
--   
--   <pre>
--   <a>crookedSenator</a> = <a>role</a> . <a>only</a> <a>crookedSenatorRole</a>
--   </pre>
crookedSenator :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>druidRole</a>.
--   
--   <pre>
--   <a>druid</a> = <a>role</a> . <a>only</a> <a>druidRole</a>
--   </pre>
druid :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>dullahanRole</a>.
--   
--   <pre>
--   <a>dullahan</a> = <a>role</a> . <a>only</a> <a>dullahanRole</a>
--   </pre>
dullahan :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>fallenAngelRole</a>.
--   
--   <pre>
--   <a>fallenAngel</a> = <a>role</a> . <a>only</a> <a>fallenAngelRole</a>
--   </pre>
fallenAngel :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>hunterRole</a>.
--   
--   <pre>
--   <a>hunter</a> = <a>role</a> . <a>only</a> <a>hunterRole</a>
--   </pre>
hunter :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>jesterRole</a>.
--   
--   <pre>
--   <a>jester</a> = <a>role</a> . <a>only</a> <a>jesterRole</a>
--   </pre>
jester :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>lycanRole</a>.
--   
--   <pre>
--   <a>lycan</a> = <a>role</a> . <a>only</a> <a>lycanRole</a>
--   </pre>
lycan :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>medusaRole</a>.
--   
--   <pre>
--   <a>medusa</a> = <a>role</a> . <a>only</a> <a>medusaRole</a>
--   </pre>
medusa :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>necromancerRole</a>.
--   
--   <pre>
--   <a>necromancer</a> = <a>role</a> . <a>only</a> <a>necromancerRole</a>
--   </pre>
necromancer :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>oracleRole</a>.
--   
--   <pre>
--   <a>oracle</a> = <a>role</a> . <a>only</a> <a>oracleRole</a>
--   </pre>
oracle :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with an <a>orphanRole</a>.
--   
--   <pre>
--   <a>orphan</a> = <a>role</a> . <a>only</a> <a>orphanRole</a>
--   </pre>
orphan :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>protectorRole</a>.
--   
--   <pre>
--   <a>protector</a> = <a>role</a> . <a>only</a> <a>protectorRole</a>
--   </pre>
protector :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>saintRole</a>.
--   
--   <pre>
--   <a>saint</a> = <a>role</a> . <a>only</a> <a>saintRole</a>
--   </pre>
saint :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>scapegoatRole</a>.
--   
--   <pre>
--   <a>scapegoat</a> = <a>role</a> . <a>only</a> <a>scapegoatRole</a>
--   </pre>
scapegoat :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>seerRole</a>.
--   
--   <pre>
--   <a>seer</a> = <a>role</a> . <a>only</a> <a>seerRole</a>
--   </pre>
seer :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>simpleVillagerRole</a>.
--   
--   <pre>
--   <a>simpleVillager</a> = <a>role</a> . <a>only</a> <a>simpleVillagerRole</a>
--   </pre>
simpleVillager :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>simpleWerewolfRole</a>.
--   
--   <pre>
--   <a>simpleWerewolf</a> = <a>role</a> . <a>only</a> <a>simpleWerewolfRole</a>
--   </pre>
simpleWerewolf :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>spitefulVillagerRole</a>.
--   
--   <pre>
--   <a>spitefulVillager</a> = <a>role</a> . <a>only</a> <a>spitefulVillagerRole</a>
--   </pre>
spitefulVillager :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>trueVillagerRole</a>.
--   
--   <pre>
--   <a>trueVillager</a> = <a>role</a> . <a>only</a> <a>trueVillagerRole</a>
--   </pre>
trueVillager :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>villageDrunkRole</a>.
--   
--   <pre>
--   <a>villageDrunk</a> = <a>role</a> . <a>only</a> <a>villageDrunkRole</a>
--   </pre>
villageDrunk :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>witchRole</a>.
--   
--   <pre>
--   <a>witch</a> = <a>role</a> . <a>only</a> <a>witchRole</a>
--   </pre>
witch :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>zombieRole</a>.
--   
--   <pre>
--   <a>zombie</a> = <a>role</a> . <a>only</a> <a>zombieRole</a>
--   </pre>
zombie :: Traversal' Player ()

-- | The traversal of <a>Player</a>s aligned with <a>NoOne</a>.
--   
--   <pre>
--   <a>loner</a> = <a>role</a> . <a>allegiance</a> . <a>_NoOne</a>
--   </pre>
loner :: Traversal' Player ()

-- | The traversal of <a>Player</a>s aligned with the <a>Villagers</a>.
--   
--   <pre>
--   <a>villager</a> = <a>role</a> . <a>allegiance</a> . <a>_Villagers</a>
--   </pre>
villager :: Traversal' Player ()

-- | The traversal of <a>Player</a>s aligned with the <a>Werewolves</a>.
--   
--   <pre>
--   <a>werewolf</a> = <a>role</a> . <a>allegiance</a> . <a>_Werewolves</a>
--   </pre>
werewolf :: Traversal' Player ()

-- | The traversal of <a>Player</a> names.
--   
--   <pre>
--   <a>names</a> = <a>traverse</a> . <a>name</a>
--   </pre>
names :: Traversable t => Traversal' (t Player) Text

-- | The traversal of <a>Player</a> roles.
--   
--   <pre>
--   <a>roles</a> = <a>traverse</a> . <a>role</a>
--   </pre>
roles :: Traversable t => Traversal' (t Player) Role

-- | The traversal of <a>Player</a> states.
--   
--   <pre>
--   <a>states</a> = <a>traverse</a> . <a>state</a>
--   </pre>
states :: Traversable t => Traversal' (t Player) State

-- | The traversal of <a>Player</a>s with the given name.
--   
--   <pre>
--   <a>named</a> name' = <a>filteredBy</a> . <a>name</a> name'
--   </pre>
named :: Text -> Traversal' Player Player

-- | The traversal of <a>alphaWolf</a> <a>Player</a>s.
--   
--   <pre>
--   <a>alphaWolves</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>alphaWolf</a>)
--   </pre>
alphaWolves :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>beholder</a> <a>Player</a>s.
--   
--   <pre>
--   <a>beholders</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>beholder</a>)
--   </pre>
beholders :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>crookedSenator</a> <a>Player</a>s.
--   
--   <pre>
--   <a>crookedSenators</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>crookedSenator</a>)
--   </pre>
crookedSenators :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>druid</a> <a>Player</a>s.
--   
--   <pre>
--   <a>druids</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>druid</a>)
--   </pre>
druids :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>dullahan</a> <a>Player</a>s.
--   
--   <pre>
--   <a>dullahans</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>dullahan</a>)
--   </pre>
dullahans :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>fallenAngel</a> <a>Player</a>s.
--   
--   <pre>
--   <a>fallenAngels</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>fallenAngel</a>)
--   </pre>
fallenAngels :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>hunter</a> <a>Player</a>s.
--   
--   <pre>
--   <a>hunters</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>hunter</a>)
--   </pre>
hunters :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>jester</a> <a>Player</a>s.
--   
--   <pre>
--   <a>jesters</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>jester</a>)
--   </pre>
jesters :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>lycan</a> <a>Player</a>s.
--   
--   <pre>
--   <a>lycans</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>lycan</a>)
--   </pre>
lycans :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>medusa</a> <a>Player</a>s.
--   
--   <pre>
--   <a>medusas</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>medusa</a>)
--   </pre>
medusas :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>necromancer</a> <a>Player</a>s.
--   
--   <pre>
--   <a>necromancers</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>necromancer</a>)
--   </pre>
necromancers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>oracle</a> <a>Player</a>s.
--   
--   <pre>
--   <a>oracles</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>oracle</a>)
--   </pre>
oracles :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>orphan</a> <a>Player</a>s.
--   
--   <pre>
--   <a>orphans</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>orphan</a>)
--   </pre>
orphans :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>protector</a> <a>Player</a>s.
--   
--   <pre>
--   <a>protectors</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>protector</a>)
--   </pre>
protectors :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>saint</a> <a>Player</a>s.
--   
--   <pre>
--   <a>saints</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>saint</a>)
--   </pre>
saints :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>scapegoat</a> <a>Player</a>s.
--   
--   <pre>
--   <a>scapegoats</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>scapegoat</a>)
--   </pre>
scapegoats :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>seer</a> <a>Player</a>s.
--   
--   <pre>
--   <a>seers</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>seer</a>)
--   </pre>
seers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>simpleVillager</a> <a>Player</a>s.
--   
--   <pre>
--   <a>simpleVillagers</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>simpleVillager</a>)
--   </pre>
simpleVillagers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>simpleWerewolf</a> <a>Player</a>s.
--   
--   <pre>
--   <a>simpleWerewolves</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>simpleWerewolf</a>)
--   </pre>
simpleWerewolves :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>spitefulVillager</a> <a>Player</a>s.
--   
--   <pre>
--   <a>spitefulVillagers</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>spitefulVillager</a>)
--   </pre>
spitefulVillagers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>trueVillager</a> <a>Player</a>s.
--   
--   <pre>
--   <a>trueVillagers</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>trueVillager</a>)
--   </pre>
trueVillagers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>villageDrunk</a> <a>Player</a>s.
--   
--   <pre>
--   <a>villageDrunks</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>villageDrunk</a>)
--   </pre>
villageDrunks :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>witch</a> <a>Player</a>s.
--   
--   <pre>
--   <a>witches</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>witch</a>)
--   </pre>
witches :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>zombie</a> <a>Player</a>s.
--   
--   <pre>
--   <a>zombies</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>zombie</a>)
--   </pre>
zombies :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>loner</a> <a>Player</a>s.
--   
--   <pre>
--   <a>loners</a> = <a>traverse</a> . <a>filtered</a> . (<a>is</a> <a>loner</a>)
--   </pre>
loners :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>villager</a> <a>Player</a>s.
--   
--   <pre>
--   <a>villagers</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>villager</a>)
--   </pre>
villagers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>werewolf</a> <a>Player</a>s.
--   
--   <pre>
--   <a>werewolves</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>werewolf</a>)
--   </pre>
werewolves :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>Alive</a> <a>Player</a>s.
--   
--   <pre>
--   <a>alive</a> = <a>filtered</a> (<a>has</a> $ <a>state</a> . <a>_Alive</a>)
--   </pre>
alive :: Traversal' Player Player

-- | The traversal of <a>Dead</a> <a>Player</a>s.
--   
--   <pre>
--   <a>dead</a> = <a>filtered</a> (<a>has</a> $ <a>state</a> . <a>_Dead</a>)
--   </pre>
dead :: Traversal' Player Player
instance GHC.Classes.Eq Game.Werewolf.Player.Player
instance Data.String.Humanise.Humanise Game.Werewolf.Player.Player
instance GHC.Show.Show Game.Werewolf.Player.Player
instance GHC.Read.Read Game.Werewolf.Player.Player
instance GHC.Show.Show Game.Werewolf.Player.State
instance GHC.Read.Read Game.Werewolf.Player.State
instance GHC.Classes.Eq Game.Werewolf.Player.State


-- | Variants alter how a game plays out. Either by changing the messages
--   returned, or by changing the game logic.
module Game.Werewolf.Variant

-- | Variant definitions require only a few pieces of information.
data Variant
tag :: Lens' Variant Text
name :: Lens' Variant Text
description :: Lens' Variant Text

-- | A list containing all the variants defined in this file.
allVariants :: [Variant]
standardVariant :: Variant
noRoleKnowledgeVariant :: Variant
noRoleKnowledgeOrRevealVariant :: Variant
noRoleRevealVariant :: Variant
spitefulVillageVariant :: Variant

-- | The traversal of <a>standard</a> <a>Variant</a>s.
--   
--   <pre>
--   <a>standard</a> = <a>only</a> <a>standardVariant</a>
--   </pre>
standard :: Traversal' Variant ()

-- | The traversal of <a>noRoleKnowledge</a> <a>Variant</a>s.
--   
--   <pre>
--   <a>noRoleKnowledge</a> = <a>only</a> <a>noRoleKnowledgeVariant</a>
--   </pre>
noRoleKnowledge :: Traversal' Variant ()

-- | The traversal of <a>noRoleKnowledgeOrReveal</a> <a>Variant</a>s.
--   
--   <pre>
--   <a>noRoleKnowledgeOrReveal</a> = <a>only</a> <a>noRoleKnowledgeOrRevealVariant</a>
--   </pre>
noRoleKnowledgeOrReveal :: Traversal' Variant ()

-- | The traversal of <a>noRoleReveal</a> <a>Variant</a>s.
--   
--   <pre>
--   <a>noRoleReveal</a> = <a>only</a> <a>noRoleRevealVariant</a>
--   </pre>
noRoleReveal :: Traversal' Variant ()

-- | The traversal of <a>spitefulVillage</a> <a>Variant</a>s.
--   
--   <pre>
--   <a>spitefulVillage</a> = <a>only</a> <a>spitefulVillageVariant</a>
--   </pre>
spitefulVillage :: Traversal' Variant ()
instance Data.String.Humanise.Humanise Game.Werewolf.Variant.Variant
instance GHC.Show.Show Game.Werewolf.Variant.Variant
instance GHC.Read.Read Game.Werewolf.Variant.Variant
instance GHC.Classes.Eq Game.Werewolf.Variant.Variant


-- | A game is not quite as simple as players! Roughly speaking though,
--   this engine is <i>stateful</i>. The game state only changes when a
--   <i>command</i> is issued. Thus, this module defines the <a>Game</a>
--   data structure and any fields required to keep track of the current
--   state.
module Game.Werewolf.Game

-- | There are a few key pieces of information that a game always needs to
--   hold. These are:
--   
--   <ul>
--   <li>the <a>stage</a>,</li>
--   <li>the <a>round</a> number and</li>
--   <li>the <a>players</a>.</li>
--   </ul>
--   
--   Any further fields on the game are specific to one or more roles (and
--   their respective turns!). Some of the additional fields are reset each
--   round (e.g., the Seer's <a>see</a>) while others are kept around for
--   the whole game (e.g., the Orphan's <a>roleModel</a>).
data Game
variant :: Lens' Game Variant
stage :: Lens' Game Stage
round :: Lens' Game Int
players :: Lens' Game [Player]
boots :: Lens' Game (Map Text [Text])
chosenVoters :: Lens' Game [Text]
deadRaised :: Lens' Game Bool
divine :: Lens' Game (Maybe Text)
fallenAngelLynched :: Lens' Game Bool
healUsed :: Lens' Game Bool
hunterRetaliated :: Lens' Game Bool
jesterRevealed :: Lens' Game Bool
marks :: Lens' Game [Text]
passed :: Lens' Game Bool
poison :: Lens' Game (Maybe Text)
poisonUsed :: Lens' Game Bool
priorProtect :: Lens' Game (Maybe Text)
protect :: Lens' Game (Maybe Text)
roleModel :: Lens' Game (Maybe Text)
scapegoatBlamed :: Lens' Game Bool
see :: Lens' Game (Maybe Text)
votes :: Lens' Game (Map Text Text)

-- | Most of these are fairly self-explainable (the turn stages).
--   <a>Sunrise</a> and <a>Sunset</a> are provided as meaningful breaks
--   between the day and night as, for example, a <a>VillagesTurn</a> may
--   not always be available (curse that retched Scapegoat).
--   
--   Once the game reaches a turn stage, it requires a <i>command</i> to
--   help push it past. Often only certain roles and commands may be
--   performed at any given stage.
data Stage
DruidsTurn :: Stage
GameOver :: Stage
HuntersTurn1 :: Stage
HuntersTurn2 :: Stage
Lynching :: Stage
NecromancersTurn :: Stage
OraclesTurn :: Stage
OrphansTurn :: Stage
ProtectorsTurn :: Stage
ScapegoatsTurn :: Stage
SeersTurn :: Stage
Sunrise :: Stage
Sunset :: Stage
VillageDrunksTurn :: Stage
VillagesTurn :: Stage
WerewolvesTurn :: Stage
WitchsTurn :: Stage
_DruidsTurn :: Prism' Stage ()
_GameOver :: Prism' Stage ()
_HuntersTurn1 :: Prism' Stage ()
_HuntersTurn2 :: Prism' Stage ()
_Lynching :: Prism' Stage ()
_NecromancersTurn :: Prism' Stage ()
_OraclesTurn :: Prism' Stage ()
_OrphansTurn :: Prism' Stage ()
_ProtectorsTurn :: Prism' Stage ()
_ScapegoatsTurn :: Prism' Stage ()
_SeersTurn :: Prism' Stage ()
_Sunrise :: Prism' Stage ()
_Sunset :: Prism' Stage ()
_VillageDrunksTurn :: Prism' Stage ()
_VillagesTurn :: Prism' Stage ()
_WerewolvesTurn :: Prism' Stage ()
_WitchsTurn :: Prism' Stage ()
activity :: (Functor f, Contravariant f) => (Activity -> f Activity) -> Stage -> f Stage

-- | All of the <a>Stage</a>s in the order that they should occur.
allStages :: [Stage]

-- | An infinite cycle of all <a>Stage</a>s in the order that they should
--   occur.
stageCycle :: [Stage]

-- | Checks whether the stage is available for the given <a>Game</a>. Most
--   often this just involves checking if there is an applicable role
--   alive, but sometimes it is more complex.
--   
--   One of the more complex checks here is for the <a>VillagesTurn</a>. If
--   the Fallen Angel is in play, then the <a>VillagesTurn</a> is available
--   on the first day rather than only after the first night.
stageAvailable :: Game -> Stage -> Bool

-- | Creates a new <a>Game</a> with the given players. No validations are
--   performed here, those are left to the binary.
newGame :: Variant -> [Player] -> Game

-- | The traversal of the <a>votes</a> victim's name. This is the player,
--   if they exist, that received the majority of the votes. This could be
--   an empty list depending on whether the votes were in conflict.
votee :: Fold Game Player

-- | The traversal of the allowed voters during the <a>VillagesTurn</a> or
--   <a>WerewolvesTurn</a>. In a standard game, this is all <a>Alive</a>
--   players. However there are two scenarios for the <a>VillagesTurn</a>
--   that may change this:
--   
--   1) if the <a>scapegoat</a> has chosen some <a>chosenVoters</a>, it is
--   these players. 2) if the <a>jester</a> has been revealed, he may not
--   vote.
allowedVoters :: Fold Game Player

-- | The traversal of all <a>Alive</a> players that have yet to vote. This
--   is synonymous to <tt>voters - Map.keys votes</tt>
pendingVoters :: Fold Game Player

-- | The traversal of <a>Game</a>s on the first round.
firstRound :: Prism' Game Game

-- | The traversal of <a>Game</a>s on the second round.
secondRound :: Prism' Game Game

-- | The traversal of <a>Game</a>s on the third round.
thirdRound :: Prism' Game Game

-- | Gets all the <a>marks</a> in a game (which is names only) and maps
--   them to their player.
getMarks :: Game -> [Player]

-- | Queries whether anyone has won.
hasAnyoneWon :: Game -> Bool

-- | Queries whether the Dullahan has won. The Dullahan wins if they manage
--   to eliminate all their marks.
hasDullahanWon :: Game -> Bool

-- | Queries whether the Fallen Angel has won. The Fallen Angel wins if
--   they manage to get themselves lynched by the Villagers.
hasFallenAngelWon :: Game -> Bool

-- | Queries whether the Necromancer has won. The <a>Necromancer</a> wins
--   if they and their zombies are the only players surviving.
--   
--   N.B., the Jester is not considered when determining whether the
--   <a>Necromancer</a> has won.
hasNecromancerWon :: Game -> Bool

-- | Queries whether the <a>Villagers</a> have won. The <a>Villagers</a>
--   win if they are the only players surviving.
--   
--   N.B., the Dullahan and Fallen Angel are not considered when
--   determining whether the <a>Villagers</a> have won.
hasVillagersWon :: Game -> Bool

-- | Queries whether the <a>Werewolves</a> have won. The <a>Werewolves</a>
--   win if they are the only players surviving.
hasWerewolvesWon :: Game -> Bool

-- | Queries whether everyone has lost.
hasEveryoneLost :: Game -> Bool
instance GHC.Show.Show Game.Werewolf.Game.Game
instance GHC.Read.Read Game.Werewolf.Game.Game
instance GHC.Classes.Eq Game.Werewolf.Game.Game
instance GHC.Show.Show Game.Werewolf.Game.Stage
instance GHC.Read.Read Game.Werewolf.Game.Stage
instance GHC.Classes.Eq Game.Werewolf.Game.Stage
instance Data.String.Humanise.Humanise Game.Werewolf.Game.Stage


-- | Re-exports all of the public modules under <i>Game.Werewolf</i>. These
--   are:
--   
--   <ul>
--   <li><a>Game.Werewolf.Game</a></li>
--   <li><a>Game.Werewolf.Player</a></li>
--   <li><a>Game.Werewolf.Response</a></li>
--   <li><a>Game.Werewolf.Role</a></li>
--   <li><a>Game.Werewolf.Variant</a></li>
--   </ul>
--   
--   N.B., where clashes are found between <a>Game.Werewolf.Player</a>,
--   <a>Game.Werewolf.Role</a> and <a>Game.Werewolf.Variant</a>, the
--   <a>Game.Werewolf.Player</a> functions are preferred.
module Game.Werewolf

-- | A message may be either public or private, indicated by its
--   <tt>to</tt> field.
--   
--   Each message contains a single text field. This field is permitted to
--   contain special characters such as new lines and tabs.
data Message
Message :: Maybe Text -> Text -> Message

-- | The message recipient: <a>Nothing</a> for a public message,
--   <a>Just</a> for a private message.
[to] :: Message -> Maybe Text

-- | The message text.
[message] :: Message -> Text

-- | When a user sends a command to the <tt>werewolf</tt> binary, a
--   response is always returned.
--   
--   The chat interface should then relay any <tt>messages</tt> from the
--   response. Whether or not the command was valid (indicated by the
--   <tt>ok</tt> flag) is often irrelevant as the returned
--   <tt>messages</tt> will include errors to the user.
data Response
Response :: Bool -> [Message] -> Response

-- | Boolean flag to indicate success.
[ok] :: Response -> Bool

-- | List of messages.
[messages] :: Response -> [Message]

-- | A successful, empty response.
success :: Response

-- | An unsuccessful, empty response.
failure :: Response

-- | Exits fast with the given response. The response is encoded as JSON,
--   printed to <tt>stdout</tt> and then the program is exited with
--   <tt>0</tt> (success).
--   
--   The program always exits with success even if the response was a
--   failure one. This is to distinguish between bad calls to the binary
--   and bad commands to the werewolf engine.
exitWith :: MonadIO m => Response -> m a

-- | Creates a public message with the given text.
publicMessage :: Text -> Message

-- | <pre>
--   privateMessage to message
--   </pre>
--   
--   Creates a private message to <tt>to</tt> with the given text.
privateMessage :: Text -> Text -> Message

-- | <pre>
--   groupMessages tos message
--   </pre>
--   
--   Creates multiple private messages (1 to each recipient) with the given
--   text.
groupMessages :: [Text] -> Text -> [Message]

-- | Defines whether a role is diurnal or nocturnal. I.e., if the role's
--   turn occurs during the day or night.
data Activity
Diurnal :: Activity
Nocturnal :: Activity

-- | The <a>NoOne</a> allegiance is used for the Loners. It is not used to
--   determine who has won (i.e., if one Loner wins, the others still
--   lose).
data Allegiance
NoOne :: Allegiance
Necromancer :: Allegiance
Villagers :: Allegiance
Werewolves :: Allegiance

-- | Role definitions require only a few pieces of information.
--   
--   The <tt>balance</tt> attribute on a role indicates the allegiance it
--   favours. For example, a Simple Werewolf has a balance of -4 while the
--   Seer has a balance of 2. A balance of 0 means it favours neither
--   allegiance.
--   
--   N.B., role equality is defined on just the <a>tag</a> as a role's
--   <a>allegiance</a> may change throughout the game.
data Role
_NoOne :: Prism' Allegiance ()
_Necromancer :: Prism' Allegiance ()
_Villagers :: Prism' Allegiance ()
_Werewolves :: Prism' Allegiance ()
_Diurnal :: Prism' Activity ()
_Nocturnal :: Prism' Activity ()
allegiance :: Lens' Role Allegiance
balance :: Lens' Role Int
description :: Lens' Role Text
rules :: Lens' Role Text
tag :: Lens' Role Text

-- | A list containing all the roles defined in this file.
allRoles :: [Role]

-- | A list containing roles that are restricted to a single instance per
--   <tt>Game</tt>.
--   
--   <pre>
--   <a>restrictedRoles</a> = <a>allRoles</a> \\ [<a>simpleVillagerRole</a>, <a>simpleWerewolfRole</a>, <a>spitefulVillagerRole</a>, <a>zombieRole</a>]
--   
--   </pre>
restrictedRoles :: [Role]

-- | <i>Abandoned by their parents as a child, with no-one wanting to look
--   after another mouth to</i> <i>feed, the Orphan was left to fend for
--   themself. No-one looked twice at the Orphan and even</i> <i>fewer
--   showed kindness towards the lonely child. One day however, one
--   townsperson changed all</i> <i>this. He offered the Orphan food, water
--   and a roof over their head. Grateful for his chairty</i> <i>and
--   affection, the Orphan made him their role model. Pray that no ill
--   should befall their</i> <i>role model, for they are the only one
--   conforming the Orphan as a Villager.</i>
--   
--   On the first night, the Orphan chooses a player to become their role
--   model. So long as the role model is alive, the Orphan is a Villager.
--   If however the role model is eliminated, then the Orphan becomes a
--   Werewolf.
orphanRole :: Role

-- | <i>Hah, maybe not as liked as the Jester, but the Drunk sure does
--   their fair share of stupid</i> <i>things in the night! No-one knows if
--   they even actually make it home; sometimes people see</i> <i>them
--   sleeping outside the Blacksmith's home, others say they see them
--   wandering towards the</i> <i>woods. It's pointless quizzing the
--   Village Drunk in the morning about their doings; they can</i> <i>never
--   remember what they did!</i>
--   
--   The Village Drunk is initially aligned with the Villagers.
--   
--   On the third night the Village Drunk sobers up and is randomly
--   assigned a new alignment, either Villagers or Werewolves.
villageDrunkRole :: Role

-- | <i>Normally the Dullahan carries their head under one arm, however
--   while amongst the Villagers,</i> <i>they ere on the side of caution
--   and rest it in a more traditional place. The Dullahan rides a</i>
--   <i>black horse as dark as night and hunts down travellers in the
--   countryside. Beware if the</i> <i>Dullahan knows your name, for you
--   are then marked for death and you should avoid them at all</i> /costs.
--   
--   The Dullahan is given a list of player names at the start of the game.
--   To win, they must eliminate all of them before the end of the game.
dullahanRole :: Role

-- | <i>Long ago during the War in Heaven, angels fell from the sky as one
--   by one those that followed</i> <i>Lucifer were defeated. For centuries
--   they lived amongst mortal Villagers as punishment for</i> <i>their
--   sins and wrongdoings. The Fallen Angel was one such being and is now
--   one of the few</i> <i>angels left on Earth. Nothing is worse
--   punishment for them, the Fallen Angel yearns for death</i> <i>to once
--   again be free!</i>
--   
--   The Fallen Angel wins if they manage to get lynched by the Villagers
--   before the end of the game.
fallenAngelRole :: Role

-- | <i>The dead are feared among the living; the dead outnumber the
--   living. In most villages the</i> <i>dead remain that way, but not when
--   the Necromancer is present. The Necromancer devoted their</i> <i>life
--   to learning black magic and methods of bringing people back to life.
--   Unfortunately this</i> <i>art is hard to perfect and all they can
--   manage to bring back are soulless Zombies.</i>
--   
--   Once per game the Necromancer can choose to resurrect all dead players
--   as Zombies. The Zombies are aligned with the Necromancer and they
--   cannot be lynched or devoured.
--   
--   If the Necromancer is killed, all Zombies die with them.
--   
--   The Necromancer and Zombies win if they are the last ones alive.
necromancerRole :: Role

-- | <i>A loyal follower of the Necromancer. A Zombie has no mind of its
--   own and blindly obeys every</i> <i>command of their master.</i>
--   
--   A Zombie wins with the Necromancer. They cannot be killed, however
--   they die when the Necromancer dies.
zombieRole :: Role

-- | <i>Awareness comes easy to the Beholder. They listen to their senses
--   and trust their hunches.</i> <i>Over the years the Beholder has grown
--   to know a certain few of the village just by paying</i> <i>attention.
--   Little cues here and there, the way someone talks, the way they move -
--   it all</i> <i>gives clues as to their true nature and role.</i>
--   
--   At the start of the game the Beholder is informed the Seer's identity.
beholderRole :: Role

-- | <i>Never trust a politician. Nor a Crooked Senator for that matter.
--   The Crooked Senator may seem</i> <i>like he has the village's best
--   interests at heart, but let's be honest, when put in a tough</i>
--   <i>situation he looks after no-one but himself. Even when safe, the
--   Crooked Senator may decide</i> <i>to toy with the Villagers' emotions
--   and try pit them against one another.</i>
--   
--   The Crooked Senator looks at the village votes as they come in.
crookedSenatorRole :: Role

-- | <i>How honoured we are to be in the presence of such a noble leader.
--   The return of the Druid</i> <i>marks an exceptional time in Fougères's
--   history! Friend of the woodland creatures, practiced</i>
--   <i>philosopher and now, with the help of Ferina their companion, a
--   bane to the Werewolves</i> <i>themselves! My does she have a nose on
--   her, strong enough to sniff out lycanthropes in close</i>
--   <i>proximity! Listen for her grunt and heed her warning for she will
--   not let you down.</i>
--   
--   Each morning when Ferina wakes from her slumber she will be alert and
--   cautious. If the Druid is next to a Werewolf in the player
--   <tt>circle</tt> then Ferina will grunt in warning.
druidRole :: Role

-- | <i>A skilled marksman with quick reflexes. In the unfortunate
--   situation that they are jumped and</i> <i>killed unjustly, they let
--   off a shot at their attacker, killing them instantly. The Hunter</i>
--   <i>never misses.</i>
--   
--   If the Hunter is killed they choose one player, believed to be an
--   attacker, to kill immediately.
hunterRole :: Role

-- | <i>Every village needs a Jester; they're so stupid, but provide so
--   much entertainment! The</i> <i>Jester may not have any special
--   abilities, but at least no-one in the village wants to hurt</i>
--   <i>them.</i>
--   
--   If the village votes to lynch the Jester, their identity is revealed.
--   The village realise there's no point in burning them and so they are
--   set free.
--   
--   The Jester continues to play but may no longer vote as no-one can take
--   them seriously.
jesterRole :: Role

-- | <i>Traditionally a Werewolf once transformed loses all memories and
--   personality. Over years of</i> <i>transforming, the Lycan has slowly
--   evolved and learnt how to retain themself. Night after</i> <i>night of
--   devouring with the other Werewolves took its toll. The screams alone
--   were enough to</i> <i>turn the Lycan and make them question their true
--   nature.</i>
--   
--   The Lycan is aligned with the Villagers, but appears to nature-seeing
--   roles (e.g., the Seer) as a Werewolf.
lycanRole :: Role

-- | <i>A beautiful flirt, the Medusa is aligned with the Villagers but
--   harbours a terrifying secret.</i> <i>During the day they are well
--   known in the village of Fougères for their stunning appearance</i>
--   <i>which captures the eye and love of all the townsfolk. However when
--   their secret takes ahold</i> <i>at sundown, their true self is
--   revealed. Any who gaze upon her true form would see live</i> <i>snakes
--   for hair and the few that further look into her eyes are turned to
--   stone.</i>
--   
--   If Medusa attracts the attention of a Werewolf during the night and is
--   devoured, the first Werewolf to their left in the player
--   <tt>circle</tt> will catch their gaze and turn to stone, instantly
--   killing the lupine predator.
medusaRole :: Role

-- | <i>Originally rejected by the townsfolk, the Oracle's prophetic
--   divinations has earned trust</i> <i>within the village. With constant
--   precognition - and concern for the future - the Oracle</i> <i>knows
--   the village will only live if they work together.</i>
--   
--   Each night the Oracle chooses a player to divine. They are then
--   informed of the player's role the following morning. This wisdom is
--   for the Oracle to use to ensure the future of Fougères.
oracleRole :: Role

-- | <i>The Protector is one of the few pure of heart and altruistic
--   Villagers; they are forever</i> <i>putting others needs above their
--   own. Each night they fight against the Werewolves with</i> <i>naught
--   but a sword and shield, potentially saving an innocents life.</i>
--   
--   Each night the Protector chooses a player deemed worthy of their
--   protection. That player is safe for that night (and only that night)
--   against the Werewolves.
--   
--   The Protector may not protect the same player two nights in a row.
protectorRole :: Role

-- | <i>The Saint, also historically known as a hallow, is recognized as
--   having an exceptional degree of</i> <i>holiness and likeness to God.
--   They are a humble Villager and shine light on these dark times.</i>
--   <i>Extinguishing this light would not be wise</i>
--   
--   If the Saint is lynched by the village, all who voted for them die.
saintRole :: Role

-- | <i>Werewolves don't just spring up out of the ground! That's where
--   dwarves come from. Clearly</i> <i>someone is to blame for this
--   affliction to Fougères. Unluckily for the Scapegoat, since</i>
--   <i>no-one actually knows who brought them here, the blame is always
--   laid upon them!</i>
--   
--   If the village's vote ends in a tie, it's the Scapegoat who is
--   eliminated instead of no-one.
--   
--   In this event, the Scapegoat has one last task to complete: they must
--   choose whom is permitted to vote or not on the next day.
scapegoatRole :: Role

-- | <i>The Seer has the ability to see into fellow townsfolk and determine
--   their true nature. This</i> <i>ability to see is not given out
--   lightly, for certain it is a gift! The visions will always be</i>
--   <i>true, but only for the present as not even the Seer knows what the
--   future holds.</i>
--   
--   Each night the Seer sees the allegiance of one player of their choice.
seerRole :: Role

-- | <i>A simple, ordinary townsperson in every way. Some may be cobblers,
--   others bakers or even</i> <i>nobles. No matter their differences
--   though, the plight of Werewolves in Fougères unites all</i> <i>the
--   Villagers in this unfortunate time.</i>
--   
--   The Simple Villager has no special abilities, they must use their
--   guile to determine whom among them is not who they say they are.
simpleVillagerRole :: Role

-- | <i>A simple, ordinary townsperson in every way. Some may be cobblers,
--   others bakers or even</i> <i>nobles. No matter their differences
--   though, the plight of Werewolves in Fougères unites all</i> <i>the
--   Villagers in this unfortunate time.</i>
--   
--   <i>Yet the Spiteful Villager has no loyalty in the afterlife; whoever
--   causes them harm may find</i> <i>themselves in trouble.</i>
--   
--   When the Spiteful Villager is killed, they are informed of everyone's
--   roles and may haunt the village as they wish.
spitefulVillagerRole :: Role

-- | <i>The True Villager has a heart and soul as clear as day! Their
--   allegiance and devotion to the</i> <i>village are beyond reproach. If
--   there is one person whom you should confide in, listen to and</i>
--   <i>trust, it is the True Villager.</i>
--   
--   At the start of the game the True Villager's identity is revealed.
trueVillagerRole :: Role

-- | <i>Somehow forgotten with the coming of the Werewolves, the Witch has
--   a chance to prove themself</i> <i>valuable to the village and maybe
--   abolish the absurd pastime of burning and drowning their</i> <i>cult.
--   The Witch is blessed (or maybe cursed) with the ability to make two
--   powerful potions;</i> <i>one of which heals a victim of the
--   Werewolves, the other poisons a player.</i>
--   
--   The Witch is called after the Werewolves. They are able to heal and
--   poison one player per game. There is no restriction on using both
--   potions in one night or on healing themself.
witchRole :: Role

-- | <i>The Alpha Wolf leads the Werewolves in the raids against Fougères
--   each night and not even the</i> <i>Seer can see them coming. If the
--   Werewolves caused the Villagers to question and accuse one</i>
--   <i>another beforehand, the Alpha Wolf eliminates any shred of humanity
--   left. No-one can be</i> <i>trusted anymore and no-one knows the
--   truth.</i>
--   
--   The Alpha Wolf appears to nature-seeing roles (e.g., the Seer) as a
--   Villager.
alphaWolfRole :: Role

-- | <i>The Simple Werewolf is a fearsome lupine, cunning like no other
--   creature that roams the</i> <i>forest. Their origin is unknown, but
--   that matters little, for they present a grave threat to</i>
--   <i>Fougères. While each day they hide in plain sight as an ordinary
--   Villager, each night they</i> <i>transform and devour an innocent.
--   There is little hope left for the village.</i>
--   
--   A Werewolf may never devour another Werewolf.
simpleWerewolfRole :: Role

-- | Surprise surprise, players may be <a>Dead</a> or <a>Alive</a>.
data State
Alive :: State
Dead :: State

-- | A player has a <a>name</a>, <a>role</a> and <a>state</a>. Any stateful
--   information needed for a player's <tt>role</tt> is held on the
--   <tt>Game</tt> itself.
--   
--   N.B., player equality is defined on just the <a>name</a>.
data Player
name :: Lens' Player Text
role :: Lens' Player Role
state :: Lens' Player State
_Alive :: Prism' State ()
_Dead :: Prism' State ()

-- | Creates a new <a>Alive</a> player.
newPlayer :: Text -> Role -> Player

-- | The traversal of <a>Player</a>s with an <a>alphaWolfRole</a>.
--   
--   <pre>
--   <a>alphaWolf</a> = <a>role</a> . <a>only</a> <a>alphaWolfRole</a>
--   </pre>
alphaWolf :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>beholderRole</a>.
--   
--   <pre>
--   <a>beholder</a> = <a>role</a> . <a>only</a> <a>beholderRole</a>
--   </pre>
beholder :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>crookedSenatorRole</a>.
--   
--   <pre>
--   <a>crookedSenator</a> = <a>role</a> . <a>only</a> <a>crookedSenatorRole</a>
--   </pre>
crookedSenator :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>dullahanRole</a>.
--   
--   <pre>
--   <a>dullahan</a> = <a>role</a> . <a>only</a> <a>dullahanRole</a>
--   </pre>
dullahan :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>druidRole</a>.
--   
--   <pre>
--   <a>druid</a> = <a>role</a> . <a>only</a> <a>druidRole</a>
--   </pre>
druid :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>fallenAngelRole</a>.
--   
--   <pre>
--   <a>fallenAngel</a> = <a>role</a> . <a>only</a> <a>fallenAngelRole</a>
--   </pre>
fallenAngel :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>hunterRole</a>.
--   
--   <pre>
--   <a>hunter</a> = <a>role</a> . <a>only</a> <a>hunterRole</a>
--   </pre>
hunter :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>jesterRole</a>.
--   
--   <pre>
--   <a>jester</a> = <a>role</a> . <a>only</a> <a>jesterRole</a>
--   </pre>
jester :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>lycanRole</a>.
--   
--   <pre>
--   <a>lycan</a> = <a>role</a> . <a>only</a> <a>lycanRole</a>
--   </pre>
lycan :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>medusaRole</a>.
--   
--   <pre>
--   <a>medusa</a> = <a>role</a> . <a>only</a> <a>medusaRole</a>
--   </pre>
medusa :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>necromancerRole</a>.
--   
--   <pre>
--   <a>necromancer</a> = <a>role</a> . <a>only</a> <a>necromancerRole</a>
--   </pre>
necromancer :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>oracleRole</a>.
--   
--   <pre>
--   <a>oracle</a> = <a>role</a> . <a>only</a> <a>oracleRole</a>
--   </pre>
oracle :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with an <a>orphanRole</a>.
--   
--   <pre>
--   <a>orphan</a> = <a>role</a> . <a>only</a> <a>orphanRole</a>
--   </pre>
orphan :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>protectorRole</a>.
--   
--   <pre>
--   <a>protector</a> = <a>role</a> . <a>only</a> <a>protectorRole</a>
--   </pre>
protector :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>saintRole</a>.
--   
--   <pre>
--   <a>saint</a> = <a>role</a> . <a>only</a> <a>saintRole</a>
--   </pre>
saint :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>scapegoatRole</a>.
--   
--   <pre>
--   <a>scapegoat</a> = <a>role</a> . <a>only</a> <a>scapegoatRole</a>
--   </pre>
scapegoat :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>seerRole</a>.
--   
--   <pre>
--   <a>seer</a> = <a>role</a> . <a>only</a> <a>seerRole</a>
--   </pre>
seer :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>simpleVillagerRole</a>.
--   
--   <pre>
--   <a>simpleVillager</a> = <a>role</a> . <a>only</a> <a>simpleVillagerRole</a>
--   </pre>
simpleVillager :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>simpleWerewolfRole</a>.
--   
--   <pre>
--   <a>simpleWerewolf</a> = <a>role</a> . <a>only</a> <a>simpleWerewolfRole</a>
--   </pre>
simpleWerewolf :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>spitefulVillagerRole</a>.
--   
--   <pre>
--   <a>spitefulVillager</a> = <a>role</a> . <a>only</a> <a>spitefulVillagerRole</a>
--   </pre>
spitefulVillager :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>trueVillagerRole</a>.
--   
--   <pre>
--   <a>trueVillager</a> = <a>role</a> . <a>only</a> <a>trueVillagerRole</a>
--   </pre>
trueVillager :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>villageDrunkRole</a>.
--   
--   <pre>
--   <a>villageDrunk</a> = <a>role</a> . <a>only</a> <a>villageDrunkRole</a>
--   </pre>
villageDrunk :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>witchRole</a>.
--   
--   <pre>
--   <a>witch</a> = <a>role</a> . <a>only</a> <a>witchRole</a>
--   </pre>
witch :: Traversal' Player ()

-- | The traversal of <a>Player</a>s with a <a>zombieRole</a>.
--   
--   <pre>
--   <a>zombie</a> = <a>role</a> . <a>only</a> <a>zombieRole</a>
--   </pre>
zombie :: Traversal' Player ()

-- | The traversal of <a>Player</a>s aligned with <a>NoOne</a>.
--   
--   <pre>
--   <a>loner</a> = <a>role</a> . <a>allegiance</a> . <a>_NoOne</a>
--   </pre>
loner :: Traversal' Player ()

-- | The traversal of <a>Player</a>s aligned with the <a>Villagers</a>.
--   
--   <pre>
--   <a>villager</a> = <a>role</a> . <a>allegiance</a> . <a>_Villagers</a>
--   </pre>
villager :: Traversal' Player ()

-- | The traversal of <a>Player</a>s aligned with the <a>Werewolves</a>.
--   
--   <pre>
--   <a>werewolf</a> = <a>role</a> . <a>allegiance</a> . <a>_Werewolves</a>
--   </pre>
werewolf :: Traversal' Player ()

-- | The traversal of <a>Player</a> names.
--   
--   <pre>
--   <a>names</a> = <a>traverse</a> . <a>name</a>
--   </pre>
names :: Traversable t => Traversal' (t Player) Text

-- | The traversal of <a>Player</a> roles.
--   
--   <pre>
--   <a>roles</a> = <a>traverse</a> . <a>role</a>
--   </pre>
roles :: Traversable t => Traversal' (t Player) Role

-- | The traversal of <a>Player</a> states.
--   
--   <pre>
--   <a>states</a> = <a>traverse</a> . <a>state</a>
--   </pre>
states :: Traversable t => Traversal' (t Player) State

-- | The traversal of <a>Player</a>s with the given name.
--   
--   <pre>
--   <a>named</a> name' = <a>filteredBy</a> . <a>name</a> name'
--   </pre>
named :: Text -> Traversal' Player Player

-- | The traversal of <a>alphaWolf</a> <a>Player</a>s.
--   
--   <pre>
--   <a>alphaWolves</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>alphaWolf</a>)
--   </pre>
alphaWolves :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>beholder</a> <a>Player</a>s.
--   
--   <pre>
--   <a>beholders</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>beholder</a>)
--   </pre>
beholders :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>crookedSenator</a> <a>Player</a>s.
--   
--   <pre>
--   <a>crookedSenators</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>crookedSenator</a>)
--   </pre>
crookedSenators :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>dullahan</a> <a>Player</a>s.
--   
--   <pre>
--   <a>dullahans</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>dullahan</a>)
--   </pre>
dullahans :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>druid</a> <a>Player</a>s.
--   
--   <pre>
--   <a>druids</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>druid</a>)
--   </pre>
druids :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>fallenAngel</a> <a>Player</a>s.
--   
--   <pre>
--   <a>fallenAngels</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>fallenAngel</a>)
--   </pre>
fallenAngels :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>hunter</a> <a>Player</a>s.
--   
--   <pre>
--   <a>hunters</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>hunter</a>)
--   </pre>
hunters :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>jester</a> <a>Player</a>s.
--   
--   <pre>
--   <a>jesters</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>jester</a>)
--   </pre>
jesters :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>lycan</a> <a>Player</a>s.
--   
--   <pre>
--   <a>lycans</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>lycan</a>)
--   </pre>
lycans :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>medusa</a> <a>Player</a>s.
--   
--   <pre>
--   <a>medusas</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>medusa</a>)
--   </pre>
medusas :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>necromancer</a> <a>Player</a>s.
--   
--   <pre>
--   <a>necromancers</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>necromancer</a>)
--   </pre>
necromancers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>oracle</a> <a>Player</a>s.
--   
--   <pre>
--   <a>oracles</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>oracle</a>)
--   </pre>
oracles :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>orphan</a> <a>Player</a>s.
--   
--   <pre>
--   <a>orphans</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>orphan</a>)
--   </pre>
orphans :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>protector</a> <a>Player</a>s.
--   
--   <pre>
--   <a>protectors</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>protector</a>)
--   </pre>
protectors :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>saint</a> <a>Player</a>s.
--   
--   <pre>
--   <a>saints</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>saint</a>)
--   </pre>
saints :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>scapegoat</a> <a>Player</a>s.
--   
--   <pre>
--   <a>scapegoats</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>scapegoat</a>)
--   </pre>
scapegoats :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>seer</a> <a>Player</a>s.
--   
--   <pre>
--   <a>seers</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>seer</a>)
--   </pre>
seers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>simpleVillager</a> <a>Player</a>s.
--   
--   <pre>
--   <a>simpleVillagers</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>simpleVillager</a>)
--   </pre>
simpleVillagers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>simpleWerewolf</a> <a>Player</a>s.
--   
--   <pre>
--   <a>simpleWerewolves</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>simpleWerewolf</a>)
--   </pre>
simpleWerewolves :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>spitefulVillager</a> <a>Player</a>s.
--   
--   <pre>
--   <a>spitefulVillagers</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>spitefulVillager</a>)
--   </pre>
spitefulVillagers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>trueVillager</a> <a>Player</a>s.
--   
--   <pre>
--   <a>trueVillagers</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>trueVillager</a>)
--   </pre>
trueVillagers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>villageDrunk</a> <a>Player</a>s.
--   
--   <pre>
--   <a>villageDrunks</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>villageDrunk</a>)
--   </pre>
villageDrunks :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>witch</a> <a>Player</a>s.
--   
--   <pre>
--   <a>witches</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>witch</a>)
--   </pre>
witches :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>zombie</a> <a>Player</a>s.
--   
--   <pre>
--   <a>zombies</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>zombie</a>)
--   </pre>
zombies :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>loner</a> <a>Player</a>s.
--   
--   <pre>
--   <a>loners</a> = <a>traverse</a> . <a>filtered</a> . (<a>is</a> <a>loner</a>)
--   </pre>
loners :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>villager</a> <a>Player</a>s.
--   
--   <pre>
--   <a>villagers</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>villager</a>)
--   </pre>
villagers :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>werewolf</a> <a>Player</a>s.
--   
--   <pre>
--   <a>werewolves</a> = <a>traverse</a> . <a>filtered</a> (<a>is</a> <a>werewolf</a>)
--   </pre>
werewolves :: Traversable t => Traversal' (t Player) Player

-- | The traversal of <a>Alive</a> <a>Player</a>s.
--   
--   <pre>
--   <a>alive</a> = <a>filtered</a> (<a>has</a> $ <a>state</a> . <a>_Alive</a>)
--   </pre>
alive :: Traversal' Player Player

-- | The traversal of <a>Dead</a> <a>Player</a>s.
--   
--   <pre>
--   <a>dead</a> = <a>filtered</a> (<a>has</a> $ <a>state</a> . <a>_Dead</a>)
--   </pre>
dead :: Traversal' Player Player

-- | Variant definitions require only a few pieces of information.
data Variant

-- | A list containing all the variants defined in this file.
allVariants :: [Variant]
standardVariant :: Variant
noRoleKnowledgeVariant :: Variant
noRoleKnowledgeOrRevealVariant :: Variant
noRoleRevealVariant :: Variant
spitefulVillageVariant :: Variant

-- | The traversal of <a>standard</a> <a>Variant</a>s.
--   
--   <pre>
--   <a>standard</a> = <a>only</a> <a>standardVariant</a>
--   </pre>
standard :: Traversal' Variant ()

-- | The traversal of <a>noRoleKnowledge</a> <a>Variant</a>s.
--   
--   <pre>
--   <a>noRoleKnowledge</a> = <a>only</a> <a>noRoleKnowledgeVariant</a>
--   </pre>
noRoleKnowledge :: Traversal' Variant ()

-- | The traversal of <a>noRoleKnowledgeOrReveal</a> <a>Variant</a>s.
--   
--   <pre>
--   <a>noRoleKnowledgeOrReveal</a> = <a>only</a> <a>noRoleKnowledgeOrRevealVariant</a>
--   </pre>
noRoleKnowledgeOrReveal :: Traversal' Variant ()

-- | The traversal of <a>noRoleReveal</a> <a>Variant</a>s.
--   
--   <pre>
--   <a>noRoleReveal</a> = <a>only</a> <a>noRoleRevealVariant</a>
--   </pre>
noRoleReveal :: Traversal' Variant ()

-- | The traversal of <a>spitefulVillage</a> <a>Variant</a>s.
--   
--   <pre>
--   <a>spitefulVillage</a> = <a>only</a> <a>spitefulVillageVariant</a>
--   </pre>
spitefulVillage :: Traversal' Variant ()

-- | Most of these are fairly self-explainable (the turn stages).
--   <a>Sunrise</a> and <a>Sunset</a> are provided as meaningful breaks
--   between the day and night as, for example, a <a>VillagesTurn</a> may
--   not always be available (curse that retched Scapegoat).
--   
--   Once the game reaches a turn stage, it requires a <i>command</i> to
--   help push it past. Often only certain roles and commands may be
--   performed at any given stage.
data Stage
DruidsTurn :: Stage
GameOver :: Stage
HuntersTurn1 :: Stage
HuntersTurn2 :: Stage
Lynching :: Stage
NecromancersTurn :: Stage
OraclesTurn :: Stage
OrphansTurn :: Stage
ProtectorsTurn :: Stage
ScapegoatsTurn :: Stage
SeersTurn :: Stage
Sunrise :: Stage
Sunset :: Stage
VillageDrunksTurn :: Stage
VillagesTurn :: Stage
WerewolvesTurn :: Stage
WitchsTurn :: Stage

-- | There are a few key pieces of information that a game always needs to
--   hold. These are:
--   
--   <ul>
--   <li>the <a>stage</a>,</li>
--   <li>the <a>round</a> number and</li>
--   <li>the <a>players</a>.</li>
--   </ul>
--   
--   Any further fields on the game are specific to one or more roles (and
--   their respective turns!). Some of the additional fields are reset each
--   round (e.g., the Seer's <a>see</a>) while others are kept around for
--   the whole game (e.g., the Orphan's <a>roleModel</a>).
data Game
boots :: Lens' Game (Map Text [Text])
chosenVoters :: Lens' Game [Text]
deadRaised :: Lens' Game Bool
divine :: Lens' Game (Maybe Text)
fallenAngelLynched :: Lens' Game Bool
healUsed :: Lens' Game Bool
hunterRetaliated :: Lens' Game Bool
jesterRevealed :: Lens' Game Bool
marks :: Lens' Game [Text]
passed :: Lens' Game Bool
players :: Lens' Game [Player]
poison :: Lens' Game (Maybe Text)
poisonUsed :: Lens' Game Bool
priorProtect :: Lens' Game (Maybe Text)
protect :: Lens' Game (Maybe Text)
roleModel :: Lens' Game (Maybe Text)
round :: Lens' Game Int
scapegoatBlamed :: Lens' Game Bool
see :: Lens' Game (Maybe Text)
stage :: Lens' Game Stage
variant :: Lens' Game Variant
votes :: Lens' Game (Map Text Text)
_DruidsTurn :: Prism' Stage ()
_GameOver :: Prism' Stage ()
_HuntersTurn1 :: Prism' Stage ()
_HuntersTurn2 :: Prism' Stage ()
_Lynching :: Prism' Stage ()
_NecromancersTurn :: Prism' Stage ()
_OraclesTurn :: Prism' Stage ()
_OrphansTurn :: Prism' Stage ()
_ProtectorsTurn :: Prism' Stage ()
_ScapegoatsTurn :: Prism' Stage ()
_SeersTurn :: Prism' Stage ()
_Sunrise :: Prism' Stage ()
_Sunset :: Prism' Stage ()
_VillageDrunksTurn :: Prism' Stage ()
_VillagesTurn :: Prism' Stage ()
_WerewolvesTurn :: Prism' Stage ()
_WitchsTurn :: Prism' Stage ()
activity :: (Functor f, Contravariant f) => (Activity -> f Activity) -> Stage -> f Stage

-- | All of the <a>Stage</a>s in the order that they should occur.
allStages :: [Stage]

-- | An infinite cycle of all <a>Stage</a>s in the order that they should
--   occur.
stageCycle :: [Stage]

-- | Checks whether the stage is available for the given <a>Game</a>. Most
--   often this just involves checking if there is an applicable role
--   alive, but sometimes it is more complex.
--   
--   One of the more complex checks here is for the <a>VillagesTurn</a>. If
--   the Fallen Angel is in play, then the <a>VillagesTurn</a> is available
--   on the first day rather than only after the first night.
stageAvailable :: Game -> Stage -> Bool

-- | Creates a new <a>Game</a> with the given players. No validations are
--   performed here, those are left to the binary.
newGame :: Variant -> [Player] -> Game

-- | The traversal of the <a>votes</a> victim's name. This is the player,
--   if they exist, that received the majority of the votes. This could be
--   an empty list depending on whether the votes were in conflict.
votee :: Fold Game Player

-- | The traversal of the allowed voters during the <a>VillagesTurn</a> or
--   <a>WerewolvesTurn</a>. In a standard game, this is all <a>Alive</a>
--   players. However there are two scenarios for the <a>VillagesTurn</a>
--   that may change this:
--   
--   1) if the <a>scapegoat</a> has chosen some <a>chosenVoters</a>, it is
--   these players. 2) if the <a>jester</a> has been revealed, he may not
--   vote.
allowedVoters :: Fold Game Player

-- | The traversal of all <a>Alive</a> players that have yet to vote. This
--   is synonymous to <tt>voters - Map.keys votes</tt>
pendingVoters :: Fold Game Player

-- | The traversal of <a>Game</a>s on the first round.
firstRound :: Prism' Game Game

-- | The traversal of <a>Game</a>s on the second round.
secondRound :: Prism' Game Game

-- | The traversal of <a>Game</a>s on the third round.
thirdRound :: Prism' Game Game

-- | Gets all the <a>marks</a> in a game (which is names only) and maps
--   them to their player.
getMarks :: Game -> [Player]

-- | Queries whether anyone has won.
hasAnyoneWon :: Game -> Bool

-- | Queries whether the Dullahan has won. The Dullahan wins if they manage
--   to eliminate all their marks.
hasDullahanWon :: Game -> Bool

-- | Queries whether the Fallen Angel has won. The Fallen Angel wins if
--   they manage to get themselves lynched by the Villagers.
hasFallenAngelWon :: Game -> Bool

-- | Queries whether the Necromancer has won. The <a>Necromancer</a> wins
--   if they and their zombies are the only players surviving.
--   
--   N.B., the Jester is not considered when determining whether the
--   <a>Necromancer</a> has won.
hasNecromancerWon :: Game -> Bool

-- | Queries whether the <a>Villagers</a> have won. The <a>Villagers</a>
--   win if they are the only players surviving.
--   
--   N.B., the Dullahan and Fallen Angel are not considered when
--   determining whether the <a>Villagers</a> have won.
hasVillagersWon :: Game -> Bool

-- | Queries whether the <a>Werewolves</a> have won. The <a>Werewolves</a>
--   win if they are the only players surviving.
hasWerewolvesWon :: Game -> Bool

-- | Queries whether everyone has lost.
hasEveryoneLost :: Game -> Bool
