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

-- | Embedded domain-specific language for declarative graphics
--   
--   Diagrams is a flexible, extensible EDSL for creating graphics of many
--   types. Graphics can be created in arbitrary vector spaces and rendered
--   with multiple backends. diagrams-lib provides a standard library of
--   primitives and operations for creating diagrams. To get started using
--   it, see the Diagrams module, and refer to the tutorials and
--   documentation on the diagrams website,
--   http://diagrams.github.io.
@package diagrams-lib
@version 1.4.6.2

-- | Diagrams may have attributes which affect the way they are
--   rendered. This module defines some common attributes; particular
--   backends may also define more backend-specific attributes.
--   
--   Every attribute type must have a semigroup structure, that is,
--   an associative binary operation for combining two attributes into one.
--   Unless otherwise noted, all the attributes defined here use the
--   Last structure, that is, combining two attributes simply keeps
--   the second one and throws away the first. This means that child
--   attributes always override parent attributes.
module Diagrams.Attributes
ultraThin :: OrderedField n => Measure n
veryThin :: OrderedField n => Measure n
thin :: OrderedField n => Measure n
medium :: OrderedField n => Measure n
thick :: OrderedField n => Measure n
veryThick :: OrderedField n => Measure n
ultraThick :: OrderedField n => Measure n
none :: OrderedField n => Measure n
tiny :: OrderedField n => Measure n
verySmall :: OrderedField n => Measure n
small :: OrderedField n => Measure n
normal :: OrderedField n => Measure n
large :: OrderedField n => Measure n
veryLarge :: OrderedField n => Measure n
huge :: OrderedField n => Measure n

-- | Line widths specified on child nodes always override line widths
--   specified at parent nodes.
data LineWidth n
getLineWidth :: LineWidth n -> n
_LineWidth :: Iso' (LineWidth n) n
_LineWidthM :: Iso' (LineWidthM n) (Measure n)

-- | Set the line (stroke) width.
lineWidth :: (N a ~ n, HasStyle a, Typeable n) => Measure n -> a -> a

-- | Apply a LineWidth attribute.
lineWidthM :: (N a ~ n, HasStyle a, Typeable n) => LineWidthM n -> a -> a

-- | Lens onto a measured line width in a style.
_lineWidth :: (Typeable n, OrderedField n) => Lens' (Style v n) (Measure n)

-- | Lens onto a measured line width in a style.
_lw :: (Typeable n, OrderedField n) => Lens' (Style v n) (Measure n)

-- | Lens onto the unmeasured linewith attribute. This is useful for
--   backends to use on styles once they have been unmeasured. Using on a
--   diagram style could lead to unexpected results.
_lineWidthU :: Typeable n => Lens' (Style v n) (Maybe n)

-- | Default for lineWidth.
lw :: (N a ~ n, HasStyle a, Typeable n) => Measure n -> a -> a

-- | A convenient synonym for 'lineWidth (normalized w)'.
lwN :: (N a ~ n, HasStyle a, Typeable n, Num n) => n -> a -> a

-- | A convenient synonym for 'lineWidth (output w)'.
lwO :: (N a ~ n, HasStyle a, Typeable n) => n -> a -> a

-- | A convenient sysnonym for 'lineWidth (local w)'.
lwL :: (N a ~ n, HasStyle a, Typeable n, Num n) => n -> a -> a

-- | A convenient synonym for 'lineWidth (global w)'.
lwG :: (N a ~ n, HasStyle a, Typeable n, Num n) => n -> a -> a

-- | Create lines that are dashing... er, dashed.
data Dashing n
Dashing :: [n] -> n -> Dashing n
getDashing :: Dashing n -> Dashing n

-- | Set the line dashing style.
dashing :: (N a ~ n, HasStyle a, Typeable n) => [Measure n] -> Measure n -> a -> a

-- | A convenient synonym for 'dashing (normalized w)'.
dashingN :: (N a ~ n, HasStyle a, Typeable n, Num n) => [n] -> n -> a -> a

-- | A convenient synonym for 'dashing (output w)'.
dashingO :: (N a ~ n, HasStyle a, Typeable n) => [n] -> n -> a -> a

-- | A convenient sysnonym for 'dashing (local w)'.
dashingL :: (N a ~ n, HasStyle a, Typeable n, Num n) => [n] -> n -> a -> a

-- | A convenient synonym for 'dashing (global w)'.
dashingG :: (N a ~ n, HasStyle a, Typeable n, Num n) => [n] -> n -> a -> a

-- | Lens onto a measured dashing attribute in a style.
_dashing :: Typeable n => Lens' (Style v n) (Maybe (Measured n (Dashing n)))

-- | Lens onto the unmeasured Dashing attribute. This is useful for
--   backends to use on styles once they have been unmeasured. Using on a
--   diagram style could lead to unexpected results.
_dashingU :: Typeable n => Lens' (Style v n) (Maybe (Dashing n))

-- | The Color type class encompasses color representations which
--   can be used by the Diagrams library. Instances are provided for both
--   the Colour and AlphaColour types from the
--   Data.Colour library.
class Color c

-- | Convert a color to its standard representation, AlphaColour.
toAlphaColour :: Color c => c -> AlphaColour Double

-- | Convert from an AlphaColour Double. Note that this direction may lose
--   some information. For example, the instance for Colour drops
--   the alpha channel.
fromAlphaColour :: Color c => AlphaColour Double -> c

-- | An existential wrapper for instances of the Color class.
data SomeColor
SomeColor :: c -> SomeColor

-- | Isomorphism between SomeColor and AlphaColour
--   Double.
_SomeColor :: Iso' SomeColor (AlphaColour Double)
someToAlpha :: SomeColor -> AlphaColour Double

-- | Although the individual colors in a diagram can have transparency, the
--   opacity/transparency of a diagram as a whole can be specified with the
--   Opacity attribute. The opacity is a value between 1
--   (completely opaque, the default) and 0 (completely transparent).
--   Opacity is multiplicative, that is, opacity o1 .
--   opacity o2 === opacity (o1 * o2). In other words,
--   for example, opacity 0.8 means "decrease this diagram's
--   opacity to 80% of its previous opacity".
data Opacity
_Opacity :: Iso' Opacity Double
getOpacity :: Opacity -> Double

-- | Multiply the opacity (see Opacity) by the given value. For
--   example, opacity 0.8 means "decrease this diagram's opacity
--   to 80% of its previous opacity".
opacity :: HasStyle a => Double -> a -> a

-- | Lens onto the opacity in a style.
_opacity :: Lens' (Style v n) Double

-- | Like Opacity, but set the opacity only for fills (as opposed to
--   strokes). As with Opacity, the fill opacity is a value between
--   1 (completely opaque, the default) and 0 (completely transparent), and
--   is multiplicative.
data FillOpacity
_FillOpacity :: Iso' FillOpacity Double
getFillOpacity :: FillOpacity -> Double

-- | Multiply the fill opacity (see FillOpacity) by the given value.
--   For example, fillOpacity 0.8 means "decrease this diagram's
--   fill opacity to 80% of its previous value".
fillOpacity :: HasStyle a => Double -> a -> a

-- | Lens onto the fill opacity in a style.
_fillOpacity :: Lens' (Style v n) Double

-- | Like Opacity, but set the opacity only for strokes (as opposed
--   to fills). As with Opacity, the fill opacity is a value between
--   1 (completely opaque, the default) and 0 (completely transparent), and
--   is multiplicative.
data StrokeOpacity
_StrokeOpacity :: Iso' StrokeOpacity Double
getStrokeOpacity :: StrokeOpacity -> Double

-- | Multiply the stroke opacity (see StrokeOpacity) by the given
--   value. For example, strokeOpacity 0.8 means "decrease this
--   diagram's stroke opacity to 80% of its previous value".
strokeOpacity :: HasStyle a => Double -> a -> a

-- | Lens onto the stroke opacity in a style.
_strokeOpacity :: Lens' (Style v n) Double

-- | Convert to sRGBA.
colorToSRGBA :: Color c => c -> (Double, Double, Double, Double)

-- | Convert to sRGBA.

-- | Deprecated: Renamed to colorToSRGBA.
colorToRGBA :: Color c => c -> (Double, Double, Double, Double)

-- | What sort of shape should be placed at the endpoints of lines?
data LineCap

-- | Lines end precisely at their endpoints.
LineCapButt :: LineCap

-- | Lines are capped with semicircles centered on endpoints.
LineCapRound :: LineCap

-- | Lines are capped with a squares centered on endpoints.
LineCapSquare :: LineCap
getLineCap :: LineCap -> LineCap

-- | Set the line end cap attribute.
lineCap :: HasStyle a => LineCap -> a -> a

-- | Lens onto the line cap in a style.
_lineCap :: Lens' (Style v n) LineCap

-- | How should the join points between line segments be drawn?
data LineJoin

-- | Use a "miter" shape (whatever that is).
LineJoinMiter :: LineJoin

-- | Use rounded join points.
LineJoinRound :: LineJoin

-- | Use a "bevel" shape (whatever that is). Are these... carpentry terms?
LineJoinBevel :: LineJoin
getLineJoin :: LineJoin -> LineJoin

-- | Set the segment join style.
lineJoin :: HasStyle a => LineJoin -> a -> a

-- | Lens onto the line join type in a style.
_lineJoin :: Lens' (Style v n) LineJoin

-- | Miter limit attribute affecting the LineJoinMiter joins. For
--   some backends this value may have additional effects.
newtype LineMiterLimit
LineMiterLimit :: Last Double -> LineMiterLimit
_LineMiterLimit :: Iso' LineMiterLimit Double
getLineMiterLimit :: LineMiterLimit -> Double

-- | Set the miter limit for joins with LineJoinMiter.
lineMiterLimit :: HasStyle a => Double -> a -> a

-- | Apply a LineMiterLimit attribute.
lineMiterLimitA :: HasStyle a => LineMiterLimit -> a -> a

-- | Lens onto the line miter limit in a style.
_lineMiterLimit :: Lens' (Style v n) Double

-- | Prism onto a Recommend.
_Recommend :: Prism' (Recommend a) a

-- | Prism onto a Commit.
_Commit :: Prism' (Recommend a) a

-- | Lens onto the value inside either a Recommend or Commit.
--   Unlike committed, this is a valid lens.
_recommend :: Lens (Recommend a) (Recommend b) a b

-- | Lens onto whether something is committed or not.
isCommitted :: Lens' (Recommend a) Bool

-- | Commit a value for any Recommend. This is *not* a valid
--   ReifiedIso because the resulting Recommend b is always
--   a Commit. This is useful because it means any Recommend
--   styles set with a lens will not be accidentally overridden. If you
--   want a valid lens onto a recommend value use _recommend.
--   
--   Other lenses that use this are labeled with a warning.
committed :: Iso (Recommend a) (Recommend b) a b
instance GHC.Base.Semigroup (Diagrams.Attributes.LineWidth n)
instance GHC.Classes.Eq n => GHC.Classes.Eq (Diagrams.Attributes.Dashing n)
instance GHC.Base.Functor Diagrams.Attributes.Dashing
instance GHC.Base.Semigroup Diagrams.Attributes.Opacity
instance GHC.Base.Semigroup Diagrams.Attributes.FillOpacity
instance GHC.Base.Semigroup Diagrams.Attributes.StrokeOpacity
instance GHC.Show.Show Diagrams.Attributes.LineCap
instance GHC.Classes.Ord Diagrams.Attributes.LineCap
instance GHC.Classes.Eq Diagrams.Attributes.LineCap
instance GHC.Show.Show Diagrams.Attributes.LineJoin
instance GHC.Classes.Ord Diagrams.Attributes.LineJoin
instance GHC.Classes.Eq Diagrams.Attributes.LineJoin
instance GHC.Classes.Ord Diagrams.Attributes.LineMiterLimit
instance GHC.Classes.Eq Diagrams.Attributes.LineMiterLimit
instance GHC.Base.Semigroup Diagrams.Attributes.LineMiterLimit
instance Diagrams.Core.Style.AttributeClass Diagrams.Attributes.LineMiterLimit
instance Data.Default.Class.Default Diagrams.Attributes.LineMiterLimit
instance Diagrams.Core.Style.AttributeClass Diagrams.Attributes.LineJoin
instance GHC.Base.Semigroup Diagrams.Attributes.LineJoin
instance Data.Default.Class.Default Diagrams.Attributes.LineJoin
instance Data.Default.Class.Default Diagrams.Attributes.LineCap
instance Diagrams.Core.Style.AttributeClass Diagrams.Attributes.LineCap
instance GHC.Base.Semigroup Diagrams.Attributes.LineCap
instance Diagrams.Core.Style.AttributeClass Diagrams.Attributes.StrokeOpacity
instance Diagrams.Core.Style.AttributeClass Diagrams.Attributes.FillOpacity
instance Diagrams.Core.Style.AttributeClass Diagrams.Attributes.Opacity
instance GHC.Show.Show Diagrams.Attributes.SomeColor
instance Diagrams.Attributes.Color Diagrams.Attributes.SomeColor
instance (a GHC.Types.~ GHC.Types.Double) => Diagrams.Attributes.Color (Data.Colour.Internal.Colour a)
instance (a GHC.Types.~ GHC.Types.Double) => Diagrams.Attributes.Color (Data.Colour.Internal.AlphaColour a)
instance GHC.Base.Semigroup (Diagrams.Attributes.Dashing n)
instance Data.Typeable.Internal.Typeable n => Diagrams.Core.Style.AttributeClass (Diagrams.Attributes.Dashing n)
instance Diagrams.Core.Envelope.OrderedField n => Data.Default.Class.Default (Diagrams.Attributes.LineWidthM n)
instance Data.Typeable.Internal.Typeable n => Diagrams.Core.Style.AttributeClass (Diagrams.Attributes.LineWidth n)

-- | XXX
module Diagrams.Attributes.Compile
class (AttributeClass (AttrType code), Typeable (PrimType code)) => SplitAttribute code where {
    type AttrType code :: Type;
    type PrimType code :: Type;
}
primOK :: SplitAttribute code => code -> PrimType code -> Bool

-- | Push certain attributes down until they are at the roots of trees
--   containing only "safe" nodes. In particular this is used to push fill
--   attributes down until they are over only loops; see
--   splitFills.
splitAttr :: forall code b v n a. SplitAttribute code => code -> RTree b v n a -> RTree b v n a

-- | A cubic spline is a smooth, connected sequence of cubic curves
--   passing through a given sequence of points. This module implements a
--   straightforward spline generation algorithm based on solving
--   tridiagonal systems of linear equations.
module Diagrams.CubicSpline.Internal

-- | Use the tri-diagonal solver with the appropriate parameters for an
--   open cubic spline.
solveCubicSplineDerivatives :: Fractional a => [a] -> [a]

-- | Use the cyclic-tri-diagonal solver with the appropriate parameters for
--   a closed cubic spline.
solveCubicSplineDerivativesClosed :: Fractional a => [a] -> [a]

-- | Use the cyclic-tri-diagonal solver with the appropriate parameters for
--   a closed cubic spline.
solveCubicSplineCoefficients :: Fractional a => Bool -> [a] -> [[a]]

-- | Names can be given to subdiagrams, and subdiagrams can later be
--   queried by name. This module exports types for representing names and
--   subdiagrams, and various functions for working with them.
module Diagrams.Names

-- | Atomic names. AName is just an existential wrapper around
--   things which are Typeable, Ord and Show.
data () => AName

-- | A (qualified) name is a (possibly empty) sequence of atomic names.
data () => Name

-- | Class for those types which can be used as names. They must support
--   Typeable (to facilitate extracting them from existential
--   wrappers), Ord (for comparison and efficient storage) and
--   Show.
--   
--   To make an instance of IsName, you need not define any methods,
--   just declare it.
--   
--   WARNING: it is not recommended to use
--   GeneralizedNewtypeDeriving in conjunction with
--   IsName, since in that case the underlying type and the
--   newtype will be considered equivalent when comparing names.
--   For example:
--   
--   
--   newtype WordN = WordN Int deriving (Show, Ord, Eq, Typeable, IsName)
--   
--   
--   
--   is unlikely to work as intended, since (1 :: Int) and
--   (WordN 1) will be considered equal as names. Instead, use
--   
--   
--   newtype WordN = WordN Int deriving (Show, Ord, Eq, Typeable, IsName)
--   instance IsName WordN
--   
--   
class (Typeable a, Ord a, Show a) => IsName a
toName :: IsName a => a -> Name

-- | Convenient operator for writing qualified names with atomic components
--   of different types. Instead of writing toName a1 <> toName
--   a2 <> toName a3 you can just write a1 .> a2 .>
--   a3.
(.>) :: (IsName a1, IsName a2) => a1 -> a2 -> Name
infixr 5 .>

-- | Instances of Qualifiable are things which can be qualified by
--   prefixing them with a name.
class () => Qualifiable q

-- | Qualify with the given name.
(.>>) :: (Qualifiable q, IsName a) => a -> q -> q
infixr 5 .>>

-- | A Subdiagram represents a diagram embedded within the context
--   of a larger diagram. Essentially, it consists of a diagram paired with
--   any accumulated information from the larger context (transformations,
--   attributes, etc.).
data () => Subdiagram b (v :: Type -> Type) n m

-- | Turn a diagram into a subdiagram with no accumulated context.
mkSubdiagram :: forall b (v :: Type -> Type) n m. QDiagram b v n m -> Subdiagram b v n m

-- | Create a "point subdiagram", that is, a pointDiagram (with no
--   content and a point envelope) treated as a subdiagram with local
--   origin at the given point. Note this is not the same as
--   mkSubdiagram . pointDiagram, which would result in a
--   subdiagram with local origin at the parent origin, rather than at the
--   given point.
subPoint :: forall (v :: Type -> Type) n b m. (Metric v, OrderedField n) => Point v n -> Subdiagram b v n m

-- | Turn a subdiagram into a normal diagram, including the enclosing
--   context. Concretely, a subdiagram is a pair of (1) a diagram and (2) a
--   "context" consisting of an extra transformation and attributes.
--   getSub simply applies the transformation and attributes to
--   the diagram to get the corresponding "top-level" diagram.
getSub :: forall (v :: Type -> Type) n m b. (Metric v, OrderedField n, Semigroup m) => Subdiagram b v n m -> QDiagram b v n m

-- | Extract the "raw" content of a subdiagram, by throwing away the
--   context.
rawSub :: forall b (v :: Type -> Type) n m. Subdiagram b v n m -> QDiagram b v n m

-- | Get the location of a subdiagram; that is, the location of its local
--   origin with respect to the vector space of its parent diagram.
--   In other words, the point where its local origin "ended up".
location :: forall (v :: Type -> Type) n b m. (Additive v, Num n) => Subdiagram b v n m -> Point v n

-- | A SubMap is a map associating names to subdiagrams. There can
--   be multiple associations for any given name.
data () => SubMap b (v :: Type -> Type) n m

-- | Construct a SubMap from a list of associations between names
--   and subdiagrams.
fromNames :: forall a b (v :: Type -> Type) n m. IsName a => [(a, Subdiagram b v n m)] -> SubMap b v n m

-- | Add a name/diagram association to a submap.
rememberAs :: forall a b (v :: Type -> Type) n m. IsName a => a -> QDiagram b v n m -> SubMap b v n m -> SubMap b v n m

-- | Look for the given name in a name map, returning a list of subdiagrams
--   associated with that name. If no names match the given name exactly,
--   return all the subdiagrams associated with names of which the given
--   name is a suffix.
lookupSub :: forall nm b (v :: Type -> Type) n m. IsName nm => nm -> SubMap b v n m -> Maybe [Subdiagram b v n m]

-- | Attach an atomic name to a diagram.
named :: (IsName nm, Metric v, OrderedField n, Semigroup m) => nm -> QDiagram b v n m -> QDiagram b v n m

-- | Attach an atomic name to a certain subdiagram, computed from the given
--   diagram /with the mapping from name to subdiagram included/. The
--   upshot of this knot-tying is that if d' = d # named x, then
--   lookupName x d' == Just d' (instead of Just d).
nameSub :: forall nm (v :: Type -> Type) n m b. (IsName nm, Metric v, OrderedField n, Semigroup m) => (QDiagram b v n m -> Subdiagram b v n m) -> nm -> QDiagram b v n m -> QDiagram b v n m

-- | Attach an atomic name to a certain point (which may be computed from
--   the given diagram), treated as a subdiagram with no content and a
--   point envelope.
namePoint :: (IsName nm, Metric v, OrderedField n, Semigroup m) => (QDiagram b v n m -> Point v n) -> nm -> QDiagram b v n m -> QDiagram b v n m

-- | "Localize" a diagram by hiding all the names, so they are no longer
--   visible to the outside.
localize :: forall b (v :: Type -> Type) n m. (Metric v, OrderedField n, Semigroup m) => QDiagram b v n m -> QDiagram b v n m

-- | Get a list of names of subdiagrams and their locations.
names :: forall (v :: Type -> Type) m n b. (Metric v, Semigroup m, OrderedField n) => QDiagram b v n m -> [(Name, [Point v n])]

-- | Lookup the most recent diagram associated with (some qualification of)
--   the given name.
lookupName :: forall nm (v :: Type -> Type) m n b. (IsName nm, Metric v, Semigroup m, OrderedField n) => nm -> QDiagram b v n m -> Maybe (Subdiagram b v n m)

-- | Given a name and a diagram transformation indexed by a subdiagram,
--   perform the transformation using the most recent subdiagram associated
--   with (some qualification of) the name, or perform the identity
--   transformation if the name does not exist.
withName :: forall nm (v :: Type -> Type) m n b. (IsName nm, Metric v, Semigroup m, OrderedField n) => nm -> (Subdiagram b v n m -> QDiagram b v n m -> QDiagram b v n m) -> QDiagram b v n m -> QDiagram b v n m

-- | Given a name and a diagram transformation indexed by a list of
--   subdiagrams, perform the transformation using the collection of all
--   such subdiagrams associated with (some qualification of) the given
--   name.
withNameAll :: forall nm (v :: Type -> Type) m n b. (IsName nm, Metric v, Semigroup m, OrderedField n) => nm -> ([Subdiagram b v n m] -> QDiagram b v n m -> QDiagram b v n m) -> QDiagram b v n m -> QDiagram b v n m

-- | Given a list of names and a diagram transformation indexed by a list
--   of subdiagrams, perform the transformation using the list of most
--   recent subdiagrams associated with (some qualification of) each name.
--   Do nothing (the identity transformation) if any of the names do not
--   exist.
withNames :: forall nm (v :: Type -> Type) m n b. (IsName nm, Metric v, Semigroup m, OrderedField n) => [nm] -> ([Subdiagram b v n m] -> QDiagram b v n m -> QDiagram b v n m) -> QDiagram b v n m -> QDiagram b v n m

-- | Type classes for things which are parameterized in some way,
--   e.g. segments and trails.
module Diagrams.Parametric

-- | The standard tolerance used by std... functions (like
--   stdArcLength and stdArcLengthToParam, currently set at
--   1e-6.
stdTolerance :: Fractional a => a

-- | Codomain of parametric classes. This is usually either (V p),
--   for relative vector results, or (Point (V p)), for functions
--   with absolute coordinates.
type family Codomain p :: Type -> Type

-- | Type class for parametric functions.
class Parametric p

-- | atParam yields a parameterized view of an object as a
--   continuous function. It is designed to be used infix, like path
--   `atParam` 0.5.
atParam :: Parametric p => p -> N p -> Codomain p (N p)

-- | Type class for parametric functions with a bounded domain. The default
--   bounds are [0,1].
--   
--   Note that this domain indicates the main "interesting" portion of the
--   function. It must be defined within this range, but for some instances
--   may still have sensible values outside.
class DomainBounds p

-- | domainLower defaults to being constantly 0 (for vector spaces
--   with numeric scalars).
domainLower :: DomainBounds p => p -> N p

-- | domainLower defaults to being constantly 0 (for vector spaces
--   with numeric scalars).
domainLower :: (DomainBounds p, Num (N p)) => p -> N p

-- | domainUpper defaults to being constantly 1 (for vector spaces
--   with numeric scalars).
domainUpper :: DomainBounds p => p -> N p

-- | domainUpper defaults to being constantly 1 (for vector spaces
--   with numeric scalars).
domainUpper :: (DomainBounds p, Num (N p)) => p -> N p

-- | Return the lower and upper bounds of a parametric domain together as a
--   pair.
domainBounds :: DomainBounds p => p -> (N p, N p)

-- | Type class for querying the values of a parametric object at the ends
--   of its domain.
class (Parametric p, DomainBounds p) => EndValues p

-- | atStart is the value at the start of the domain. That is,
--   
--   
--   atStart x = x `atParam` domainLower x
--   
--   
--   This is the default implementation, but some representations will have
--   a more efficient and/or precise implementation.
atStart :: EndValues p => p -> Codomain p (N p)

-- | atEnd is the value at the end of the domain. That is,
--   
--   
--   atEnd x = x `atParam` domainUpper x
--   
--   
--   This is the default implementation, but some representations will have
--   a more efficient and/or precise implementation.
atEnd :: EndValues p => p -> Codomain p (N p)

-- | Type class for parametric objects which can be split into subobjects.
--   
--   Minimal definition: Either splitAtParam or section, plus
--   reverseDomain.
class DomainBounds p => Sectionable p

-- | splitAtParam splits an object p into two new objects
--   (l,r) at the parameter t, where l
--   corresponds to the portion of p for parameter values from
--   0 to t and r for to that from t to
--   1. The following property should hold:
--   
--   
--   prop_splitAtParam f t u =
--     | u < t     = atParam f u == atParam l (u / t)
--     | otherwise = atParam f u == atParam f t ??? atParam l ((u - t) / (domainUpper f - t))
--     where (l,r) = splitAtParam f t
--   
--   
--   where (???) = (^+^) if the codomain is a vector type, or
--   const flip if the codomain is a point type. Stated more
--   intuitively, all this is to say that the parameterization scales
--   linearly with splitting.
--   
--   splitAtParam can also be used with parameters outside the range
--   of the domain. For example, using the parameter 2 with a path
--   (where the domain is the default [0,1]) gives two result
--   paths where the first is the original path extended to the parameter
--   2, and the second result path travels backwards from the end of
--   the first to the end of the original path.
splitAtParam :: Sectionable p => p -> N p -> (p, p)

-- | Extract a particular section of the domain, linearly reparameterized
--   to the same domain as the original. Should satisfy the property:
--   
--   
--   prop_section x l u t =
--     let s = section x l u
--     in     domainBounds x == domainBounds x
--         && (x `atParam` lerp l u t) == (s `atParam` t)
--   
--   
--   That is, the section should have the same domain as the original, and
--   the reparameterization should be linear.
section :: Sectionable p => p -> N p -> N p -> p

-- | Extract a particular section of the domain, linearly reparameterized
--   to the same domain as the original. Should satisfy the property:
--   
--   
--   prop_section x l u t =
--     let s = section x l u
--     in     domainBounds x == domainBounds x
--         && (x `atParam` lerp l u t) == (s `atParam` t)
--   
--   
--   That is, the section should have the same domain as the original, and
--   the reparameterization should be linear.
section :: (Sectionable p, Fractional (N p)) => p -> N p -> N p -> p

-- | Flip the parameterization on the domain.
reverseDomain :: Sectionable p => p -> p

-- | Type class for parametric things with a notion of arc length.
class Parametric p => HasArcLength p

-- | arcLengthBounded eps x approximates the arc length of
--   x. The true arc length is guaranteed to lie within the
--   interval returned, which will have a size of at most eps.
arcLengthBounded :: HasArcLength p => N p -> p -> Interval (N p)

-- | arcLength eps s approximates the arc length of x up
--   to the accuracy eps (plus or minus).
arcLength :: HasArcLength p => N p -> p -> N p

-- | arcLength eps s approximates the arc length of x up
--   to the accuracy eps (plus or minus).
arcLength :: (HasArcLength p, Fractional (N p)) => N p -> p -> N p

-- | Approximate the arc length up to a standard accuracy of
--   stdTolerance (1e-6).
stdArcLength :: HasArcLength p => p -> N p

-- | Approximate the arc length up to a standard accuracy of
--   stdTolerance (1e-6).
stdArcLength :: (HasArcLength p, Fractional (N p)) => p -> N p

-- | arcLengthToParam eps s l converts the absolute arc
--   length l, measured from the start of the domain, to a
--   parameter on the object s. The true arc length at the
--   parameter returned is guaranteed to be within eps of the
--   requested arc length.
--   
--   This should work for any arc length, and may return any
--   parameter value (not just parameters in the domain).
arcLengthToParam :: HasArcLength p => N p -> p -> N p -> N p

-- | A simple interface to convert arc length to a parameter, guaranteed to
--   be accurate within stdTolerance, or 1e-6.
stdArcLengthToParam :: HasArcLength p => p -> N p -> N p

-- | A simple interface to convert arc length to a parameter, guaranteed to
--   be accurate within stdTolerance, or 1e-6.
stdArcLengthToParam :: (HasArcLength p, Fractional (N p)) => p -> N p -> N p

-- | Tools for adjusting the length of parametric objects such as segments
--   and trails.
module Diagrams.Parametric.Adjust

-- | Adjust the length of a parametric object such as a segment or trail.
--   The second parameter is an option record which controls how the
--   adjustment should be performed; see AdjustOpts.
adjust :: (N t ~ n, Sectionable t, HasArcLength t, Fractional n) => t -> AdjustOpts n -> t

-- | How should a segment, trail, or path be adjusted?
data AdjustOpts n

-- | Which method should be used for adjusting?
adjMethod :: Lens' (AdjustOpts n) (AdjustMethod n)

-- | Which end(s) of the object should be adjusted?
adjSide :: Lens' (AdjustOpts n) AdjustSide

-- | Tolerance to use when doing adjustment.
adjEps :: Lens' (AdjustOpts n) n

-- | What method should be used for adjusting a segment, trail, or path?
data AdjustMethod n

-- | Extend by the given parameter value (use a negative parameter to
--   shrink)
ByParam :: n -> AdjustMethod n

-- | Extend by the given arc length (use a negative length to shrink)
ByAbsolute :: n -> AdjustMethod n

-- | Extend or shrink to the given arc length
ToAbsolute :: n -> AdjustMethod n

-- | Which side of a segment, trail, or path should be adjusted?
data AdjustSide

-- | Adjust only the beginning
Start :: AdjustSide

-- | Adjust only the end
End :: AdjustSide

-- | Adjust both sides equally
Both :: AdjustSide
instance GHC.Real.Fractional n => Data.Default.Class.Default (Diagrams.Parametric.Adjust.AdjustMethod n)
instance Data.Default.Class.Default Diagrams.Parametric.Adjust.AdjustSide
instance GHC.Real.Fractional n => Data.Default.Class.Default (Diagrams.Parametric.Adjust.AdjustOpts n)
instance GHC.Enum.Enum Diagrams.Parametric.Adjust.AdjustSide
instance GHC.Enum.Bounded Diagrams.Parametric.Adjust.AdjustSide
instance GHC.Classes.Ord Diagrams.Parametric.Adjust.AdjustSide
instance GHC.Classes.Eq Diagrams.Parametric.Adjust.AdjustSide
instance GHC.Read.Read Diagrams.Parametric.Adjust.AdjustSide
instance GHC.Show.Show Diagrams.Parametric.Adjust.AdjustSide

-- | Points in space. For more tools for working with points and vectors,
--   see Linear.Affine.
module Diagrams.Points

-- | A handy wrapper to help distinguish points from vectors at the type
--   level
newtype () => Point (f :: Type -> Type) a
P :: f a -> Point (f :: Type -> Type) a

-- | Vector spaces have origins.
origin :: forall (f :: Type -> Type) a. (Additive f, Num a) => Point f a

-- | Scale a point by a scalar. Specialized version of (*^).
(*.) :: forall (v :: Type -> Type) n. (Functor v, Num n) => n -> Point v n -> Point v n

-- | The centroid of a set of n points is their sum divided by
--   n. Returns the origin for an empty list of points.
centroid :: (Additive v, Fractional n) => [Point v n] -> Point v n

-- | Create a "point diagram", which has no content, no trace, an empty
--   query, and a point envelope.
pointDiagram :: forall (v :: Type -> Type) n b m. (Metric v, Fractional n) => Point v n -> QDiagram b v n m
_Point :: forall f1 a g b p f2. (Profunctor p, Functor f2) => p (f1 a) (f2 (g b)) -> p (Point f1 a) (f2 (Point g b))
lensP :: forall f1 a g b f2. Functor f2 => (f1 a -> f2 (g b)) -> Point f1 a -> f2 (Point g b)

-- | Nice syntax for constructing and pattern-matching on literal points
--   and vectors.
module Diagrams.Coordinates

-- | A pair of values, with a convenient infix (left-associative) data
--   constructor.
data a :& b
(:&) :: a -> b -> (:&) a b
infixl 7 :&
infixl 7 :&

-- | Types which are instances of the Coordinates class can be
--   constructed using ^& (for example, a three-dimensional
--   vector could be constructed by 1 ^& 6 ^& 3), and
--   deconstructed using coords. A common pattern is to use
--   coords in conjunction with the ViewPatterns extension,
--   like so:
--   
--   
--   foo :: Vector3 -> ...
--   foo (coords -> x :& y :& z) = ...
--   
class Coordinates c where {
    
    -- | The type of the final coordinate.
    type FinalCoord c :: Type;
    
    -- | The type of everything other than the final coordinate.
    type PrevDim c :: Type;
    
    -- | Decomposition of <tt>c</tt> into applications of <a>:&amp;</a>.
    type Decomposition c :: Type;
}

-- | Construct a value of type c by providing something of one
--   less dimension (which is perhaps itself recursively constructed using
--   (^&)) and a final coordinate. For example,
--   
--   
--   2 ^& 3 :: P2
--   3 ^& 5 ^& 6 :: V3
--   
--   
--   Note that ^& is left-associative.
(^&) :: Coordinates c => PrevDim c -> FinalCoord c -> c

-- | Prefix synonym for ^&. pr stands for pair of
--   PrevDim, FinalCoord
pr :: Coordinates c => PrevDim c -> FinalCoord c -> c

-- | Decompose a value of type c into its constituent coordinates,
--   stored in a nested (:&) structure.
coords :: Coordinates c => c -> Decomposition c
infixl 7 ^&
instance (GHC.Show.Show a, GHC.Show.Show b) => GHC.Show.Show (a Diagrams.Coordinates.:& b)
instance (GHC.Classes.Ord a, GHC.Classes.Ord b) => GHC.Classes.Ord (a Diagrams.Coordinates.:& b)
instance (GHC.Classes.Eq a, GHC.Classes.Eq b) => GHC.Classes.Eq (a Diagrams.Coordinates.:& b)
instance Diagrams.Coordinates.Coordinates (a Diagrams.Coordinates.:& b)
instance Diagrams.Coordinates.Coordinates (a, b)
instance Diagrams.Coordinates.Coordinates (a, b, c)
instance Diagrams.Coordinates.Coordinates (a, b, c, d)
instance Diagrams.Coordinates.Coordinates (Linear.V2.V2 n)
instance Diagrams.Coordinates.Coordinates (Linear.V3.V3 n)
instance Diagrams.Coordinates.Coordinates (Linear.V4.V4 n)
instance Diagrams.Coordinates.Coordinates (v n) => Diagrams.Coordinates.Coordinates (Linear.Affine.Point v n)

-- | Type for representing angles.
module Diagrams.Angle

-- | Angles can be expressed in a variety of units. Internally, they are
--   represented in radians.
data Angle n

-- | 30 @@ deg is an Angle of the given measure and units.
--   
--   
--   >>> pi @@ rad
--   3.141592653589793 @@ rad
--   
--   
--   
--   >>> 1 @@ turn
--   6.283185307179586 @@ rad
--   
--   
--   
--   >>> 30 @@ deg
--   0.5235987755982988 @@ rad
--   
--   
--   For Iso's, (@@) reverses the Iso' on its right,
--   and applies the Iso' to the value on the left. Angles
--   are the motivating example where this order improves readability.
--   
--   This is the same as a flipped review.
--   
--   
--   (@@) :: a -> Iso'      s a -> s
--   (@@) :: a -> Prism'    s a -> s
--   (@@) :: a -> Review    s a -> s
--   (@@) :: a -> Equality' s a -> s
--   
(@@) :: b -> AReview a b -> a
infixl 5 @@

-- | The radian measure of an Angle a can be accessed as
--   a ^. rad. A new Angle can be defined in radians
--   as pi @@ rad.
rad :: Iso' (Angle n) n

-- | The measure of an Angle a in full circles can be
--   accessed as a ^. turn. A new Angle of one-half
--   circle can be defined in as 1/2 @@ turn.
turn :: Floating n => Iso' (Angle n) n

-- | The degree measure of an Angle a can be accessed as
--   a ^. deg. A new Angle can be defined in degrees
--   as 180 @@ deg.
deg :: Floating n => Iso' (Angle n) n

-- | An angle representing one full turn.
fullTurn :: Floating v => Angle v

-- | An angle representing a half turn.
halfTurn :: Floating v => Angle v

-- | An angle representing a quarter turn.
quarterTurn :: Floating v => Angle v

-- | The sine of the given Angle.
sinA :: Floating n => Angle n -> n

-- | The cosine of the given Angle.
cosA :: Floating n => Angle n -> n

-- | The tangent function of the given Angle.
tanA :: Floating n => Angle n -> n

-- | The Angle with the given sine.
asinA :: Floating n => n -> Angle n

-- | The Angle with the given cosine.
acosA :: Floating n => n -> Angle n

-- | The Angle with the given tangent.
atanA :: Floating n => n -> Angle n

-- | atan2A y x is the angle between the positive x-axis and the
--   vector given by the coordinates (x, y). The Angle returned is
--   in the [-pi,pi] range.
atan2A :: RealFloat n => n -> n -> Angle n

-- | Similar to atan2A but without the RealFloat constraint.
--   This means it doesn't handle negative zero cases. However, for most
--   geometric purposes, the outcome will be the same.
atan2A' :: OrderedField n => n -> n -> Angle n

-- | Compute the positive angle between the two vectors in their common
--   plane in the [0,pi] range. For a signed angle see
--   signedAngleBetween.
--   
--   Returns NaN if either of the vectors are zero.
angleBetween :: (Metric v, Floating n, Ord n) => v n -> v n -> Angle n

-- | Calculate ratio between two angles.
angleRatio :: Floating n => Angle n -> Angle n -> n

-- | Normalize an angle so that it lies in the [0,tau) range.
normalizeAngle :: (Floating n, Real n) => Angle n -> Angle n

-- | The class of types with at least one angle coordinate, called
--   _theta.
class HasTheta t
_theta :: (HasTheta t, RealFloat n) => Lens' (t n) (Angle n)

-- | The class of types with at least two angle coordinates, the second
--   called _phi. _phi is the positive angle measured from
--   the z axis.
class HasTheta t => HasPhi t
_phi :: (HasPhi t, RealFloat n) => Lens' (t n) (Angle n)

-- | Create a transformation which performs a rotation about the local
--   origin by the given angle. See also rotate.
rotation :: Floating n => Angle n -> Transformation V2 n

-- | Rotate about the local origin by the given angle. Positive angles
--   correspond to counterclockwise rotation, negative to clockwise. The
--   angle can be expressed using any of the Isos on Angle.
--   For example, rotate (1/4 @@ turn), rotate (tau/4
--   @@ rad), and rotate (90 @@ deg) all represent the same
--   transformation, namely, a counterclockwise rotation by a right angle.
--   To rotate about some point other than the local origin, see
--   rotateAbout.
--   
--   Note that writing rotate (1/4), with no Angle
--   constructor, will yield an error since GHC cannot figure out which
--   sort of angle you want to use. In this common situation you can use
--   rotateBy, which interprets its argument as a number of turns.
rotate :: (InSpace V2 n t, Transformable t, Floating n) => Angle n -> t -> t
instance GHC.Base.Functor Diagrams.Angle.Angle
instance GHC.Enum.Enum n => GHC.Enum.Enum (Diagrams.Angle.Angle n)
instance GHC.Classes.Ord n => GHC.Classes.Ord (Diagrams.Angle.Angle n)
instance GHC.Classes.Eq n => GHC.Classes.Eq (Diagrams.Angle.Angle n)
instance Diagrams.Angle.HasPhi v => Diagrams.Angle.HasPhi (Linear.Affine.Point v)
instance Diagrams.Angle.HasTheta v => Diagrams.Angle.HasTheta (Linear.Affine.Point v)
instance GHC.Show.Show n => GHC.Show.Show (Diagrams.Angle.Angle n)
instance GHC.Read.Read n => GHC.Read.Read (Diagrams.Angle.Angle n)
instance GHC.Base.Applicative Diagrams.Angle.Angle
instance Linear.Vector.Additive Diagrams.Angle.Angle
instance GHC.Num.Num n => GHC.Base.Semigroup (Diagrams.Angle.Angle n)
instance GHC.Num.Num n => GHC.Base.Monoid (Diagrams.Angle.Angle n)
instance (Diagrams.Core.V.V t GHC.Types.~ Linear.V2.V2, Diagrams.Core.V.N t GHC.Types.~ n, Diagrams.Core.Transform.Transformable t, GHC.Float.Floating n) => Data.Monoid.Action.Action (Diagrams.Angle.Angle n) t

-- | Type for representing directions, polymorphic in vector space
module Diagrams.Direction

-- | A vector is described by a Direction and a magnitude. So we
--   can think of a Direction as a vector that has forgotten its
--   magnitude. Directions can be used with fromDirection
--   and the lenses provided by its instances.
data Direction v n

-- | _Dir is provided to allow efficient implementations of functions in
--   particular vector-spaces, but should be used with care as it exposes
--   too much information.
_Dir :: Iso' (Direction v n) (v n)

-- | direction v is the direction in which v points.
--   Returns an unspecified value when given the zero vector as input.
direction :: v n -> Direction v n

-- | Synonym for direction.
dir :: v n -> Direction v n

-- | fromDirection d is the unit vector in the direction
--   d.
fromDirection :: (Metric v, Floating n) => Direction v n -> v n

-- | Synonym for fromDirection.
fromDir :: (Metric v, Floating n) => Direction v n -> v n

-- | compute the positive angle between the two directions in their common
--   plane
angleBetweenDirs :: (Metric v, Floating n, Ord n) => Direction v n -> Direction v n -> Angle n

-- | dirBetween p q returns the direction from p to
--   q.
dirBetween :: (Additive v, Num n) => Point v n -> Point v n -> Direction v n
instance GHC.Base.Functor v => GHC.Base.Functor (Diagrams.Direction.Direction v)
instance GHC.Classes.Ord (v n) => GHC.Classes.Ord (Diagrams.Direction.Direction v n)
instance GHC.Classes.Eq (v n) => GHC.Classes.Eq (Diagrams.Direction.Direction v n)
instance GHC.Show.Show (v n) => GHC.Show.Show (Diagrams.Direction.Direction v n)
instance GHC.Read.Read (v n) => GHC.Read.Read (Diagrams.Direction.Direction v n)
instance (Diagrams.Core.V.V (v n) GHC.Types.~ v, Diagrams.Core.V.N (v n) GHC.Types.~ n, Diagrams.Core.Transform.Transformable (v n)) => Diagrams.Core.Transform.Transformable (Diagrams.Direction.Direction v n)
instance Diagrams.Angle.HasTheta v => Diagrams.Angle.HasTheta (Diagrams.Direction.Direction v)
instance Diagrams.Angle.HasPhi v => Diagrams.Angle.HasPhi (Diagrams.Direction.Direction v)

-- | A query is a function that maps points in a vector space to values in
--   some monoid. Queries naturally form a monoid, with two queries being
--   combined pointwise.
module Diagrams.Query

-- | A query is a function that maps points in a vector space to values in
--   some monoid. Queries naturally form a monoid, with two queries being
--   combined pointwise.
--   
--   The idea for annotating diagrams with monoidal queries came from the
--   graphics-drawingcombinators package,
--   http://hackage.haskell.org/package/graphics-drawingcombinators.
newtype () => Query (v :: Type -> Type) n m
Query :: (Point v n -> m) -> Query (v :: Type -> Type) n m
[runQuery] :: Query (v :: Type -> Type) n m -> Point v n -> m

-- | Types which can answer a Query about points inside the
--   geometric object.
--   
--   If t and m are both a Semigroups,
--   getQuery should satisfy
--   
--   
--   getQuery (t1 <> t2) = getQuery t1 <> getQuery t2
--   
class HasQuery t m | t -> m

-- | Extract the query of an object.
getQuery :: HasQuery t m => t -> Query (V t) (N t) m

-- | Sample a diagram's query function at a given point.
--   
--   
--   sample :: QDiagram b v n m -> Point v n -> m
--   sample :: Query v n m      -> Point v n -> m
--   sample :: BoundingBox v n  -> Point v n -> Any
--   sample :: Path V2 Double   -> Point v n -> Crossings
--   
sample :: HasQuery t m => t -> Point (V t) (N t) -> m

-- | Test if a point is not equal to mempty.
--   
--   
--   inquire :: QDiagram b v n Any -> Point v n -> Bool
--   inquire :: Query v n Any      -> Point v n -> Bool
--   inquire :: BoundingBox v n  -> Point v n -> Bool
--   
inquire :: HasQuery t Any => t -> Point (V t) (N t) -> Bool

-- | Get the query function associated with a diagram.
query :: forall m b (v :: Type -> Type) n. Monoid m => QDiagram b v n m -> Query v n m

-- | Set the query value for True points in a diagram (i.e.
--   points "inquire" the diagram); False points will be set to
--   mempty.
value :: Monoid m => m -> QDiagram b v n Any -> QDiagram b v n m

-- | Reset the query values of a diagram to True/False:
--   any values equal to mempty are set to False; any other
--   values are set to True.
resetValue :: (Eq m, Monoid m) => QDiagram b v n m -> QDiagram b v n Any

-- | Set all the query values of a diagram to False.
clearValue :: QDiagram b v n m -> QDiagram b v n Any
instance Diagrams.Query.HasQuery (Diagrams.Core.Query.Query v n m) m
instance GHC.Base.Monoid m => Diagrams.Query.HasQuery (Diagrams.Core.Types.QDiagram b v n m) m

-- | Diagrams may have attributes which affect the way they are
--   rendered. This module defines some common attributes relevant in 3D;
--   particular backends may also define more backend-specific attributes.
--   
--   Every attribute type must have a semigroup structure, that is,
--   an associative binary operation for combining two attributes into one.
--   Unless otherwise noted, all the attributes defined here use the
--   Last structure, that is, combining two attributes simply keeps
--   the second one and throws away the first. This means that child
--   attributes always override parent attributes.
module Diagrams.ThreeD.Attributes

-- | SurfaceColor is the inherent pigment of an object, assumed to
--   be opaque.
newtype SurfaceColor
SurfaceColor :: Last (Colour Double) -> SurfaceColor
_SurfaceColor :: Iso' SurfaceColor (Colour Double)

-- | Set the surface color.
sc :: HasStyle d => Colour Double -> d -> d

-- | Lens onto the surface colour of a style.
_sc :: Lens' (Style v n) (Maybe (Colour Double))

-- | Diffuse is the fraction of incident light reflected
--   diffusely, that is, in all directions. The actual light reflected is
--   the product of this value, the incident light, and the
--   SurfaceColor Attribute. For physical reasonableness,
--   Diffuse should have a value between 0 and 1; this is not
--   checked.
newtype Diffuse
Diffuse :: Last Double -> Diffuse

-- | Isomorphism between Diffuse and Double
_Diffuse :: Iso' Diffuse Double

-- | Set the diffuse reflectance.
diffuse :: HasStyle d => Double -> d -> d

-- | Lens onto the possible diffuse reflectance in a style.
_diffuse :: Lens' (Style v n) (Maybe Double)

-- | Ambient is an ad-hoc representation of indirect lighting. The
--   product of Ambient and SurfaceColor is added to the
--   light leaving an object due to diffuse and specular terms.
--   Ambient can be set per-object, and can be loosely thought of
--   as the product of indirect lighting incident on that object and the
--   diffuse reflectance.
newtype Ambient
Ambient :: Last Double -> Ambient
_Ambient :: Iso' Ambient Double

-- | Set the emittance due to ambient light.
ambient :: HasStyle d => Double -> d -> d

-- | Lens onto the possible ambience in a style.
_ambient :: Lens' (Style v n) (Maybe Double)

-- | A specular highlight has two terms, the intensity, between 0 and 1,
--   and the size. The highlight size is assumed to be the exponent in a
--   Phong shading model (though Backends are free to use a different
--   shading model). In this model, reasonable values are between 1 and 50
--   or so, with higher values for shinier objects. Physically, the
--   intensity and the value of Diffuse must add up to less than
--   1; this is not enforced.
data Specular
Specular :: Double -> Double -> Specular
[_specularIntensity] :: Specular -> Double
[_specularSize] :: Specular -> Double
specularSize :: Lens' Specular Double
specularIntensity :: Lens' Specular Double
newtype Highlight
Highlight :: Last Specular -> Highlight
_Highlight :: Iso' Highlight Specular

-- | Set the specular highlight.
highlight :: HasStyle d => Specular -> d -> d

-- | Lens onto the possible specular highlight in a style
_highlight :: Lens' (Style v n) (Maybe Specular)

-- | Traversal over the highlight intensity of a style. If the style has no
--   Specular, setting this will do nothing.
highlightIntensity :: Traversal' (Style v n) Double

-- | Traversal over the highlight size in a style. If the style has no
--   Specular, setting this will do nothing.
highlightSize :: Traversal' (Style v n) Double
instance GHC.Show.Show Diagrams.ThreeD.Attributes.Highlight
instance GHC.Base.Semigroup Diagrams.ThreeD.Attributes.Highlight
instance Diagrams.Core.Style.AttributeClass Diagrams.ThreeD.Attributes.Highlight
instance GHC.Show.Show Diagrams.ThreeD.Attributes.SurfaceColor
instance GHC.Base.Semigroup Diagrams.ThreeD.Attributes.SurfaceColor
instance GHC.Show.Show Diagrams.ThreeD.Attributes.Diffuse
instance GHC.Base.Semigroup Diagrams.ThreeD.Attributes.Diffuse
instance GHC.Show.Show Diagrams.ThreeD.Attributes.Ambient
instance GHC.Base.Semigroup Diagrams.ThreeD.Attributes.Ambient
instance GHC.Show.Show Diagrams.ThreeD.Attributes.Specular
instance Diagrams.Core.Style.AttributeClass Diagrams.ThreeD.Attributes.Ambient
instance Diagrams.Core.Style.AttributeClass Diagrams.ThreeD.Attributes.Diffuse
instance Diagrams.Core.Style.AttributeClass Diagrams.ThreeD.Attributes.SurfaceColor

-- | Affine transformations, parameterized by any vector space. For
--   transformations on particular vector spaces, see e.g.
--   Diagrams.TwoD.Transform.
module Diagrams.Transform

-- | General (affine) transformations, represented by an invertible linear
--   map, its transpose, and a vector representing a translation
--   component.
--   
--   By the transpose of a linear map we mean simply the linear map
--   corresponding to the transpose of the map's matrix representation. For
--   example, any scale is its own transpose, since scales are represented
--   by matrices with zeros everywhere except the diagonal. The transpose
--   of a rotation is the same as its inverse.
--   
--   The reason we need to keep track of transposes is because it turns out
--   that when transforming a shape according to some linear map L, the
--   shape's normal vectors transform according to L's inverse
--   transpose. (For a more detailed explanation and proof, see
--   https://wiki.haskell.org/Diagrams/Dev/Transformations.) This is
--   exactly what we need when transforming bounding functions, which are
--   defined in terms of perpendicular (i.e. normal) hyperplanes.
--   
--   For more general, non-invertible transformations, see
--   Diagrams.Deform (in diagrams-lib).
data () => Transformation (v :: Type -> Type) n

-- | Invert a transformation.
inv :: forall (v :: Type -> Type) n. (Functor v, Num n) => Transformation v n -> Transformation v n

-- | Get the translational component of a transformation.
transl :: Transformation v n -> v n

-- | Apply a transformation to a vector. Note that any translational
--   component of the transformation will not affect the vector, since
--   vectors are invariant under translation.
apply :: Transformation v n -> v n -> v n

-- | Apply a transformation to a point.
papply :: forall (v :: Type -> Type) n. (Additive v, Num n) => Transformation v n -> Point v n -> Point v n

-- | Type class for things t which can be transformed.
class () => Transformable t

-- | Apply a transformation to an object.
transform :: Transformable t => Transformation (V t) (N t) -> t -> t

-- | Create a translation.
translation :: v n -> Transformation v n

-- | Translate by a vector.
translate :: Transformable t => Vn t -> t -> t

-- | Translate the object by the translation that sends the origin to the
--   given point. Note that this is dual to moveOriginTo, i.e. we
--   should have
--   
--   
--   moveTo (origin .^+ v) === moveOriginTo (origin .^- v)
--   
--   
--   
--   For types which are also Transformable, this is essentially
--   the same as translate, i.e.
--   
--   
--   moveTo (origin .^+ v) === translate v
--   
--   
moveTo :: forall (v :: Type -> Type) n t. (InSpace v n t, HasOrigin t) => Point v n -> t -> t

-- | A flipped variant of moveTo, provided for convenience. Useful
--   when writing a function which takes a point as an argument, such as
--   when using withName and friends.
place :: forall (v :: Type -> Type) n t. (InSpace v n t, HasOrigin t) => t -> Point v n -> t

-- | Create a uniform scaling transformation.
scaling :: forall (v :: Type -> Type) n. (Additive v, Fractional n) => n -> Transformation v n

-- | Scale uniformly in every dimension by the given scalar.
scale :: forall (v :: Type -> Type) n a. (InSpace v n a, Eq n, Fractional n, Transformable a) => n -> a -> a

-- | Conjugate one transformation by another. conjugate t1 t2 is
--   the transformation which performs first t1, then t2,
--   then the inverse of t1.
conjugate :: (Additive v, Num n) => Transformation v n -> Transformation v n -> Transformation v n

-- | Carry out some transformation "under" another one: f
--   `underT` t first applies t, then f, then
--   the inverse of t. For example, scaleX 2
--   `underT` rotation (-1/8 @@ Turn) is the
--   transformation which scales by a factor of 2 along the diagonal line y
--   = x.
--   
--   Note that
--   
--   
--   (transform t2) underT t1 == transform (conjugate t1 t2)
--   
--   
--   for all transformations t1 and t2.
--   
--   See also the isomorphisms like transformed, movedTo,
--   movedFrom, and translated.
underT :: (InSpace v n a, SameSpace a b, Transformable a, Transformable b) => (a -> b) -> Transformation v n -> a -> b

-- | Use a Transformation to make an ReifiedIso between an
--   object transformed and untransformed. This is useful for carrying out
--   functions under another transform:
--   
--   
--   under (transformed t) f               == transform (inv t) . f . transform t
--   under (transformed t1) (transform t2) == transform (conjugate t1 t2)
--   transformed t ## a                    == transform t a
--   a ^. transformed t                    == transform (inv t) a
--   
transformed :: (InSpace v n a, SameSpace a b, Transformable a, Transformable b) => Transformation v n -> Iso a b a b

-- | Use a vector to make an ReifiedIso between an object translated
--   and untranslated.
--   
--   
--   under (translated v) f == translate (-v) . f . translate v
--   translated v ## a      == translate v a
--   a ^. translated v      == translate (-v) a
--   over (translated v) f  == translate v . f . translate (-v)
--   
translated :: (InSpace v n a, SameSpace a b, Transformable a, Transformable b) => v n -> Iso a b a b

-- | Use a Point to make an ReifiedIso between an object
--   moved to and from that point:
--   
--   
--   under (movedTo p) f == moveTo (-p) . f . moveTo p
--   over (movedTo p) f  == moveTo p . f . moveTo (-p)
--   movedTo p           == from (movedFrom p)
--   movedTo p ## a      == moveTo p a
--   a ^. movedTo p      == moveOriginTo p a
--   
movedTo :: (InSpace v n a, SameSpace a b, HasOrigin a, HasOrigin b) => Point v n -> Iso a b a b

-- | Use a Transformation to make an ReifiedIso between an
--   object transformed and untransformed. We have
--   
--   
--   under (movedFrom p) f == moveTo p . f . moveTo (-p)
--   movedFrom p           == from (movedTo p)
--   movedFrom p ## a      == moveOriginTo p a
--   a ^. movedFrom p      == moveTo p a
--   over (movedFrom p) f  == moveTo (-p) . f . moveTo p
--   
movedFrom :: (InSpace v n a, SameSpace a b, HasOrigin a, HasOrigin b) => Point v n -> Iso a b a b

-- | Class of types which have an intrinsic notion of a "local origin",
--   i.e. things which are not invariant under translation, and which allow
--   the origin to be moved.
--   
--   One might wonder why not just use Transformable instead of
--   having a separate class for HasOrigin; indeed, for types which
--   are instances of both we should have the identity
--   
--   
--   moveOriginTo (origin .^+ v) === translate (negated v)
--   
--   
--   
--   The reason is that some things (e.g. vectors, Trails) are
--   transformable but are translationally invariant, i.e. have no origin.
class () => HasOrigin t

-- | Move the local origin to another point.
--   
--   Note that this function is in some sense dual to translate
--   (for types which are also Transformable); moving the origin
--   itself while leaving the object "fixed" is dual to fixing the origin
--   and translating the diagram.
moveOriginTo :: HasOrigin t => Point (V t) (N t) -> t -> t

-- | Move the local origin by a relative vector.
moveOriginBy :: (V t ~ v, N t ~ n, HasOrigin t) => v n -> t -> t

-- | Bernstein polynomials, used internally by code to find intersections
--   of paths. This module is probably not of any relevance to most users
--   of diagrams.
module Diagrams.TwoD.Segment.Bernstein
data BernsteinPoly n
BernsteinPoly :: Int -> [n] -> BernsteinPoly n
[bernsteinDegree] :: BernsteinPoly n -> Int
[bernsteinCoeffs] :: BernsteinPoly n -> [n]

-- | Create a bernstein polynomial from a list of coëfficients.
listToBernstein :: Fractional n => [n] -> BernsteinPoly n

-- | Evaluate the bernstein polynomial.
evaluateBernstein :: Fractional n => BernsteinPoly n -> n -> n

-- | Degree elevate a bernstein polynomial a number of times.
degreeElevate :: Fractional n => BernsteinPoly n -> Int -> BernsteinPoly n

-- | Find the derivative of a bernstein polynomial.
bernsteinDeriv :: Fractional n => BernsteinPoly n -> BernsteinPoly n

-- | Evaluate the bernstein polynomial and its derivatives.
evaluateBernsteinDerivs :: Fractional n => BernsteinPoly n -> n -> [n]
instance GHC.Base.Functor Diagrams.TwoD.Segment.Bernstein.BernsteinPoly
instance GHC.Show.Show n => GHC.Show.Show (Diagrams.TwoD.Segment.Bernstein.BernsteinPoly n)
instance GHC.Real.Fractional n => Diagrams.Parametric.Parametric (Diagrams.TwoD.Segment.Bernstein.BernsteinPoly n)
instance GHC.Num.Num n => Diagrams.Parametric.DomainBounds (Diagrams.TwoD.Segment.Bernstein.BernsteinPoly n)
instance GHC.Real.Fractional n => Diagrams.Parametric.EndValues (Diagrams.TwoD.Segment.Bernstein.BernsteinPoly n)
instance GHC.Real.Fractional n => Diagrams.Parametric.Sectionable (Diagrams.TwoD.Segment.Bernstein.BernsteinPoly n)
instance GHC.Real.Fractional n => GHC.Num.Num (Diagrams.TwoD.Segment.Bernstein.BernsteinPoly n)

-- | Basic types for two-dimensional Euclidean space.
module Diagrams.TwoD.Types

-- | A 2-dimensional vector
--   
--   
--   >>> pure 1 :: V2 Int
--   V2 1 1
--   
--   
--   
--   >>> V2 1 2 + V2 3 4
--   V2 4 6
--   
--   
--   
--   >>> V2 1 2 * V2 3 4
--   V2 3 8
--   
--   
--   
--   >>> sum (V2 1 2)
--   3
--   
data () => V2 a
V2 :: !a -> !a -> V2 a

-- | A space that has at least 1 basis vector _x.
class () => R1 (t :: Type -> Type)

-- | 
--   >>> V1 2 ^._x
--   2
--   
--   
--   
--   >>> V1 2 & _x .~ 3
--   V1 3
--   
_x :: R1 t => Lens' (t a) a

-- | A space that distinguishes 2 orthogonal basis vectors _x and
--   _y, but may have more.
class R1 t => R2 (t :: Type -> Type)

-- | 
--   >>> V2 1 2 ^._y
--   2
--   
--   
--   
--   >>> V2 1 2 & _y .~ 3
--   V2 1 3
--   
_y :: R2 t => Lens' (t a) a
_xy :: R2 t => Lens' (t a) (V2 a)
type P2 = Point V2
type T2 = Transformation V2

-- | Construct a 2D vector from a pair of components. See also
--   &.
r2 :: (n, n) -> V2 n

-- | Convert a 2D vector back into a pair of components. See also
--   coords.
unr2 :: V2 n -> (n, n)

-- | Curried form of r2.
mkR2 :: n -> n -> V2 n
r2Iso :: Iso' (V2 n) (n, n)

-- | Construct a 2D point from a pair of coordinates. See also
--   ^&.
p2 :: (n, n) -> P2 n

-- | Curried form of p2.
mkP2 :: n -> n -> P2 n

-- | Convert a 2D point back into a pair of coordinates. See also
--   coords.
unp2 :: P2 n -> (n, n)
p2Iso :: Iso' (Point V2 n) (n, n)
r2PolarIso :: RealFloat n => Iso' (V2 n) (n, Angle n)

-- | A space which has magnitude _r that can be calculated
--   numerically.
class HasR t
_r :: (HasR t, RealFloat n) => Lens' (t n) n
instance Diagrams.TwoD.Types.HasR v => Diagrams.TwoD.Types.HasR (Linear.Affine.Point v)
instance Diagrams.TwoD.Types.HasR Linear.V2.V2
instance Diagrams.Core.Transform.Transformable (Linear.V2.V2 n)
instance Diagrams.Angle.HasTheta Linear.V2.V2

-- | Basic types for three-dimensional Euclidean space.
module Diagrams.ThreeD.Types

-- | Construct a 3D vector from a triple of components.
r3 :: (n, n, n) -> V3 n

-- | Convert a 3D vector back into a triple of components.
unr3 :: V3 n -> (n, n, n)

-- | Curried version of r3.
mkR3 :: n -> n -> n -> V3 n

-- | Construct a 3D point from a triple of coordinates.
p3 :: (n, n, n) -> P3 n

-- | Convert a 3D point back into a triple of coordinates.
unp3 :: P3 n -> (n, n, n)

-- | Curried version of r3.
mkP3 :: n -> n -> n -> P3 n
r3Iso :: Iso' (V3 n) (n, n, n)
p3Iso :: Iso' (P3 n) (n, n, n)

-- | project u v computes the projection of v onto
--   u.
project :: (Metric v, Fractional a) => v a -> v a -> v a
r3SphericalIso :: RealFloat n => Iso' (V3 n) (n, Angle n, Angle n)
r3CylindricalIso :: RealFloat n => Iso' (V3 n) (n, Angle n, n)

-- | A 3-dimensional vector
data () => V3 a
V3 :: !a -> !a -> !a -> V3 a
type P3 = Point V3
type T3 = Transformation V3

-- | A space that has at least 1 basis vector _x.
class () => R1 (t :: Type -> Type)

-- | 
--   >>> V1 2 ^._x
--   2
--   
--   
--   
--   >>> V1 2 & _x .~ 3
--   V1 3
--   
_x :: R1 t => Lens' (t a) a

-- | A space that distinguishes 2 orthogonal basis vectors _x and
--   _y, but may have more.
class R1 t => R2 (t :: Type -> Type)

-- | 
--   >>> V2 1 2 ^._y
--   2
--   
--   
--   
--   >>> V2 1 2 & _y .~ 3
--   V2 1 3
--   
_y :: R2 t => Lens' (t a) a
_xy :: R2 t => Lens' (t a) (V2 a)

-- | A space that distinguishes 3 orthogonal basis vectors: _x,
--   _y, and _z. (It may have more)
class R2 t => R3 (t :: Type -> Type)

-- | 
--   >>> V3 1 2 3 ^. _z
--   3
--   
_z :: R3 t => Lens' (t a) a
_xyz :: R3 t => Lens' (t a) (V3 a)
instance Diagrams.Core.Transform.Transformable (Linear.V3.V3 n)
instance Diagrams.TwoD.Types.HasR Linear.V3.V3
instance Diagrams.Angle.HasTheta Linear.V3.V3
instance Diagrams.Angle.HasPhi Linear.V3.V3

-- | Functions for converting between Transformations and matricies.
module Diagrams.Transform.Matrix

-- | Build a matrix from a Transformation, ignoring the translation.
mkMat :: (HasBasis v, Num n) => Transformation v n -> v (v n)

-- | Build a 3D transformation matrix in homogeneous coordinates from a
--   'Transformation V3'.
mkMatHomo :: Num n => Transformation V3 n -> M44 n

-- | Make a 2D transformation from a 2x2 transform matrix and a translation
--   vector. Does not check if the matrix is not invertible (in which case
--   the T2 will be invalid).
fromMat22 :: Floating n => M22 n -> V2 n -> T2 n

-- | Make a 3D transformation from a 3x3 transform matrix and a translation
--   vector. Does not check if the matrix is not invertible (in which case
--   the T3 will be invalid).
fromMat33 :: Floating n => M33 n -> V3 n -> T3 n

-- | Build a transform with a maxtrix along with its inverse.
fromMatWithInv :: (Additive v, Distributive v, Foldable v, Num n) => v (v n) -> v (v n) -> v n -> Transformation v n

-- | Prism onto a 2D transformation from a 2x2 transform matrix and
--   translation vector. Does not check if the matrix is invertible (in
--   which case the T2 will be invalid).
mat22 :: Floating n => Iso' (M22 n, V2 n) (T2 n)

-- | Prism onto a 3D transformation from a 3x3 transform matrix and
--   translation vector. Does not check if the matrix is invertible (in
--   which case the T3 will be invalid).
mat33 :: Floating n => Iso' (M33 n, V3 n) (T3 n)

-- | Types to specify lighting for 3D rendering.
module Diagrams.ThreeD.Light

-- | A PointLight radiates uniformly in all directions from a
--   given point.
data PointLight n
PointLight :: Point V3 n -> Colour Double -> PointLight n

-- | A ParallelLight casts parallel rays in the specified
--   direction, from some distant location outside the scene.
data ParallelLight n
ParallelLight :: V3 n -> Colour Double -> ParallelLight n

-- | Construct a Diagram with a single PointLight at the origin, which
--   takes up no space.
pointLight :: (Typeable n, Num n, Ord n, Renderable (PointLight n) b) => Colour Double -> QDiagram b V3 n Any

-- | Construct a Diagram with a single ParallelLight, which takes up no
--   space.
parallelLight :: (Typeable n, OrderedField n, Renderable (ParallelLight n) b) => Direction V3 n -> Colour Double -> QDiagram b V3 n Any
instance Diagrams.Core.Transform.Transformable (Diagrams.ThreeD.Light.ParallelLight n)
instance GHC.Real.Fractional n => Diagrams.Core.Transform.Transformable (Diagrams.ThreeD.Light.PointLight n)

-- | Two-dimensional vectors.
module Diagrams.TwoD.Vector

-- | The unit vector in the positive X direction.
unitX :: (R1 v, Additive v, Num n) => v n

-- | The unit vector in the positive Y direction.
unitY :: (R2 v, Additive v, Num n) => v n

-- | The unit vector in the negative X direction.
unit_X :: (R1 v, Additive v, Num n) => v n

-- | The unit vector in the negative Y direction.
unit_Y :: (R2 v, Additive v, Num n) => v n

-- | A Direction pointing in the X direction.
xDir :: (R1 v, Additive v, Num n) => Direction v n

-- | A Direction pointing in the Y direction.
yDir :: (R2 v, Additive v, Num n) => Direction v n

-- | A unit vector at a specified angle counter-clockwise from the positive
--   x-axis
angleV :: Floating n => Angle n -> V2 n

-- | A direction at a specified angle counter-clockwise from the
--   xDir.
angleDir :: Floating n => Angle n -> Direction V2 n

-- | A unit vector at a specified angle counter-clockwise from the positive
--   X axis.
e :: Floating n => Angle n -> V2 n

-- | Signed angle between two vectors. Currently defined as
--   
--   
--   signedAngleBetween u v = (u ^. _theta) ^-^ (v ^. _theta)
--   
signedAngleBetween :: RealFloat n => V2 n -> V2 n -> Angle n

-- | Same as signedAngleBetween but for Directionss.
signedAngleBetweenDirs :: RealFloat n => Direction V2 n -> Direction V2 n -> Angle n

-- | the counter-clockwise perpendicular vector
--   
--   
--   >>> perp $ V2 10 20
--   V2 (-20) 10
--   
perp :: Num a => V2 a -> V2 a

-- | leftTurn v1 v2 tests whether the direction of v2 is
--   a left turn from v1 (that is, if the direction of v2
--   can be obtained from that of v1 by adding an angle 0 <=
--   theta <= tau/2).
leftTurn :: (Num n, Ord n) => V2 n -> V2 n -> Bool

-- | Cross product on vectors in R2.
cross2 :: Num n => V2 n -> V2 n -> n

-- | Transformations specific to two dimensions, with a few generic
--   transformations (uniform scaling, translation) also re-exported for
--   convenience.
module Diagrams.TwoD.Transform
type T2 = Transformation V2

-- | Create a transformation which performs a rotation about the local
--   origin by the given angle. See also rotate.
rotation :: Floating n => Angle n -> Transformation V2 n

-- | Rotate about the local origin by the given angle. Positive angles
--   correspond to counterclockwise rotation, negative to clockwise. The
--   angle can be expressed using any of the Isos on Angle.
--   For example, rotate (1/4 @@ turn), rotate (tau/4
--   @@ rad), and rotate (90 @@ deg) all represent the same
--   transformation, namely, a counterclockwise rotation by a right angle.
--   To rotate about some point other than the local origin, see
--   rotateAbout.
--   
--   Note that writing rotate (1/4), with no Angle
--   constructor, will yield an error since GHC cannot figure out which
--   sort of angle you want to use. In this common situation you can use
--   rotateBy, which interprets its argument as a number of turns.
rotate :: (InSpace V2 n t, Transformable t, Floating n) => Angle n -> t -> t

-- | A synonym for rotate, interpreting its argument in units of
--   turns; it can be more convenient to write rotateBy (1/4) than
--   rotate (1/4 @@ turn).
rotateBy :: (InSpace V2 n t, Transformable t, Floating n) => n -> t -> t

-- | Use an Angle to make an ReifiedIso between an object
--   rotated and unrotated. This us useful for performing actions
--   under a rotation:
--   
--   
--   under (rotated t) f = rotate (negated t) . f . rotate t
--   rotated t ## a      = rotate t a
--   a ^. rotated t      = rotate (-t) a
--   over (rotated t) f  = rotate t . f . rotate (negated t)
--   
rotated :: (InSpace V2 n a, Floating n, SameSpace a b, Transformable a, Transformable b) => Angle n -> Iso a b a b

-- | rotationAbout p is a rotation about the point p
--   (instead of around the local origin).
rotationAround :: Floating n => P2 n -> Angle n -> T2 n

-- | rotateAbout p is like rotate, except it rotates around
--   the point p instead of around the local origin.
rotateAround :: (InSpace V2 n t, Transformable t, Floating n) => P2 n -> Angle n -> t -> t

-- | The rotation that aligns the x-axis with the given direction.
rotationTo :: OrderedField n => Direction V2 n -> T2 n

-- | Rotate around the local origin such that the x axis aligns with the
--   given direction.
rotateTo :: (InSpace V2 n t, OrderedField n, Transformable t) => Direction V2 n -> t -> t

-- | Construct a transformation which scales by the given factor in the x
--   (horizontal) direction.
scalingX :: (Additive v, R1 v, Fractional n) => n -> Transformation v n

-- | Scale a diagram by the given factor in the x (horizontal) direction.
--   To scale uniformly, use scale.
scaleX :: (InSpace v n t, R2 v, Fractional n, Transformable t) => n -> t -> t

-- | Construct a transformation which scales by the given factor in the y
--   (vertical) direction.
scalingY :: (Additive v, R2 v, Fractional n) => n -> Transformation v n

-- | Scale a diagram by the given factor in the y (vertical) direction. To
--   scale uniformly, use scale.
scaleY :: (InSpace v n t, R2 v, Fractional n, Transformable t) => n -> t -> t

-- | Create a uniform scaling transformation.
scaling :: forall (v :: Type -> Type) n. (Additive v, Fractional n) => n -> Transformation v n

-- | Scale uniformly in every dimension by the given scalar.
scale :: forall (v :: Type -> Type) n a. (InSpace v n a, Eq n, Fractional n, Transformable a) => n -> a -> a

-- | scaleToX w scales a diagram in the x (horizontal) direction
--   by whatever factor required to make its width w.
--   scaleToX should not be applied to diagrams with a width of 0,
--   such as vrule.
scaleToX :: (InSpace v n t, R2 v, Enveloped t, Transformable t) => n -> t -> t

-- | scaleToY h scales a diagram in the y (vertical) direction by
--   whatever factor required to make its height h.
--   scaleToY should not be applied to diagrams with a height of
--   0, such as hrule.
scaleToY :: (InSpace v n t, R2 v, Enveloped t, Transformable t) => n -> t -> t

-- | scaleUToX w scales a diagram uniformly by whatever
--   factor required to make its width w. scaleUToX
--   should not be applied to diagrams with a width of 0, such as
--   vrule.
scaleUToX :: (InSpace v n t, R1 v, Enveloped t, Transformable t) => n -> t -> t

-- | scaleUToY h scales a diagram uniformly by whatever
--   factor required to make its height h. scaleUToY
--   should not be applied to diagrams with a height of 0, such as
--   hrule.
scaleUToY :: (InSpace v n t, R2 v, Enveloped t, Transformable t) => n -> t -> t

-- | Construct a transformation which translates by the given distance in
--   the x (horizontal) direction.
translationX :: (Additive v, R1 v, Num n) => n -> Transformation v n

-- | Translate a diagram by the given distance in the x (horizontal)
--   direction.
translateX :: (InSpace v n t, R1 v, Transformable t) => n -> t -> t

-- | Construct a transformation which translates by the given distance in
--   the y (vertical) direction.
translationY :: (Additive v, R2 v, Num n) => n -> Transformation v n

-- | Translate a diagram by the given distance in the y (vertical)
--   direction.
translateY :: (InSpace v n t, R2 v, Transformable t) => n -> t -> t

-- | Create a translation.
translation :: v n -> Transformation v n

-- | Translate by a vector.
translate :: Transformable t => Vn t -> t -> t

-- | The angle-preserving linear map that aligns the x-axis unit vector
--   with the given vector. See also scaleRotateTo.
scalingRotationTo :: Floating n => V2 n -> T2 n

-- | Rotate and uniformly scale around the local origin such that the
--   x-axis aligns with the given vector. This satisfies the equation
--   
--   
--   scaleRotateTo v = rotateTo (dir v) . scale (norm v)
--   
--   
--   up to floating point rounding errors, but is more accurate and
--   performant since it avoids cancellable uses of trigonometric
--   functions.
scaleRotateTo :: (InSpace V2 n t, Transformable t, Floating n) => V2 n -> t -> t

-- | Construct a transformation which flips a diagram from left to right,
--   i.e. sends the point (x,y) to (-x,y).
reflectionX :: (Additive v, R1 v, Num n) => Transformation v n

-- | Flip a diagram from left to right, i.e. send the point (x,y) to
--   (-x,y).
reflectX :: (InSpace v n t, R1 v, Transformable t) => t -> t

-- | Construct a transformation which flips a diagram from top to bottom,
--   i.e. sends the point (x,y) to (x,-y).
reflectionY :: (Additive v, R2 v, Num n) => Transformation v n

-- | Flip a diagram from top to bottom, i.e. send the point (x,y) to
--   (x,-y).
reflectY :: (InSpace v n t, R2 v, Transformable t) => t -> t

-- | Construct a transformation which flips the diagram about x=y, i.e.
--   sends the point (x,y) to (y,x).
reflectionXY :: (Additive v, R2 v, Num n) => Transformation v n

-- | Flips the diagram about x=y, i.e. send the point (x,y) to (y,x).
reflectXY :: (InSpace v n t, R2 v, Transformable t) => t -> t

-- | reflectionAbout p d is a reflection in the line determined by
--   the point p and direction d.
reflectionAbout :: OrderedField n => P2 n -> Direction V2 n -> T2 n

-- | reflectAbout p d reflects a diagram in the line determined by
--   the point p and direction d.
reflectAbout :: (InSpace V2 n t, OrderedField n, Transformable t) => P2 n -> Direction V2 n -> t -> t

-- | shearingX d is the linear transformation which is the
--   identity on y coordinates and sends (0,1) to (d,1).
shearingX :: Num n => n -> T2 n

-- | shearX d performs a shear in the x-direction which sends
--   (0,1) to (d,1).
shearX :: (InSpace V2 n t, Transformable t) => n -> t -> t

-- | shearingY d is the linear transformation which is the
--   identity on x coordinates and sends (1,0) to (1,d).
shearingY :: Num n => n -> T2 n

-- | shearY d performs a shear in the y-direction which sends
--   (1,0) to (1,d).
shearY :: (InSpace V2 n t, Transformable t) => n -> t -> t

-- | Wrapper for creating scale-invariant objects in two dimensions.
module Diagrams.Transform.ScaleInv

-- | The ScaleInv wrapper creates two-dimensional
--   scale-invariant objects. Intuitively, a scale-invariant object
--   is affected by transformations like translations and rotations, but
--   not by scales.
--   
--   However, this is problematic when it comes to non-uniform
--   scales (e.g. scaleX 2 . scaleY 3) since they can
--   introduce a perceived rotational component. The prototypical example
--   is an arrowhead on the end of a path, which should be scale-invariant.
--   However, applying a non-uniform scale to the path but not the
--   arrowhead would leave the arrowhead pointing in the wrong direction.
--   
--   Moreover, for objects whose local origin is not at the local origin of
--   the parent diagram, any scale can result in a translational component
--   as well.
--   
--   The solution is to also store a point (indicating the location,
--   i.e. the local origin) and a unit vector (indicating the
--   direction) along with a scale-invariant object. A
--   transformation to be applied is decomposed into rotational and
--   translational components as follows:
--   
--   
--   
- The transformation is applied to the direction vector, and the
--   difference in angle between the original direction vector and its
--   image under the transformation determines the rotational component.
--   The rotation is applied with respect to the stored location, rather
--   than the global origin.
--   
- The vector from the location to the image of the location under
--   the transformation determines the translational component.
--   
data ScaleInv t
ScaleInv :: t -> Vn t -> Point (V t) (N t) -> ScaleInv t
[_scaleInvObj] :: ScaleInv t -> t
[_scaleInvDir] :: ScaleInv t -> Vn t
[_scaleInvLoc] :: ScaleInv t -> Point (V t) (N t)
scaleInvObj :: forall t_aEUu. Lens' (ScaleInv t_aEUu) t_aEUu
scaleInvDir :: forall t_aEUu. Lens' (ScaleInv t_aEUu) (Vn t_aEUu)
scaleInvLoc :: forall t_aEUu. Lens' (ScaleInv t_aEUu) (Point (V t_aEUu) (N t_aEUu))

-- | Create a scale-invariant object pointing in the given direction,
--   located at the origin.
scaleInv :: (V t ~ v, N t ~ n, Additive v, Num n) => t -> v n -> ScaleInv t

-- | Create a diagram from a single scale-invariant primitive. The vector
--   argument specifies the direction in which the primitive is "pointing"
--   (for the purpose of keeping it rotated correctly under non-uniform
--   scaling). The primitive is assumed to be "located" at the origin (for
--   the purpose of translating it correctly under scaling).
--   
--   Note that the resulting diagram will have an empty envelope,
--   trace, and query. The reason is that the envelope, trace, and query
--   cannot be cached---applying a transformation would cause the cached
--   envelope, etc. to get "out of sync" with the scale-invariant object.
--   The intention, at any rate, is that scale-invariant things will be
--   used only as "decorations" (e.g. arrowheads) which should not
--   affect the envelope, trace, and query.
scaleInvPrim :: (V t ~ V2, N t ~ n, RealFloat n, Typeable t, Renderable t b, Monoid m) => t -> V2 n -> QDiagram b (V t) (N t) m
instance (Diagrams.Core.V.V t GHC.Types.~ v, Diagrams.Core.V.N t GHC.Types.~ n, Linear.Vector.Additive v, GHC.Num.Num n, Diagrams.Core.HasOrigin.HasOrigin t) => Diagrams.Core.HasOrigin.HasOrigin (Diagrams.Transform.ScaleInv.ScaleInv t)
instance (Diagrams.Core.V.V t GHC.Types.~ Linear.V2.V2, Diagrams.Core.V.N t GHC.Types.~ n, GHC.Float.RealFloat n, Diagrams.Core.Transform.Transformable t) => Diagrams.Core.Transform.Transformable (Diagrams.Transform.ScaleInv.ScaleInv t)
instance (Diagrams.Core.V.V t GHC.Types.~ Linear.V2.V2, Diagrams.Core.V.N t GHC.Types.~ n, GHC.Float.RealFloat n, Diagrams.Core.Types.Renderable t b) => Diagrams.Core.Types.Renderable (Diagrams.Transform.ScaleInv.ScaleInv t) b
instance (GHC.Show.Show t, GHC.Show.Show (Diagrams.Core.V.Vn t)) => GHC.Show.Show (Diagrams.Transform.ScaleInv.ScaleInv t)

-- | Transformations specific to three dimensions, with a few generic
--   transformations (uniform scaling, translation) also re-exported for
--   convenience.
module Diagrams.ThreeD.Transform
type T3 = Transformation V3

-- | Like aboutZ, but rotates about the X axis, bringing positive
--   y-values towards the positive z-axis.
aboutX :: Floating n => Angle n -> Transformation V3 n

-- | Like aboutZ, but rotates about the Y axis, bringing postive
--   x-values towards the negative z-axis.
aboutY :: Floating n => Angle n -> Transformation V3 n

-- | Create a transformation which rotates by the given angle about a line
--   parallel the Z axis passing through the local origin. A positive angle
--   brings positive x-values towards the positive-y axis.
--   
--   The angle can be expressed using any type which is an instance of
--   Angle. For example, aboutZ (1/4 @@ turn),
--   aboutZ (tau/4 @@ rad), and aboutZ (90 @@
--   deg) all represent the same transformation, namely, a
--   counterclockwise rotation by a right angle. For more general
--   rotations, see rotationAbout.
--   
--   Note that writing aboutZ (1/4), with no type annotation, will
--   yield an error since GHC cannot figure out which sort of angle you
--   want to use.
aboutZ :: Floating n => Angle n -> Transformation V3 n

-- | rotationAbout p d a is a rotation about a line parallel to
--   d passing through p.
rotationAbout :: Floating n => Point V3 n -> Direction V3 n -> Angle n -> Transformation V3 n

-- | rotationAbout p d a is a rotation about a line parallel to
--   d passing through p.
rotateAbout :: (InSpace V3 n t, Floating n, Transformable t) => Point V3 n -> Direction V3 n -> Angle n -> t -> t

-- | pointAt about initial final produces a rotation which brings
--   the direction initial to point in the direction
--   final by first panning around about, then tilting
--   about the axis perpendicular to about and final. In
--   particular, if this can be accomplished without tilting, it will be,
--   otherwise if only tilting is necessary, no panning will occur. The
--   tilt will always be between ± 1/4 turn.
pointAt :: (Floating n, Ord n) => Direction V3 n -> Direction V3 n -> Direction V3 n -> Transformation V3 n

-- | pointAt' has the same behavior as pointAt, but takes vectors
--   instead of directions.
pointAt' :: (Floating n, Ord n) => V3 n -> V3 n -> V3 n -> Transformation V3 n

-- | Construct a transformation which scales by the given factor in the x
--   (horizontal) direction.
scalingX :: (Additive v, R1 v, Fractional n) => n -> Transformation v n

-- | Construct a transformation which scales by the given factor in the y
--   (vertical) direction.
scalingY :: (Additive v, R2 v, Fractional n) => n -> Transformation v n

-- | Construct a transformation which scales by the given factor in the z
--   direction.
scalingZ :: (Additive v, R3 v, Fractional n) => n -> Transformation v n

-- | Scale a diagram by the given factor in the x (horizontal) direction.
--   To scale uniformly, use scale.
scaleX :: (InSpace v n t, R2 v, Fractional n, Transformable t) => n -> t -> t

-- | Scale a diagram by the given factor in the y (vertical) direction. To
--   scale uniformly, use scale.
scaleY :: (InSpace v n t, R2 v, Fractional n, Transformable t) => n -> t -> t

-- | Scale a diagram by the given factor in the z direction. To scale
--   uniformly, use scale.
scaleZ :: (InSpace v n t, R3 v, Fractional n, Transformable t) => n -> t -> t

-- | Create a uniform scaling transformation.
scaling :: forall (v :: Type -> Type) n. (Additive v, Fractional n) => n -> Transformation v n

-- | Scale uniformly in every dimension by the given scalar.
scale :: forall (v :: Type -> Type) n a. (InSpace v n a, Eq n, Fractional n, Transformable a) => n -> a -> a

-- | Construct a transformation which translates by the given distance in
--   the x (horizontal) direction.
translationX :: (Additive v, R1 v, Num n) => n -> Transformation v n

-- | Translate a diagram by the given distance in the x (horizontal)
--   direction.
translateX :: (InSpace v n t, R1 v, Transformable t) => n -> t -> t

-- | Construct a transformation which translates by the given distance in
--   the y (vertical) direction.
translationY :: (Additive v, R2 v, Num n) => n -> Transformation v n

-- | Translate a diagram by the given distance in the y (vertical)
--   direction.
translateY :: (InSpace v n t, R2 v, Transformable t) => n -> t -> t

-- | Construct a transformation which translates by the given distance in
--   the z direction.
translationZ :: (Additive v, R3 v, Num n) => n -> Transformation v n

-- | Translate a diagram by the given distance in the y direction.
translateZ :: (InSpace v n t, R3 v, Transformable t) => n -> t -> t

-- | Create a translation.
translation :: v n -> Transformation v n

-- | Translate by a vector.
translate :: Transformable t => Vn t -> t -> t

-- | Construct a transformation which flips a diagram from left to right,
--   i.e. sends the point (x,y) to (-x,y).
reflectionX :: (Additive v, R1 v, Num n) => Transformation v n

-- | Flip a diagram from left to right, i.e. send the point (x,y) to
--   (-x,y).
reflectX :: (InSpace v n t, R1 v, Transformable t) => t -> t

-- | Construct a transformation which flips a diagram from top to bottom,
--   i.e. sends the point (x,y) to (x,-y).
reflectionY :: (Additive v, R2 v, Num n) => Transformation v n

-- | Flip a diagram from top to bottom, i.e. send the point (x,y) to
--   (x,-y).
reflectY :: (InSpace v n t, R2 v, Transformable t) => t -> t

-- | Construct a transformation which flips a diagram across z=0, i.e.
--   sends the point (x,y,z) to (x,y,-z).
reflectionZ :: (Additive v, R3 v, Num n) => Transformation v n

-- | Flip a diagram across z=0, i.e. send the point (x,y,z) to (x,y,-z).
reflectZ :: (InSpace v n t, R3 v, Transformable t) => t -> t

-- | reflectionAcross p v is a reflection across the plane through
--   the point p and normal to vector v. This also works
--   as a 2D transform where v is the normal to the line passing
--   through point p.
reflectionAcross :: (Metric v, Fractional n) => Point v n -> v n -> Transformation v n

-- | reflectAcross p v reflects a diagram across the plane though
--   the point p and the vector v. This also works as a
--   2D transform where v is the normal to the line passing
--   through point p.
reflectAcross :: (InSpace v n t, Metric v, Fractional n, Transformable t) => Point v n -> v n -> t -> t

-- | Special functions for points in R2.
module Diagrams.TwoD.Points

-- | Find the convex hull of a list of points using Andrew's monotone chain
--   algorithm O(n log n).
--   
--   Returns clockwise list of points starting from the left-most point.
convexHull2D :: OrderedField n => [P2 n] -> [P2 n]

-- | Find the convex hull of a set of points already sorted in the x
--   direction. The first list of the tuple is the upper hull going
--   clockwise from left-most to right-most point. The second is the lower
--   hull from right-most to left-most in the anti-clockwise direction.
sortedConvexHull :: OrderedField n => [P2 n] -> ([P2 n], [P2 n])

-- | Three-dimensional vectors.
module Diagrams.ThreeD.Vector

-- | The unit vector in the positive X direction.
unitX :: (R1 v, Additive v, Num n) => v n

-- | The unit vector in the positive Y direction.
unitY :: (R2 v, Additive v, Num n) => v n

-- | The unit vector in the positive Y direction.
unitZ :: (R3 v, Additive v, Num n) => v n

-- | The unit vector in the negative X direction.
unit_X :: (R1 v, Additive v, Num n) => v n

-- | The unit vector in the negative Y direction.
unit_Y :: (R2 v, Additive v, Num n) => v n

-- | The unit vector in the negative X direction.
unit_Z :: (R3 v, Additive v, Num n) => v n

-- | A Direction pointing in the X direction.
xDir :: (R1 v, Additive v, Num n) => Direction v n

-- | A Direction pointing in the Y direction.
yDir :: (R2 v, Additive v, Num n) => Direction v n

-- | A Direction pointing in the Z direction.
zDir :: (R3 v, Additive v, Num n) => Direction v n

-- | Various three-dimensional shapes.
module Diagrams.ThreeD.Shapes

-- | Types which can be rendered as 3D Diagrams.
class Skinned t
skin :: (Skinned t, Renderable t b, N t ~ n, TypeableFloat n) => t -> QDiagram b V3 n Any
data Ellipsoid n
Ellipsoid :: Transformation V3 n -> Ellipsoid n

-- | A sphere of radius 1 with its center at the origin.
sphere :: Num n => Ellipsoid n
data Box n
Box :: Transformation V3 n -> Box n

-- | A cube with side length 1, in the positive octant, with one vertex at
--   the origin.
cube :: Num n => Box n
data Frustum n
Frustum :: n -> n -> Transformation V3 n -> Frustum n

-- | A frustum of a right circular cone. It has height 1 oriented along the
--   positive z axis, and radii r0 and r1 at Z=0 and Z=1. cone and
--   cylinder are special cases.
frustum :: Num n => n -> n -> Frustum n

-- | A cone with its base centered on the origin, with radius 1 at the
--   base, height 1, and it's apex on the positive Z axis.
cone :: Num n => Frustum n

-- | A circular cylinder of radius 1 with one end cap centered on the
--   origin, and extending to Z=1.
cylinder :: Num n => Frustum n

-- | A tree of Constructive Solid Geometry operations and the primitives
--   that can be used in them.
data CSG n
CsgEllipsoid :: Ellipsoid n -> CSG n
CsgBox :: Box n -> CSG n
CsgFrustum :: Frustum n -> CSG n
CsgUnion :: [CSG n] -> CSG n
CsgIntersection :: [CSG n] -> CSG n
CsgDifference :: CSG n -> CSG n -> CSG n
union :: (CsgPrim a, CsgPrim b) => a n -> b n -> CSG n
intersection :: (CsgPrim a, CsgPrim b) => a n -> b n -> CSG n
difference :: (CsgPrim a, CsgPrim b) => a n -> b n -> CSG n
instance Diagrams.ThreeD.Shapes.CsgPrim Diagrams.ThreeD.Shapes.Ellipsoid
instance Diagrams.ThreeD.Shapes.CsgPrim Diagrams.ThreeD.Shapes.Box
instance Diagrams.ThreeD.Shapes.CsgPrim Diagrams.ThreeD.Shapes.Frustum
instance Diagrams.ThreeD.Shapes.CsgPrim Diagrams.ThreeD.Shapes.CSG
instance GHC.Real.Fractional n => Diagrams.Core.Transform.Transformable (Diagrams.ThreeD.Shapes.CSG n)
instance GHC.Float.RealFloat n => Diagrams.Core.Envelope.Enveloped (Diagrams.ThreeD.Shapes.CSG n)
instance (GHC.Float.Floating n, GHC.Classes.Ord n) => Diagrams.Query.HasQuery (Diagrams.ThreeD.Shapes.CSG n) Data.Semigroup.Internal.Any
instance (GHC.Float.RealFloat n, GHC.Classes.Ord n) => Diagrams.Core.Trace.Traced (Diagrams.ThreeD.Shapes.CSG n)
instance (GHC.Float.RealFloat n, GHC.Classes.Ord n) => Diagrams.ThreeD.Shapes.Skinned (Diagrams.ThreeD.Shapes.CSG n)
instance Diagrams.Core.Envelope.OrderedField n => Diagrams.ThreeD.Shapes.Skinned (Diagrams.ThreeD.Shapes.Ellipsoid n)
instance Diagrams.Core.Envelope.OrderedField n => Diagrams.ThreeD.Shapes.Skinned (Diagrams.ThreeD.Shapes.Box n)
instance Diagrams.ThreeD.Shapes.Skinned (Diagrams.ThreeD.Shapes.Frustum n)
instance GHC.Real.Fractional n => Diagrams.Core.Transform.Transformable (Diagrams.ThreeD.Shapes.Frustum n)
instance GHC.Real.Fractional n => Diagrams.Core.Types.Renderable (Diagrams.ThreeD.Shapes.Frustum n) Diagrams.Core.Types.NullBackend
instance (Diagrams.Core.Envelope.OrderedField n, GHC.Float.RealFloat n) => Diagrams.Core.Envelope.Enveloped (Diagrams.ThreeD.Shapes.Frustum n)
instance (GHC.Float.RealFloat n, GHC.Classes.Ord n) => Diagrams.Core.Trace.Traced (Diagrams.ThreeD.Shapes.Frustum n)
instance Diagrams.Core.Envelope.OrderedField n => Diagrams.Query.HasQuery (Diagrams.ThreeD.Shapes.Frustum n) Data.Semigroup.Internal.Any
instance GHC.Real.Fractional n => Diagrams.Core.Transform.Transformable (Diagrams.ThreeD.Shapes.Box n)
instance GHC.Real.Fractional n => Diagrams.Core.Types.Renderable (Diagrams.ThreeD.Shapes.Box n) Diagrams.Core.Types.NullBackend
instance Diagrams.Core.Envelope.OrderedField n => Diagrams.Core.Envelope.Enveloped (Diagrams.ThreeD.Shapes.Box n)
instance (GHC.Real.Fractional n, GHC.Classes.Ord n) => Diagrams.Core.Trace.Traced (Diagrams.ThreeD.Shapes.Box n)
instance (GHC.Num.Num n, GHC.Classes.Ord n) => Diagrams.Query.HasQuery (Diagrams.ThreeD.Shapes.Box n) Data.Semigroup.Internal.Any
instance GHC.Real.Fractional n => Diagrams.Core.Transform.Transformable (Diagrams.ThreeD.Shapes.Ellipsoid n)
instance GHC.Real.Fractional n => Diagrams.Core.Types.Renderable (Diagrams.ThreeD.Shapes.Ellipsoid n) Diagrams.Core.Types.NullBackend
instance Diagrams.Core.Envelope.OrderedField n => Diagrams.Core.Envelope.Enveloped (Diagrams.ThreeD.Shapes.Ellipsoid n)
instance Diagrams.Core.Envelope.OrderedField n => Diagrams.Core.Trace.Traced (Diagrams.ThreeD.Shapes.Ellipsoid n)
instance (GHC.Num.Num n, GHC.Classes.Ord n) => Diagrams.Query.HasQuery (Diagrams.ThreeD.Shapes.Ellipsoid n) Data.Semigroup.Internal.Any

-- | Types to specify viewpoint for 3D rendering.
module Diagrams.ThreeD.Camera
data Camera l n

-- | A perspective projection
data PerspectiveLens n
PerspectiveLens :: Angle n -> Angle n -> PerspectiveLens n

-- | Horizontal field of view.
[_horizontalFieldOfView] :: PerspectiveLens n -> Angle n

-- | Vertical field of view.
[_verticalFieldOfView] :: PerspectiveLens n -> Angle n

-- | An orthographic projection
data OrthoLens n
OrthoLens :: n -> n -> OrthoLens n

-- | Width
[_orthoWidth] :: OrthoLens n -> n

-- | Height
[_orthoHeight] :: OrthoLens n -> n
horizontalFieldOfView :: forall n_aLLf. Lens' (PerspectiveLens n_aLLf) (Angle n_aLLf)
verticalFieldOfView :: forall n_aLLf. Lens' (PerspectiveLens n_aLLf) (Angle n_aLLf)
orthoWidth :: forall n_aLO2. Lens' (OrthoLens n_aLO2) n_aLO2
orthoHeight :: forall n_aLO2. Lens' (OrthoLens n_aLO2) n_aLO2
camLoc :: Camera l n -> Point V3 n
camForward :: Camera l n -> Direction V3 n
camUp :: Camera l n -> Direction V3 n
camRight :: Fractional n => Camera l n -> Direction V3 n
camLens :: Camera l n -> l n

-- | 'facing_ZCamera l' is a camera at the origin facing along the negative
--   Z axis, with its up-axis coincident with the positive Y axis, with the
--   projection defined by l.
facing_ZCamera :: (Floating n, Ord n, Typeable n, CameraLens l, Renderable (Camera l n) b) => l n -> QDiagram b V3 n Any

-- | A camera at the origin facing along the negative Z axis, with its
--   up-axis coincident with the positive Y axis. The field of view is
--   chosen to match a 50mm camera on 35mm film. Note that Cameras take up
--   no space in the Diagram.
mm50Camera :: (Typeable n, Floating n, Ord n, Renderable (Camera PerspectiveLens n) b) => QDiagram b V3 n Any

-- | mm50 has the field of view of a 50mm lens on standard 35mm film, hence
--   an aspect ratio of 3:2.
mm50 :: Floating n => PerspectiveLens n

-- | mm50blWide has the same vertical field of view as mm50, but an aspect
--   ratio of 1.6, suitable for wide screen computer monitors.
mm50Wide :: Floating n => PerspectiveLens n

-- | mm50Narrow has the same vertical field of view as mm50, but an aspect
--   ratio of 4:3, for VGA and similar computer resolutions.
mm50Narrow :: Floating n => PerspectiveLens n

-- | The natural aspect ratio of the projection.
aspect :: (CameraLens l, Floating n) => l n -> n
camAspect :: (Floating n, CameraLens l) => Camera l n -> n
instance Diagrams.ThreeD.Camera.CameraLens Diagrams.ThreeD.Camera.OrthoLens
instance GHC.Num.Num n => Diagrams.Core.Transform.Transformable (Diagrams.ThreeD.Camera.Camera l n)
instance GHC.Num.Num n => Diagrams.Core.Types.Renderable (Diagrams.ThreeD.Camera.Camera l n) Diagrams.Core.Types.NullBackend
instance Diagrams.ThreeD.Camera.CameraLens Diagrams.ThreeD.Camera.PerspectiveLens

-- | Some miscellaneous utilities provided by the diagrams-lib package.
module Diagrams.Util

-- | Several functions exported by the diagrams library take a number of
--   arguments giving the user control to "tweak" various aspects of their
--   behavior. Rather than give such functions a long list of arguments,
--   and to make it possible for the user to selectively override only
--   certain arguments and use default values for others, such sets of
--   arguments are collected into a record with named fields (see
--   PolygonOpts in Diagrams.TwoD.Shapes for an example).
--   Such record types are made instances of the Default class,
--   which provides a single record structure (def) collecting the
--   "default" arguments to the function. with is a synonym for
--   def, which provides nice-looking syntax for simulating
--   optional, named arguments in Haskell. For example,
--   
--   
--   polygon with {sides = 7, edgeSkip = 2}
--   
--   
--   
--   calls the polygon function with a single argument (note that
--   record update binds more tightly than function application!), namely,
--   with (the record of default arguments) where the sides
--   and edgeSkip fields have been updated.
with :: Default d => d

-- | applyAll takes a list of functions and applies them all to a
--   value, in sequence from the last function in the list to the first.
--   For example, applyAll [f1, f2, f3] a == f1 . f2 . f3 $ a.
applyAll :: [a -> a] -> a -> a

-- | Postfix function application, for conveniently applying attributes.
--   Unlike ($), (#) has a high precedence (8), so d
--   # foo # bar can be combined with other things using operators
--   like (|||) or (<>) without needing
--   parentheses.
(#) :: a -> (a -> b) -> b
infixl 8 #

-- | A replacement for lenses' # operator.
(##) :: AReview t b -> b -> t
infixr 8 ##

-- | iterateN n f x returns the list of the first n
--   iterates of f starting at x, that is, the list
--   [x, f x, f (f x), ...] of length n. (Note that the
--   last element of the list will be f applied to x
--   (n-1) times.)
iterateN :: Int -> (a -> a) -> a -> [a]

-- | The circle constant, the ratio of a circle's circumference to its
--   radius. Note that pi = tau/2.
--   
--   For more information and a well-reasoned argument why we should all be
--   using tau instead of pi, see The Tau Manifesto,
--   http://tauday.com/.
--   
--   To hear what it sounds like (and to easily memorize the first 30
--   digits or so), try http://youtu.be/3174T-3-59Q.
tau :: Floating a => a

-- | Given some file (no extension or otherwise) try to find a haskell
--   source file.
findHsFile :: FilePath -> IO (Maybe FilePath)

-- | Search for a sandbox in the following order:
--   
--   
--   
- Test given FilePaths if they point directly to a database or
--   contain a cabal config file (or any parent directory containing a
--   config file).
--   
- Same test for DIAGRAMS_SANDBOX environment value
--   
- Environment values of GHC_PACKAGE_PATH, HSENV
--   and PACKAGE_DB_FOR_GHC that point to a database.
--   
- Test for config file (cabal.sandbox.config) in the current
--   directory and its parents.
--   
findSandbox :: [FilePath] -> IO (Maybe FilePath)

-- | Find ghc's global package database. Throws an error if it isn't found.
globalPackage :: IO FilePath

-- | Given an associative binary operation and a default value to use in
--   the case of an empty list, perform a balanced fold over a list.
--   For example,
--   
--   
--   foldB (+) z [a,b,c,d,e,f] == ((a+b) + (c+d)) + (e+f)
--   
--   
foldB :: (a -> a -> a) -> a -> [a] -> a

-- | The alignment of an object refers to the position of its local
--   origin with respect to its envelope. This module defines the
--   Alignable class for things which can be aligned, as well as a
--   default implementation in terms of HasOrigin and
--   Enveloped, along with several utility methods for alignment.
module Diagrams.Align

-- | Class of things which can be aligned.
class Alignable a

-- | alignBy v d a moves the origin of a along the vector
--   v. If d = 1, the origin is moved to the edge of the
--   boundary in the direction of v; if d = -1, it moves
--   to the edge of the boundary in the direction of the negation of
--   v. Other values of d interpolate linearly (so for
--   example, d = 0 centers the origin along the direction of
--   v).
alignBy' :: (Alignable a, InSpace v n a, Fractional n, HasOrigin a) => (v n -> a -> Point v n) -> v n -> n -> a -> a
defaultBoundary :: (Alignable a, V a ~ v, N a ~ n) => v n -> a -> Point v n
alignBy :: (Alignable a, InSpace v n a, Fractional n, HasOrigin a) => v n -> n -> a -> a

-- | Default implementation of alignBy for types with
--   HasOrigin and AdditiveGroup instances.
alignBy'Default :: (InSpace v n a, Fractional n, HasOrigin a) => (v n -> a -> Point v n) -> v n -> n -> a -> a

-- | Some standard functions which can be used as the boundary
--   argument to alignBy'.
envelopeBoundary :: (V a ~ v, N a ~ n, Enveloped a) => v n -> a -> Point v n
traceBoundary :: (V a ~ v, N a ~ n, Num n, Traced a) => v n -> a -> Point v n

-- | align v aligns an enveloped object along the edge in the
--   direction of v. That is, it moves the local origin in the
--   direction of v until it is on the edge of the envelope. (Note
--   that if the local origin is outside the envelope to begin with, it may
--   have to move "backwards".)
align :: (InSpace v n a, Fractional n, Alignable a, HasOrigin a) => v n -> a -> a

-- | Like align but uses trace.
snug :: (InSpace v n a, Fractional n, Alignable a, Traced a, HasOrigin a) => v n -> a -> a

-- | centerV v centers an enveloped object along the direction of
--   v.
centerV :: (InSpace v n a, Fractional n, Alignable a, HasOrigin a) => v n -> a -> a

-- | center centers an enveloped object along all of its basis
--   vectors.
center :: (InSpace v n a, Fractional n, Traversable v, Alignable a, HasOrigin a) => a -> a

-- | Version of alignBy specialized to use traceBoundary
snugBy :: (InSpace v n a, Fractional n, Alignable a, Traced a, HasOrigin a) => v n -> n -> a -> a

-- | Like centerV using trace.
snugCenterV :: (InSpace v n a, Fractional n, Alignable a, Traced a, HasOrigin a) => v n -> a -> a

-- | Like center using trace.
snugCenter :: (InSpace v n a, Traversable v, Fractional n, Alignable a, HasOrigin a, Traced a) => a -> a
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.Align.Alignable (Diagrams.Core.Envelope.Envelope v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.Align.Alignable (Diagrams.Core.Trace.Trace v n)
instance (Diagrams.Core.V.V b GHC.Types.~ v, Diagrams.Core.V.N b GHC.Types.~ n, Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, Diagrams.Align.Alignable b) => Diagrams.Align.Alignable [b]
instance (Diagrams.Core.V.V b GHC.Types.~ v, Diagrams.Core.V.N b GHC.Types.~ n, Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, Diagrams.Align.Alignable b) => Diagrams.Align.Alignable (Data.Set.Internal.Set b)
instance (Diagrams.Core.V.V b GHC.Types.~ v, Diagrams.Core.V.N b GHC.Types.~ n, Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, Diagrams.Align.Alignable b) => Diagrams.Align.Alignable (Data.Map.Internal.Map k b)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, Data.Monoid.WithSemigroup.Monoid' m) => Diagrams.Align.Alignable (Diagrams.Core.Types.QDiagram b v n m)
instance (Diagrams.Core.V.InSpace v n a, Diagrams.Core.HasOrigin.HasOrigin a, Diagrams.Align.Alignable a) => Diagrams.Align.Alignable (b -> a)

-- | Alignment combinators specialized for two dimensions. See
--   Diagrams.Align for more general alignment combinators.
--   
--   The basic idea is that alignment is achieved by moving diagrams' local
--   origins relative to their envelopes or traces (or some other sort of
--   boundary). For example, to align several diagrams along their tops, we
--   first move their local origins to the upper edge of their boundary
--   (using e.g. map alignTop), and then put them
--   together with their local origins along a horizontal line (using e.g.
--   hcat from Diagrams.TwoD.Combinators).
module Diagrams.TwoD.Align

-- | Align along the left edge, i.e. translate the diagram in a horizontal
--   direction so that the local origin is on the left edge of the
--   envelope.
alignL :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Align along the right edge.
alignR :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Align along the top edge.
alignT :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Align along the bottom edge.
alignB :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a
alignTL :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a
alignTR :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a
alignBL :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a
alignBR :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a
snugL :: (InSpace V2 n a, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
snugR :: (InSpace V2 n a, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
snugT :: (InSpace V2 n a, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
snugB :: (InSpace V2 n a, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a

-- | alignX and snugX move the local origin horizontally
--   as follows:
--   
--   
--   
- alignX (-1) moves the local origin to the left edge of
--   the boundary;
--   
- align 1 moves the local origin to the right edge;
--   
- any other argument interpolates linearly between these. For
--   example, alignX 0 centers, alignX 2 moves the origin
--   one "radius" to the right of the right edge, and so on.
--   
- snugX works the same way.
--   
alignX :: (InSpace v n a, R1 v, Fractional n, Alignable a, HasOrigin a) => n -> a -> a

-- | See the documentation for alignX.
snugX :: (InSpace v n a, R1 v, Fractional n, Alignable a, Traced a, HasOrigin a) => n -> a -> a

-- | Like alignX, but moving the local origin vertically, with an
--   argument of 1 corresponding to the top edge and (-1)
--   corresponding to the bottom edge.
alignY :: (InSpace v n a, R2 v, Fractional n, Alignable a, HasOrigin a) => n -> a -> a

-- | See the documentation for alignY.
snugY :: (InSpace v n a, R2 v, Fractional n, Alignable a, Traced a, HasOrigin a) => n -> a -> a

-- | Center the local origin along the X-axis.
centerX :: (InSpace v n a, R1 v, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Center the local origin along the Y-axis.
centerY :: (InSpace v n a, R2 v, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Center along both the X- and Y-axes.
centerXY :: (InSpace v n a, R2 v, Fractional n, Alignable a, HasOrigin a) => a -> a
snugCenterX :: (InSpace v n a, R1 v, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
snugCenterY :: (InSpace v n a, R2 v, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
snugCenterXY :: (InSpace v n a, R2 v, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a

-- | Alignment combinators specialized for three dimensions. See
--   Diagrams.Align for more general alignment combinators.
--   
--   The basic idea is that alignment is achieved by moving diagrams' local
--   origins relative to their envelopes or traces (or some other sort of
--   boundary). For example, to align several diagrams along their tops, we
--   first move their local origins to the upper edge of their boundary
--   (using e.g. map alignZMax), and then put them together
--   with their local origins along a line (using e.g. cat from
--   Diagrams.Combinators).
module Diagrams.ThreeD.Align

-- | Translate the diagram along unitX so that all points have positive
--   x-values.
alignXMin :: (InSpace v n a, R1 v, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Translate the diagram along unitX so that all points have negative
--   x-values.
alignXMax :: (InSpace v n a, R1 v, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Translate the diagram along unitY so that all points have positive
--   y-values.
alignYMin :: (InSpace v n a, R2 v, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Translate the diagram along unitY so that all points have negative
--   y-values.
alignYMax :: (InSpace v n a, R2 v, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Translate the diagram along unitZ so that all points have positive
--   z-values.
alignZMin :: (InSpace v n a, R3 v, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Translate the diagram along unitZ so that all points have negative
--   z-values.
alignZMax :: (InSpace v n a, R3 v, Fractional n, Alignable a, HasOrigin a) => a -> a
snugXMin :: (InSpace v n a, R1 v, Fractional n, Alignable a, HasOrigin a, Traced a) => a -> a
snugXMax :: (InSpace v n a, R1 v, Fractional n, Alignable a, HasOrigin a, Traced a) => a -> a
snugYMin :: (InSpace v n a, R2 v, Fractional n, Alignable a, HasOrigin a, Traced a) => a -> a
snugYMax :: (InSpace v n a, R2 v, Fractional n, Alignable a, HasOrigin a, Traced a) => a -> a
snugZMin :: (InSpace v n a, R3 v, Fractional n, Alignable a, HasOrigin a, Traced a) => a -> a
snugZMax :: (InSpace v n a, R3 v, Fractional n, Alignable a, HasOrigin a, Traced a) => a -> a

-- | alignX and snugX move the local origin horizontally
--   as follows:
--   
--   
--   
- alignX (-1) moves the local origin to the left edge of
--   the boundary;
--   
- align 1 moves the local origin to the right edge;
--   
- any other argument interpolates linearly between these. For
--   example, alignX 0 centers, alignX 2 moves the origin
--   one "radius" to the right of the right edge, and so on.
--   
- snugX works the same way.
--   
alignX :: (InSpace v n a, R1 v, Fractional n, Alignable a, HasOrigin a) => n -> a -> a

-- | See the documentation for alignX.
snugX :: (InSpace v n a, R1 v, Fractional n, Alignable a, Traced a, HasOrigin a) => n -> a -> a

-- | Like alignX, but moving the local origin vertically, with an
--   argument of 1 corresponding to the top edge and (-1)
--   corresponding to the bottom edge.
alignY :: (InSpace v n a, R2 v, Fractional n, Alignable a, HasOrigin a) => n -> a -> a

-- | See the documentation for alignY.
snugY :: (InSpace v n a, R2 v, Fractional n, Alignable a, Traced a, HasOrigin a) => n -> a -> a

-- | Like alignX, but moving the local origin in the Z direction,
--   with an argument of 1 corresponding to the top edge and
--   (-1) corresponding to the bottom edge.
alignZ :: (InSpace v n a, R3 v, Fractional n, Alignable a, HasOrigin a) => n -> a -> a

-- | See the documentation for alignZ.
snugZ :: (V a ~ v, N a ~ n, Alignable a, Traced a, HasOrigin a, R3 v, Fractional n) => n -> a -> a

-- | Center the local origin along the X-axis.
centerX :: (InSpace v n a, R1 v, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Center the local origin along the Y-axis.
centerY :: (InSpace v n a, R2 v, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Center the local origin along the Z-axis.
centerZ :: (InSpace v n a, R3 v, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Center along both the X- and Y-axes.
centerXY :: (InSpace v n a, R2 v, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Center along both the X- and Z-axes.
centerXZ :: (InSpace v n a, R3 v, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Center along both the Y- and Z-axes.
centerYZ :: (InSpace v n a, R3 v, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Center an object in three dimensions.
centerXYZ :: (InSpace v n a, R3 v, Fractional n, Alignable a, HasOrigin a) => a -> a
snugCenterX :: (InSpace v n a, R1 v, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
snugCenterY :: (InSpace v n a, R2 v, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
snugCenterZ :: (InSpace v n a, R3 v, Fractional n, Alignable a, HasOrigin a, Traced a) => a -> a
snugCenterXY :: (InSpace v n a, R2 v, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
snugCenterXZ :: (InSpace v n a, R3 v, Fractional n, Alignable a, HasOrigin a, Traced a) => a -> a
snugCenterYZ :: (InSpace v n a, R3 v, Fractional n, Alignable a, HasOrigin a, Traced a) => a -> a
snugCenterXYZ :: (InSpace v n a, R3 v, Fractional n, Alignable a, HasOrigin a, Traced a) => a -> a

-- | "Located" things, i.e. things with a concrete location:
--   intuitively, Located a ~ (a, Point). Wrapping a
--   translationally invariant thing (e.g. a Segment or
--   Trail) in Located pins it down to a particular
--   location and makes it no longer translationally invariant.
module Diagrams.Located

-- | "Located" things, i.e. things with a concrete location:
--   intuitively, Located a ~ (Point, a). Wrapping a
--   translationally invariant thing (e.g. a Segment or
--   Trail) in Located pins it down to a particular
--   location and makes it no longer translationally invariant.
--   
--   Located is intentionally abstract. To construct
--   Located values, use at. To destruct, use
--   viewLoc, unLoc, or loc. To map, use
--   mapLoc.
--   
--   Much of the utility of having a concrete type for the Located
--   concept lies in the type class instances we can give it. The
--   HasOrigin, Transformable, Enveloped,
--   Traced, and TrailLike instances are particularly
--   useful; see the documented instances below for more information.
data Located a
Loc :: Point (V a) (N a) -> a -> Located a

-- | Project out the location of a Located value.
[loc] :: Located a -> Point (V a) (N a)

-- | Project the value of type a out of a Located a,
--   discarding the location.
[unLoc] :: Located a -> a

-- | Construct a Located a from a value of type a and a
--   location. at is intended to be used infix, like x `at`
--   origin.
at :: a -> Point (V a) (N a) -> Located a
infix 5 `at`

-- | Deconstruct a Located a into a location and a value of type
--   a. viewLoc can be especially useful in conjunction
--   with the ViewPatterns extension.
viewLoc :: Located a -> (Point (V a) (N a), a)

-- | Located is not a Functor, since changing the type
--   could change the type of the associated vector space, in which case
--   the associated location would no longer have the right type.
--   mapLoc has an extra constraint specifying that the vector space
--   must stay the same.
--   
--   (Technically, one can say that for every vector space v,
--   Located is a little-f (endo)functor on the category of types
--   with associated vector space v; but that is not covered by
--   the standard Functor class.)
mapLoc :: SameSpace a b => (a -> b) -> Located a -> Located b

-- | A lens giving access to the object within a Located wrapper.
located :: SameSpace a b => Lens (Located a) (Located b) a b

-- | Lens onto the location of something Located.
_loc :: Lens' (Located a) (Point (V a) (N a))
instance GHC.Generics.Generic (Diagrams.Located.Located a)
instance (GHC.Classes.Eq (Diagrams.Core.V.V a (Diagrams.Core.V.N a)), GHC.Classes.Eq a) => GHC.Classes.Eq (Diagrams.Located.Located a)
instance (GHC.Classes.Ord (Diagrams.Core.V.V a (Diagrams.Core.V.N a)), GHC.Classes.Ord a) => GHC.Classes.Ord (Diagrams.Located.Located a)
instance (Data.Serialize.Serialize a, Data.Serialize.Serialize (Diagrams.Core.V.V a (Diagrams.Core.V.N a))) => Data.Serialize.Serialize (Diagrams.Located.Located a)
instance (GHC.Show.Show (Diagrams.Core.V.V a (Diagrams.Core.V.N a)), GHC.Show.Show a) => GHC.Show.Show (Diagrams.Located.Located a)
instance (GHC.Read.Read (Diagrams.Core.V.V a (Diagrams.Core.V.N a)), GHC.Read.Read a) => GHC.Read.Read (Diagrams.Located.Located a)
instance (GHC.Num.Num (Diagrams.Core.V.N a), Linear.Vector.Additive (Diagrams.Core.V.V a)) => Diagrams.Core.HasOrigin.HasOrigin (Diagrams.Located.Located a)
instance (Linear.Vector.Additive (Diagrams.Core.V.V a), GHC.Num.Num (Diagrams.Core.V.N a), Diagrams.Core.Transform.Transformable a) => Diagrams.Core.Transform.Transformable (Diagrams.Located.Located a)
instance Diagrams.Core.Envelope.Enveloped a => Diagrams.Core.Envelope.Enveloped (Diagrams.Located.Located a)
instance Diagrams.Core.Envelope.Enveloped a => Diagrams.Core.Juxtapose.Juxtaposable (Diagrams.Located.Located a)
instance (Diagrams.Core.Trace.Traced a, GHC.Num.Num (Diagrams.Core.V.N a)) => Diagrams.Core.Trace.Traced (Diagrams.Located.Located a)
instance Diagrams.Align.Alignable a => Diagrams.Align.Alignable (Diagrams.Located.Located a)
instance Diagrams.Core.Names.Qualifiable a => Diagrams.Core.Names.Qualifiable (Diagrams.Located.Located a)
instance (Diagrams.Core.V.InSpace v n a, Diagrams.Parametric.Parametric a, Diagrams.Parametric.Codomain a GHC.Types.~ v) => Diagrams.Parametric.Parametric (Diagrams.Located.Located a)
instance Diagrams.Parametric.DomainBounds a => Diagrams.Parametric.DomainBounds (Diagrams.Located.Located a)
instance (Diagrams.Core.V.InSpace v n a, Diagrams.Parametric.EndValues a, Diagrams.Parametric.Codomain a GHC.Types.~ v) => Diagrams.Parametric.EndValues (Diagrams.Located.Located a)
instance (Diagrams.Core.V.InSpace v n a, GHC.Real.Fractional n, Diagrams.Parametric.Parametric a, Diagrams.Parametric.Sectionable a, Diagrams.Parametric.Codomain a GHC.Types.~ v) => Diagrams.Parametric.Sectionable (Diagrams.Located.Located a)
instance (Diagrams.Core.V.InSpace v n a, GHC.Real.Fractional n, Diagrams.Parametric.HasArcLength a, Diagrams.Parametric.Codomain a GHC.Types.~ v) => Diagrams.Parametric.HasArcLength (Diagrams.Located.Located a)

-- | A segment is a translation-invariant, atomic path. Currently,
--   there are two types: linear (i.e. just a straight line to the
--   endpoint) and cubic Bézier curves (i.e. a curve to an endpoint
--   with two control points). This module contains tools for creating and
--   manipulating segments, as well as a definition of segments with a
--   fixed location (useful for backend implementors).
--   
--   Generally speaking, casual users of diagrams should not need this
--   module; the higher-level functionality provided by
--   Diagrams.Trail, Diagrams.TrailLike, and
--   Diagrams.Path should usually suffice. However, directly
--   manipulating segments can occasionally be useful.
module Diagrams.Segment

-- | Type tag for open segments.
data Open

-- | Type tag for closed segments.
data Closed

-- | The offset of a segment is the vector from its starting point
--   to its end. The offset for an open segment is determined by the
--   context, i.e. its endpoint is not fixed. The offset for a
--   closed segment is stored explicitly, i.e. its endpoint
--   is at a fixed offset from its start.
data Offset c v n
[OffsetOpen] :: Offset Open v n
[OffsetClosed] :: v n -> Offset Closed v n

-- | Compute the offset from the start of a segment to the end. Note that
--   in the case of a Bézier segment this is not the same as the
--   length of the curve itself; for that, see arcLength.
segOffset :: Segment Closed v n -> v n

-- | The atomic constituents of the concrete representation currently used
--   for trails are segments, currently limited to single straight
--   lines or cubic Bézier curves. Segments are translationally
--   invariant, that is, they have no particular "location" and are
--   unaffected by translations. They are, however, affected by other
--   transformations such as rotations and scales.
data Segment c v n

-- | A linear segment with given offset.
Linear :: !Offset c v n -> Segment c v n

-- | A cubic Bézier segment specified by three offsets from the starting
--   point to the first control point, second control point, and ending
--   point, respectively.
Cubic :: !v n -> !v n -> !Offset c v n -> Segment c v n

-- | straight v constructs a translationally invariant
--   linear segment with direction and length given by the vector
--   v.
straight :: v n -> Segment Closed v n

-- | bezier3 c1 c2 x constructs a translationally invariant cubic
--   Bézier curve where the offsets from the first endpoint to the first
--   and second control point and endpoint are respectively given by
--   c1, c2, and x.
bezier3 :: v n -> v n -> v n -> Segment Closed v n

-- | bézier3 is the same as bezier3, but with more
--   snobbery.
bézier3 :: v n -> v n -> v n -> Segment Closed v n

-- | Reverse the direction of a segment.
reverseSegment :: (Num n, Additive v) => Segment Closed v n -> Segment Closed v n

-- | Map over the vectors of each segment.
mapSegmentVectors :: (v n -> v' n') -> Segment c v n -> Segment c v' n'

-- | An open linear segment. This means the trail makes a straight line
--   from the last segment the beginning to form a loop.
openLinear :: Segment Open v n

-- | An open cubic segment. This means the trail makes a cubic bézier with
--   control vectors v1 and v2 to form a loop.
openCubic :: v n -> v n -> Segment Open v n

-- | FixedSegments are like Segments except that they have
--   absolute locations. FixedSegment v is isomorphic to
--   Located (Segment Closed v), as witnessed by mkFixedSeg
--   and fromFixedSeg, but FixedSegment is convenient when
--   one needs the absolute locations of the vertices and control points.
data FixedSegment v n
FLinear :: Point v n -> Point v n -> FixedSegment v n
FCubic :: Point v n -> Point v n -> Point v n -> Point v n -> FixedSegment v n

-- | Create a FixedSegment from a located Segment.
mkFixedSeg :: (Num n, Additive v) => Located (Segment Closed v n) -> FixedSegment v n

-- | Convert a FixedSegment back into a located Segment.
fromFixedSeg :: (Num n, Additive v) => FixedSegment v n -> Located (Segment Closed v n)

-- | Use a FixedSegment to make an ReifiedIso between an a
--   fixed segment and a located segment.
fixedSegIso :: (Num n, Additive v) => Iso' (FixedSegment v n) (Located (Segment Closed v n))

-- | A type to track the count of segments in a Trail.
newtype SegCount
SegCount :: Sum Int -> SegCount

-- | A type to represent the total arc length of a chain of segments. The
--   first component is a "standard" arc length, computed to within a
--   tolerance of 10e-6. The second component is a generic arc
--   length function taking the tolerance as an argument.
newtype ArcLength n
ArcLength :: (Sum (Interval n), n -> Sum (Interval n)) -> ArcLength n

-- | Project out the cached arc length, stored together with error bounds.
getArcLengthCached :: ArcLength n -> Interval n

-- | Project out the generic arc length function taking the tolerance as an
--   argument.
getArcLengthFun :: ArcLength n -> n -> Interval n

-- | Given a specified tolerance, project out the cached arc length if it
--   is accurate enough; otherwise call the generic arc length function
--   with the given tolerance.
getArcLengthBounded :: (Num n, Ord n) => n -> ArcLength n -> Interval n

-- | A type to represent the total cumulative offset of a chain of
--   segments.
newtype TotalOffset v n
TotalOffset :: v n -> TotalOffset v n

-- | A type to represent the offset and envelope of a chain of segments.
--   They have to be paired into one data structure, since combining the
--   envelopes of two consecutive chains needs to take the offset of the
--   first into account.
data OffsetEnvelope v n
OffsetEnvelope :: !TotalOffset v n -> Envelope v n -> OffsetEnvelope v n
[_oeOffset] :: OffsetEnvelope v n -> !TotalOffset v n
[_oeEnvelope] :: OffsetEnvelope v n -> Envelope v n
oeOffset :: forall v_aXjP n_aXjQ. Lens' (OffsetEnvelope v_aXjP n_aXjQ) (TotalOffset v_aXjP n_aXjQ)
oeEnvelope :: forall v_aXjP n_aXjQ. Lens' (OffsetEnvelope v_aXjP n_aXjQ) (Envelope v_aXjP n_aXjQ)

-- | SegMeasure collects up all the measurements over a chain of
--   segments.
type SegMeasure v n = SegCount ::: ArcLength n ::: OffsetEnvelope v n ::: ()
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Data.FingerTree.Measured (Diagrams.Segment.SegMeasure v n) (Diagrams.Segment.SegMeasure v n)
instance (Diagrams.Core.Envelope.OrderedField n, Linear.Metric.Metric v) => Data.FingerTree.Measured (Diagrams.Segment.SegMeasure v n) (Diagrams.Segment.Segment Diagrams.Segment.Closed v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => GHC.Base.Semigroup (Diagrams.Segment.OffsetEnvelope v n)
instance Data.Serialize.Serialize (v n) => Data.Serialize.Serialize (Diagrams.Segment.Segment Diagrams.Segment.Open v n)
instance Data.Serialize.Serialize (v n) => Data.Serialize.Serialize (Diagrams.Segment.Segment Diagrams.Segment.Closed v n)
instance GHC.Classes.Ord (v n) => GHC.Classes.Ord (Diagrams.Segment.Segment c v n)
instance GHC.Classes.Eq (v n) => GHC.Classes.Eq (Diagrams.Segment.Segment c v n)
instance GHC.Base.Functor v => GHC.Base.Functor (Diagrams.Segment.Segment c v)
instance GHC.Show.Show (v n) => GHC.Show.Show (Diagrams.Segment.FixedSegment v n)
instance GHC.Classes.Ord (v n) => GHC.Classes.Ord (Diagrams.Segment.FixedSegment v n)
instance GHC.Classes.Eq (v n) => GHC.Classes.Eq (Diagrams.Segment.FixedSegment v n)
instance GHC.Base.Monoid Diagrams.Segment.SegCount
instance GHC.Base.Semigroup Diagrams.Segment.SegCount
instance GHC.Show.Show (v n) => GHC.Show.Show (Diagrams.Segment.Offset c v n)
instance GHC.Classes.Eq (v n) => GHC.Classes.Eq (Diagrams.Segment.Offset c v n)
instance GHC.Classes.Ord (v n) => GHC.Classes.Ord (Diagrams.Segment.Offset c v n)
instance (GHC.Num.Num n, GHC.Classes.Ord n) => GHC.Base.Semigroup (Diagrams.Segment.ArcLength n)
instance (GHC.Num.Num n, GHC.Classes.Ord n) => GHC.Base.Monoid (Diagrams.Segment.ArcLength n)
instance Control.Lens.Wrapped.Wrapped (Diagrams.Segment.TotalOffset v n)
instance Control.Lens.Wrapped.Rewrapped (Diagrams.Segment.TotalOffset v n) (Diagrams.Segment.TotalOffset v' n')
instance (GHC.Num.Num n, Linear.Vector.Additive v) => GHC.Base.Semigroup (Diagrams.Segment.TotalOffset v n)
instance (GHC.Num.Num n, Linear.Vector.Additive v) => GHC.Base.Monoid (Diagrams.Segment.TotalOffset v n)
instance Control.Lens.Wrapped.Wrapped (Diagrams.Segment.ArcLength n)
instance Control.Lens.Wrapped.Rewrapped (Diagrams.Segment.ArcLength n) (Diagrams.Segment.ArcLength n')
instance Control.Lens.Wrapped.Wrapped Diagrams.Segment.SegCount
instance Control.Lens.Wrapped.Rewrapped Diagrams.Segment.SegCount Diagrams.Segment.SegCount
instance Control.Lens.Each.Each (Diagrams.Segment.FixedSegment v n) (Diagrams.Segment.FixedSegment v' n') (Linear.Affine.Point v n) (Linear.Affine.Point v' n')
instance Control.Lens.Internal.Iso.Reversing (Diagrams.Segment.FixedSegment v n)
instance (Linear.Vector.Additive v, GHC.Num.Num n) => Diagrams.Core.Transform.Transformable (Diagrams.Segment.FixedSegment v n)
instance (Linear.Vector.Additive v, GHC.Num.Num n) => Diagrams.Core.HasOrigin.HasOrigin (Diagrams.Segment.FixedSegment v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.Core.Envelope.Enveloped (Diagrams.Segment.FixedSegment v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.Parametric.HasArcLength (Diagrams.Segment.FixedSegment v n)
instance (Linear.Vector.Additive v, GHC.Num.Num n) => Diagrams.Parametric.Parametric (Diagrams.Segment.FixedSegment v n)
instance GHC.Num.Num n => Diagrams.Parametric.DomainBounds (Diagrams.Segment.FixedSegment v n)
instance (Linear.Vector.Additive v, GHC.Num.Num n) => Diagrams.Parametric.EndValues (Diagrams.Segment.FixedSegment v n)
instance (Linear.Vector.Additive v, GHC.Real.Fractional n) => Diagrams.Parametric.Sectionable (Diagrams.Segment.FixedSegment v n)
instance GHC.Show.Show (v n) => GHC.Show.Show (Diagrams.Segment.Segment c v n)
instance Control.Lens.Each.Each (Diagrams.Segment.Segment c v n) (Diagrams.Segment.Segment c v' n') (v n) (v' n')
instance (Linear.Vector.Additive v, GHC.Num.Num n) => Control.Lens.Internal.Iso.Reversing (Diagrams.Segment.Segment Diagrams.Segment.Closed v n)
instance Diagrams.Core.Transform.Transformable (Diagrams.Segment.Segment c v n)
instance Diagrams.Core.Types.Renderable (Diagrams.Segment.Segment c v n) Diagrams.Core.Types.NullBackend
instance (Linear.Vector.Additive v, GHC.Num.Num n) => Diagrams.Parametric.Parametric (Diagrams.Segment.Segment Diagrams.Segment.Closed v n)
instance GHC.Num.Num n => Diagrams.Parametric.DomainBounds (Diagrams.Segment.Segment Diagrams.Segment.Closed v n)
instance (Linear.Vector.Additive v, GHC.Num.Num n) => Diagrams.Parametric.EndValues (Diagrams.Segment.Segment Diagrams.Segment.Closed v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.Core.Envelope.Enveloped (Diagrams.Segment.Segment Diagrams.Segment.Closed v n)
instance (Linear.Vector.Additive v, GHC.Real.Fractional n) => Diagrams.Parametric.Sectionable (Diagrams.Segment.Segment Diagrams.Segment.Closed v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.Parametric.HasArcLength (Diagrams.Segment.Segment Diagrams.Segment.Closed v n)
instance GHC.Base.Functor v => GHC.Base.Functor (Diagrams.Segment.Offset c v)
instance Control.Lens.Each.Each (Diagrams.Segment.Offset c v n) (Diagrams.Segment.Offset c v' n') (v n) (v' n')
instance (Linear.Vector.Additive v, GHC.Num.Num n) => Control.Lens.Internal.Iso.Reversing (Diagrams.Segment.Offset c v n)
instance Diagrams.Core.Transform.Transformable (Diagrams.Segment.Offset c v n)

-- | Segments in two dimensions are special since we may meaningfully
--   compute their point of intersection with a ray.
module Diagrams.TwoD.Segment

-- | Compute the intersections between two fixed segments.
intersectPointsS :: OrderedField n => FixedSegment V2 n -> FixedSegment V2 n -> [P2 n]

-- | Compute the intersections between two segments using the given
--   tolerance.
intersectPointsS' :: OrderedField n => n -> FixedSegment V2 n -> FixedSegment V2 n -> [P2 n]

-- | Get the closest point(s) on a FixedSegment from a point.
closestPoint :: OrderedField n => FixedSegment V2 n -> P2 n -> [P2 n]

-- | Get the closest point(s) on a FixedSegment from a point within
--   given tolerance.
closestPoint' :: OrderedField n => n -> FixedSegment V2 n -> P2 n -> [P2 n]

-- | Get the closest distance(s) from a point to a FixedSegment.
closestDistance :: OrderedField n => FixedSegment V2 n -> P2 n -> [n]

-- | Get the closest distance(s) from a point to a FixedSegment
--   within given tolerance.
closestDistance' :: OrderedField n => n -> FixedSegment V2 n -> P2 n -> [n]

-- | Find the closest value(s) on the Bêzier to the given point.
closestParam :: OrderedField n => FixedSegment V2 n -> P2 n -> [n]

-- | Find the closest value(s) on the Bêzier to the given point within
--   given tolerance.
closestParam' :: OrderedField n => n -> FixedSegment V2 n -> P2 n -> [n]

-- | Return the intersection points with the parameters at which each
--   segment intersects.
segmentSegment :: OrderedField n => n -> FixedSegment V2 n -> FixedSegment V2 n -> [(n, n, P2 n)]

-- | Return the intersection points with the parameters at which the line
--   and segment intersect.
lineSegment :: OrderedField n => n -> Located (V2 n) -> FixedSegment V2 n -> [(n, n, P2 n)]
instance Diagrams.Core.Envelope.OrderedField n => Diagrams.Core.Trace.Traced (Diagrams.Segment.Segment Diagrams.Segment.Closed Linear.V2.V2 n)
instance Diagrams.Core.Envelope.OrderedField n => Diagrams.Core.Trace.Traced (Diagrams.Segment.FixedSegment Linear.V2.V2 n)

-- | Computing tangent and normal vectors for segments and trails.
module Diagrams.Tangent

-- | Compute the tangent vector to a segment or trail at a particular
--   parameter.
--   
--   Examples of more specific types this function can have include
--   
--   
--   
- 
Segment Closed V2 -> Double -> V2 Double

--   
- 
Trail' Line V2 -> Double -> V2 Double

--   
- 
Located (Trail V2) -> Double -> V2 Double

--   
--   
--   See the instances listed for the Tangent newtype for more.
tangentAtParam :: Parametric (Tangent t) => t -> N t -> Vn t

-- | Compute the tangent vector at the start of a segment or trail.
tangentAtStart :: EndValues (Tangent t) => t -> Vn t

-- | Compute the tangent vector at the end of a segment or trail.
tangentAtEnd :: EndValues (Tangent t) => t -> Vn t

-- | Compute the (unit) normal vector to a segment or trail at a particular
--   parameter.
--   
--   Examples of more specific types this function can have include
--   
--   
--   
- 
Segment Closed V2 Double -> Double -> V2
--   Double

--   
- 
Trail' Line V2 Double -> Double -> V2 Double

--   
- 
Located (Trail V2 Double) -> Double -> V2
--   Double

--   
--   
--   See the instances listed for the Tangent newtype for more.
normalAtParam :: (InSpace V2 n t, Parametric (Tangent t), Floating n) => t -> n -> V2 n

-- | Compute the normal vector at the start of a segment or trail.
normalAtStart :: (InSpace V2 n t, EndValues (Tangent t), Floating n) => t -> V2 n

-- | Compute the normal vector at the end of a segment or trail.
normalAtEnd :: (InSpace V2 n t, EndValues (Tangent t), Floating n) => t -> V2 n

-- | A newtype wrapper used to give different instances of
--   Parametric and EndValues that compute tangent vectors.
newtype Tangent t
Tangent :: t -> Tangent t
instance Diagrams.Parametric.DomainBounds t => Diagrams.Parametric.DomainBounds (Diagrams.Tangent.Tangent t)
instance Diagrams.Parametric.Parametric (Diagrams.Tangent.Tangent t) => Diagrams.Parametric.Parametric (Diagrams.Tangent.Tangent (Diagrams.Located.Located t))
instance (Diagrams.Parametric.DomainBounds t, Diagrams.Parametric.EndValues (Diagrams.Tangent.Tangent t)) => Diagrams.Parametric.EndValues (Diagrams.Tangent.Tangent (Diagrams.Located.Located t))
instance (Linear.Vector.Additive v, GHC.Num.Num n) => Diagrams.Parametric.Parametric (Diagrams.Tangent.Tangent (Diagrams.Segment.Segment Diagrams.Segment.Closed v n))
instance (Linear.Vector.Additive v, GHC.Num.Num n) => Diagrams.Parametric.EndValues (Diagrams.Tangent.Tangent (Diagrams.Segment.Segment Diagrams.Segment.Closed v n))
instance (Linear.Vector.Additive v, GHC.Num.Num n) => Diagrams.Parametric.Parametric (Diagrams.Tangent.Tangent (Diagrams.Segment.FixedSegment v n))
instance (Linear.Vector.Additive v, GHC.Num.Num n) => Diagrams.Parametric.EndValues (Diagrams.Tangent.Tangent (Diagrams.Segment.FixedSegment v n))

-- | Compute curvature for segments in two dimensions.
module Diagrams.TwoD.Curvature

-- | Curvature measures how curved the segment is at a point. One intuition
--   for the concept is how much you would turn the wheel when driving a
--   car along the curve. When the wheel is held straight there is zero
--   curvature. When turning a corner to the left we will have positive
--   curvature. When turning to the right we will have negative curvature.
--   
--   Another way to measure this idea is to find the largest circle that we
--   can push up against the curve and have it touch (locally) at exactly
--   the point and not cross the curve. This is a tangent circle. The
--   radius of that circle is the "Radius of Curvature" and it is the
--   reciprocal of curvature. Note that if the circle is on the "left" of
--   the curve, we have a positive radius, and if it is to the right we
--   have a negative radius. Straight segments have an infinite radius
--   which leads us to our representation. We result in a pair of numerator
--   and denominator so we can include infinity and zero for both the
--   radius and the curvature.
--   
--   Lets consider the following curve:
--   
--   
--   The curve starts with positive curvature,
--   
--   
--   approaches zero curvature
--   
--   
--   then has negative curvature
--   
--   
--   
--   {-# LANGUAGE GADTs #-}
--   
--   import Diagrams.TwoD.Curvature
--   import Data.Monoid.Inf
--   import Diagrams.Coordinates
--   
--   segmentA :: Segment Closed V2 Double
--   segmentA = Cubic (12 ^& 0) (8 ^& 10) (OffsetClosed (20 ^& 8))
--   
--   curveA = lw thick . strokeP . fromSegments $ [segmentA]
--   
--   diagramA = pad 1.1 . centerXY $ curveA
--   
--   diagramPos = diagramWithRadius 0.2
--   
--   diagramZero = diagramWithRadius 0.45
--   
--   diagramNeg = diagramWithRadius 0.8
--   
--   diagramWithRadius t = pad 1.1 . centerXY
--            $ curveA
--           <> showCurvature segmentA t
--            # withEnvelope (curveA :: D V2 Double)
--            # lc red
--   
--   showCurvature :: Segment Closed V2 Double -> Double -> Diagram SVG
--   showCurvature bez@(Cubic b c (OffsetClosed d)) t
--     | v == (0,0) = mempty
--     | otherwise  = go (radiusOfCurvature bez t)
--     where
--       v@(x,y) = unr2 $ firstDerivative b c d t
--       vp = (-y) ^& x
--   
--       firstDerivative b c d t = let tt = t*t in (3*(3*tt-4*t+1))*^b + (3*(2-3*t)*t)*^c + (3*tt)*^d
--   
--       go Infinity   = mempty
--       go (Finite r) = (circle (abs r) # translate vpr
--                    <> strokeP (origin ~~ (origin .+^ vpr)))
--                     # moveTo (origin .+^ atParam bez t)
--         where
--           vpr = signorm vp ^* r
--   
curvature :: RealFloat n => Segment Closed V2 n -> n -> PosInf n

-- | Reciprocal of curvature.
radiusOfCurvature :: RealFloat n => Segment Closed V2 n -> n -> PosInf n

-- | With squaredCurvature we can compute values in spaces that do
--   not support sqrt and it is just as useful for relative ordering
--   of curvatures or looking for zeros.
squaredCurvature :: RealFloat n => Segment Closed V2 n -> n -> PosInf n

-- | Reciprocal of squaredCurvature
squaredRadiusOfCurvature :: RealFloat n => Segment Closed V2 n -> n -> PosInf n

-- | This module defines trails, translationally invariant paths
--   through space. Trails form a central part of the diagrams-lib API, so
--   the documentation for this module merits careful study.
--   
--   Related modules include:
--   
--   
--   
- The TrailLike class (Diagrams.TrailLike) exposes a
--   generic API for building a wide range of things out of trails.
--   
- Paths (Diagrams.Path) are collections of
--   Located (Diagrams.Located) trails.
--   
- Trails are composed of Segments (see
--   Diagrams.Segment), though most users should not need to work
--   with segments directly.
--   
module Diagrams.Trail

-- | Intuitively, a trail is a single, continuous path through space.
--   However, a trail has no fixed starting point; it merely specifies
--   how to move through space, not where. For example, "take
--   three steps forward, then turn right twenty degrees and take two more
--   steps" is an intuitive analog of a trail; these instructions specify a
--   path through space from any given starting location. To be precise,
--   trails are translation-invariant; applying a translation to a
--   trail has no effect.
--   
--   A Located Trail, on the other hand, is a trail paired
--   with some concrete starting location ("start at the big tree on the
--   corner, then take three steps forward, ..."). See the
--   Diagrams.Located module for help working with Located
--   values.
--   
--   Formally, the semantics of a trail is a continuous (though not
--   necessarily differentiable) function from the real interval [0,1] to
--   vectors in some vector space. (In contrast, a Located trail is
--   a continuous function from [0,1] to points in some
--   affine space.)
--   
--   There are two types of trails:
--   
--   
--   
- A "line" (think of the "train", "subway", or "bus" variety, rather
--   than the "straight" variety...) is a trail with two distinct
--   endpoints. Actually, a line can have the same start and end points,
--   but it is still drawn as if it had distinct endpoints: the two
--   endpoints will have the appropriate end caps, and the trail will not
--   be filled. Lines have a Monoid instance where
--   mappend corresponds to concatenation, i.e. chaining
--   one line after the other.
--   
- A "loop" is required to end in the same place it starts (that is,
--   t(0) = t(1)). Loops are filled and are drawn as one continuous loop,
--   with the appropriate join at the start/endpoint rather than end caps.
--   Loops do not have a Monoid instance.
--   
--   
--   To convert between lines and loops, see glueLine,
--   closeLine, and cutLoop.
--   
--   To construct trails, see emptyTrail, trailFromSegments,
--   trailFromVertices, trailFromOffsets, and friends. You
--   can also get any type of trail from any function which returns a
--   TrailLike (e.g. functions in
--   Diagrams.TwoD.Shapes, and many others; see
--   Diagrams.TrailLike).
--   
--   To extract information from trails, see withLine,
--   isLoop, trailSegments, trailOffsets,
--   trailVertices, and friends.
data Trail' l v n
[Line] :: SegTree v n -> Trail' Line v n
[Loop] :: SegTree v n -> Segment Open v n -> Trail' Loop v n

-- | Make a line into a loop by "gluing" the endpoint to the starting
--   point. In particular, the offset of the final segment is modified so
--   that it ends at the starting point of the entire trail. Typically, you
--   would first construct a line which you know happens to end where it
--   starts, and then call glueLine to turn it into a loop.
--   
--   
--   
--   glueLineEx = pad 1.1 . hsep 1
--     $ [almostClosed # strokeLine, almostClosed # glueLine # strokeLoop]
--   
--   almostClosed :: Trail' Line V2 Double
--   almostClosed = fromOffsets $ map r2 [(2, -1), (-3, -0.5), (-2, 1), (1, 0.5)]
--   
--   
--   glueLine is left inverse to cutLoop, that is,
--   
--   
--   glueLine . cutLoop === id
--   
--   
glueLine :: (Metric v, OrderedField n) => Trail' Line v n -> Trail' Loop v n

-- | Make a line into a loop by adding a new linear segment from the line's
--   end to its start.
--   
--   closeLine does not have any particularly nice theoretical
--   properties, but can be useful e.g. when you want to make a
--   closed polygon out of a list of points where the initial point is not
--   repeated at the end. To use glueLine, one would first have to
--   duplicate the initial vertex, like
--   
--   
--   glueLine . lineFromVertices $ ps ++ [head ps]
--   
--   
--   Using closeLine, however, one can simply
--   
--   
--   closeLine . lineFromVertices $ ps
--   
--   
--   
--   
--   closeLineEx = pad 1.1 . centerXY . hcat' (with & sep .~ 1)
--     $ [almostClosed # strokeLine, almostClosed # closeLine # strokeLoop]
--   
closeLine :: Trail' Line v n -> Trail' Loop v n

-- | Turn a loop into a line by "cutting" it at the common start/end point,
--   resulting in a line which just happens to start and end at the same
--   place.
--   
--   cutLoop is right inverse to glueLine, that is,
--   
--   
--   glueLine . cutLoop === id
--   
--   
cutLoop :: forall v n. (Metric v, OrderedField n) => Trail' Loop v n -> Trail' Line v n

-- | Trail is a wrapper around Trail', hiding whether the
--   underlying Trail' is a line or loop (though which it is can
--   be recovered; see e.g. withTrail).
data Trail v n
[Trail] :: Trail' l v n -> Trail v n

-- | Prism onto a Line.
_Line :: Prism' (Trail v n) (Trail' Line v n)

-- | Prism onto a Loop.
_Loop :: Prism' (Trail v n) (Trail' Loop v n)

-- | Prism onto a Located Line.
_LocLine :: Prism' (Located (Trail v n)) (Located (Trail' Line v n))

-- | Prism onto a Located Loop.
_LocLoop :: Prism' (Located (Trail v n)) (Located (Trail' Loop v n))

-- | Convert a Trail' into a Trail, hiding the type-level
--   distinction between lines and loops.
wrapTrail :: Trail' l v n -> Trail v n

-- | Convert a line into a Trail. This is the same as
--   wrapTrail, but with a more specific type, which can
--   occasionally be convenient for fixing the type of a polymorphic
--   expression.
wrapLine :: Trail' Line v n -> Trail v n

-- | Convert a loop into a Trail. This is the same as
--   wrapTrail, but with a more specific type, which can
--   occasionally be convenient for fixing the type of a polymorphic
--   expression.
wrapLoop :: Trail' Loop v n -> Trail v n

-- | Modify a Trail, specifying two separate transformations for
--   the cases of a line or a loop.
onTrail :: (Trail' Line v n -> Trail' l1 v n) -> (Trail' Loop v n -> Trail' l2 v n) -> Trail v n -> Trail v n

-- | Modify a Trail by specifying a transformation on lines. If
--   the trail is a line, the transformation will be applied directly. If
--   it is a loop, it will first be cut using cutLoop, the
--   transformation applied, and then glued back into a loop with
--   glueLine. That is,
--   
--   
--   onLine f === onTrail f (glueLine . f . cutLoop)
--   
--   
--   
--   Note that there is no corresponding onLoop function, because
--   there is no nice way in general to convert a line into a loop, operate
--   on it, and then convert back.
onLine :: (Metric v, OrderedField n) => (Trail' Line v n -> Trail' Line v n) -> Trail v n -> Trail v n

-- | glueTrail is a variant of glueLine which works on
--   Trails. It performs glueLine on lines and is the
--   identity on loops.
glueTrail :: (Metric v, OrderedField n) => Trail v n -> Trail v n

-- | closeTrail is a variant of closeLine for Trail,
--   which performs closeLine on lines and is the identity on loops.
closeTrail :: Trail v n -> Trail v n

-- | cutTrail is a variant of cutLoop for Trail; it
--   is the is the identity on lines and performs cutLoop on loops.
cutTrail :: (Metric v, OrderedField n) => Trail v n -> Trail v n

-- | The empty line, which is the identity for concatenation of lines.
emptyLine :: (Metric v, OrderedField n) => Trail' Line v n

-- | A wrapped variant of emptyLine.
emptyTrail :: (Metric v, OrderedField n) => Trail v n

-- | Construct a line containing only linear segments from a list of
--   vertices. Note that only the relative offsets between the vertices
--   matters; the information about their absolute position will be
--   discarded. That is, for all vectors v,
--   
--   
--   lineFromVertices === lineFromVertices . translate v
--   
--   
--   If you want to retain the position information, you should instead use
--   the more general fromVertices function to construct, say, a
--   Located (Trail' Line v) or a
--   Located (Trail v).
--   
--   
--   
--   import Diagrams.Coordinates
--   lineFromVerticesEx = pad 1.1 . centerXY . strokeLine
--     $ lineFromVertices [origin, 0 ^& 1, 1 ^& 2, 5 ^& 1]
--   
lineFromVertices :: (Metric v, OrderedField n) => [Point v n] -> Trail' Line v n

-- | trailFromVertices === wrapTrail .
--   lineFromVertices, for conveniently constructing a
--   Trail instead of a Trail' Line.
trailFromVertices :: (Metric v, OrderedField n) => [Point v n] -> Trail v n

-- | Construct a line containing only linear segments from a list of
--   vectors, where each vector represents the offset from one vertex to
--   the next. See also fromOffsets.
--   
--   
--   
--   import Diagrams.Coordinates
--   lineFromOffsetsEx = strokeLine $ lineFromOffsets [ 2 ^& 1, 2 ^& (-1), 2 ^& 0.5 ]
--   
lineFromOffsets :: (Metric v, OrderedField n) => [v n] -> Trail' Line v n

-- | trailFromOffsets === wrapTrail .
--   lineFromOffsets, for conveniently constructing a
--   Trail instead of a Trail' Line.
trailFromOffsets :: (Metric v, OrderedField n) => [v n] -> Trail v n

-- | Construct a line from a list of closed segments.
lineFromSegments :: (Metric v, OrderedField n) => [Segment Closed v n] -> Trail' Line v n

-- | trailFromSegments === wrapTrail .
--   lineFromSegments, for conveniently constructing a
--   Trail instead of a Trail'.
trailFromSegments :: (Metric v, OrderedField n) => [Segment Closed v n] -> Trail v n

-- | Construct a loop from a list of closed segments and an open segment
--   that completes the loop.
loopFromSegments :: (Metric v, OrderedField n) => [Segment Closed v n] -> Segment Open v n -> Trail' Loop v n

-- | A generic eliminator for Trail', taking functions specifying
--   what to do in the case of a line or a loop.
withTrail' :: (Trail' Line v n -> r) -> (Trail' Loop v n -> r) -> Trail' l v n -> r

-- | A generic eliminator for Trail, taking functions specifying
--   what to do in the case of a line or a loop.
withTrail :: (Trail' Line v n -> r) -> (Trail' Loop v n -> r) -> Trail v n -> r

-- | An eliminator for Trail based on eliminating lines: if the
--   trail is a line, the given function is applied; if it is a loop, it is
--   first converted to a line with cutLoop. That is,
--   
--   
--   withLine f === withTrail f (f . cutLoop)
--   
withLine :: (Metric v, OrderedField n) => (Trail' Line v n -> r) -> Trail v n -> r

-- | Test whether a line is empty.
isLineEmpty :: (Metric v, OrderedField n) => Trail' Line v n -> Bool

-- | Test whether a trail is empty. Note that loops are never empty.
isTrailEmpty :: (Metric v, OrderedField n) => Trail v n -> Bool

-- | Determine whether a trail is a line.
isLine :: Trail v n -> Bool

-- | Determine whether a trail is a loop.
isLoop :: Trail v n -> Bool

-- | Extract the segments of a trail. If the trail is a loop it will first
--   have cutLoop applied.
trailSegments :: (Metric v, OrderedField n) => Trail v n -> [Segment Closed v n]

-- | Extract the segments comprising a line.
lineSegments :: Trail' Line v n -> [Segment Closed v n]

-- | Extract the segments comprising a loop: a list of closed segments, and
--   one final open segment.
loopSegments :: Trail' Loop v n -> ([Segment Closed v n], Segment Open v n)

-- | Modify a line by applying a function to its list of segments.
onLineSegments :: (Metric v, OrderedField n) => ([Segment Closed v n] -> [Segment Closed v n]) -> Trail' Line v n -> Trail' Line v n

-- | Extract the offsets of the segments of a trail.
trailOffsets :: (Metric v, OrderedField n) => Trail v n -> [v n]

-- | Compute the offset from the start of a trail to the end. Satisfies
--   
--   
--   trailOffset === sumV . trailOffsets
--   
--   
--   
--   but is more efficient.
--   
--   
--   
--   trailOffsetEx = (strokeLine almostClosed <> showOffset) # centerXY # pad 1.1
--     where showOffset = fromOffsets [trailOffset (wrapLine almostClosed)]
--                      # strokeP # lc red
--   
trailOffset :: (Metric v, OrderedField n) => Trail v n -> v n

-- | Extract the offsets of the segments of a line.
lineOffsets :: Trail' Line v n -> [v n]

-- | Compute the offset from the start of a line to the end. (Note, there
--   is no corresponding loopOffset function because by definition
--   it would be constantly zero.)
lineOffset :: (Metric v, OrderedField n) => Trail' Line v n -> v n

-- | Extract the offsets of the segments of a loop.
loopOffsets :: (Metric v, OrderedField n) => Trail' Loop v n -> [v n]

-- | Extract the points of a concretely located trail, i.e. the
--   points where one segment ends and the next begins. Note that for
--   loops, the starting point will not be repeated at the end. If
--   you want this behavior, you can use cutTrail to make the loop
--   into a line first, which happens to repeat the same point at the start
--   and end, e.g. with trailPoints . mapLoc cutTrail.
--   
--   Note that it does not make sense to ask for the points of a
--   Trail by itself; if you want the points of a trail with the
--   first point at, say, the origin, you can use trailPoints . (`at`
--   origin).
--   
--   This function allows you "observe" the fact that trails are
--   implemented as lists of segments, which may be problematic if we want
--   to think of trails as parametric vector functions. This also means
--   that the behavior of this function may not be stable under future
--   changes to the implementation of trails. For an unproblematic version
--   which only yields vertices at which there is a sharp corner, excluding
--   points where the trail is differentiable, see trailVertices.
--   
--   This function is not re-exported from Diagrams.Prelude; to use
--   it, import Diagrams.Trail.
trailPoints :: (Metric v, OrderedField n) => Located (Trail v n) -> [Point v n]

-- | Extract the segment join points of a concretely located line. See
--   trailPoints for more information.
--   
--   This function allows you "observe" the fact that lines are implemented
--   as lists of segments, which may be problematic if we want to think of
--   lines as parametric vector functions. This also means that the
--   behavior of this function may not be stable under future changes to
--   the implementation of trails. For an unproblematic version which only
--   yields vertices at which there is a sharp corner, excluding points
--   where the trail is differentiable, see lineVertices.
--   
--   This function is not re-exported from Diagrams.Prelude; to use
--   it, import Diagrams.Trail.
linePoints :: (Metric v, OrderedField n) => Located (Trail' Line v n) -> [Point v n]

-- | Extract the segment join points of a concretely located loop. Note
--   that the initial vertex is not repeated at the end. See
--   trailPoints for more information.
--   
--   This function allows you "observe" the fact that lines are implemented
--   as lists of segments, which may be problematic if we want to think of
--   lines as parametric vector functions. This also means that the
--   behavior of this function may not be stable under future changes to
--   the implementation of trails. For an unproblematic version which only
--   yields vertices at which there is a sharp corner, excluding points
--   where the trail is differentiable, see lineVertices.
--   
--   This function is not re-exported from Diagrams.Prelude; to use
--   it, import Diagrams.Trail.
loopPoints :: (Metric v, OrderedField n) => Located (Trail' Loop v n) -> [Point v n]

-- | Extract the vertices of a concretely located trail. Here a
--   vertex is defined as a non-differentiable point on the trail,
--   i.e. a sharp corner. (Vertices are thus a subset of the places
--   where segments join; if you want all joins between segments, see
--   trailPoints.) The tolerance determines how close the tangents
--   of two segments must be at their endpoints to consider the transition
--   point to be differentiable.
--   
--   Note that for loops, the starting vertex will not be repeated
--   at the end. If you want this behavior, you can use cutTrail to
--   make the loop into a line first, which happens to repeat the same
--   vertex at the start and end, e.g. with trailVertices .
--   mapLoc cutTrail.
--   
--   It does not make sense to ask for the vertices of a Trail by
--   itself; if you want the vertices of a trail with the first vertex at,
--   say, the origin, you can use trailVertices . (`at` origin).
trailVertices' :: (Metric v, OrderedField n) => n -> Located (Trail v n) -> [Point v n]

-- | Extract the vertices of a concretely located line. See
--   trailVertices for more information.
lineVertices' :: (Metric v, OrderedField n) => n -> Located (Trail' Line v n) -> [Point v n]

-- | Extract the vertices of a concretely located loop. Note that the
--   initial vertex is not repeated at the end. See trailVertices
--   for more information.
loopVertices' :: (Metric v, OrderedField n) => n -> Located (Trail' Loop v n) -> [Point v n]

-- | Like trailVertices', with a default tolerance.
trailVertices :: (Metric v, OrderedField n) => Located (Trail v n) -> [Point v n]

-- | Like lineVertices', with a default tolerance.
lineVertices :: (Metric v, OrderedField n) => Located (Trail' Line v n) -> [Point v n]

-- | Same as loopVertices', with a default tolerance.
loopVertices :: (Metric v, OrderedField n) => Located (Trail' Loop v n) -> [Point v n]

-- | Convert a concretely located trail into a list of located segments.
trailLocSegments :: (Metric v, OrderedField n) => Located (Trail v n) -> [Located (Segment Closed v n)]

-- | Convert a concretely located trail into a list of fixed segments.
--   unfixTrail is almost its left inverse.
fixTrail :: (Metric v, OrderedField n) => Located (Trail v n) -> [FixedSegment v n]

-- | Convert a list of fixed segments into a located trail. Note that this
--   may lose information: it throws away the locations of all but the
--   first FixedSegment. This does not matter precisely when each
--   FixedSegment begins where the previous one ends.
--   
--   This is almost left inverse to fixTrail, that is,
--   unfixTrail . fixTrail == id, except for the fact that
--   unfixTrail will never yield a Loop. In the case of a
--   loop, we instead have glueTrail . unfixTrail . fixTrail ==
--   id. On the other hand, it is not the case that fixTrail .
--   unfixTrail == id since unfixTrail may lose information.
unfixTrail :: (Metric v, Ord n, Floating n) => [FixedSegment v n] -> Located (Trail v n)

-- | Reverse a trail. Semantically, if a trail given by a function t from
--   [0,1] to vectors, then the reverse of t is given by t'(s) = t(1-s).
--   reverseTrail is an involution, that is,
--   
--   
--   reverseTrail . reverseTrail === id
--   
--   
reverseTrail :: (Metric v, OrderedField n) => Trail v n -> Trail v n

-- | Reverse a concretely located trail. The endpoint of the original trail
--   becomes the starting point of the reversed trail, so the original and
--   reversed trails comprise exactly the same set of points.
--   reverseLocTrail is an involution, i.e.
--   
--   
--   reverseLocTrail . reverseLocTrail === id
--   
--   
reverseLocTrail :: (Metric v, OrderedField n) => Located (Trail v n) -> Located (Trail v n)

-- | Reverse a line. See reverseTrail.
reverseLine :: (Metric v, OrderedField n) => Trail' Line v n -> Trail' Line v n

-- | Reverse a concretely located line. See reverseLocTrail.
reverseLocLine :: (Metric v, OrderedField n) => Located (Trail' Line v n) -> Located (Trail' Line v n)

-- | Reverse a loop. See reverseTrail.
reverseLoop :: (Metric v, OrderedField n) => Trail' Loop v n -> Trail' Loop v n

-- | Reverse a concretely located loop. See reverseLocTrail. Note
--   that this is guaranteed to preserve the location.
reverseLocLoop :: (Metric v, OrderedField n) => Located (Trail' Loop v n) -> Located (Trail' Loop v n)

-- | Type tag for trails with distinct endpoints.
data Line

-- | Type tag for "loopy" trails which return to their starting point.
data Loop

-- | A SegTree represents a sequence of closed segments, stored in
--   a fingertree so we can easily recover various monoidal measures of the
--   segments (number of segments, arc length, envelope...) and also easily
--   slice and dice them according to the measures (e.g., split off
--   the smallest number of segments from the beginning which have a
--   combined arc length of at least 5).
newtype SegTree v n
SegTree :: FingerTree (SegMeasure v n) (Segment Closed v n) -> SegTree v n

-- | Given a default result (to be used in the case of an empty trail), and
--   a function to map a single measure to a result, extract the given
--   measure for a trail and use it to compute a result. Put another way,
--   lift a function on a single measure (along with a default value) to a
--   function on an entire trail.
trailMeasure :: (SegMeasure v n :>: m, Measured (SegMeasure v n) t) => a -> (m -> a) -> t -> a

-- | Compute the number of segments of anything measured by
--   SegMeasure (e.g. SegMeasure itself,
--   Segment, SegTree, Trails...)
numSegs :: (Num c, Measured (SegMeasure v n) a) => a -> c

-- | Compute the total offset of anything measured by SegMeasure.
offset :: (OrderedField n, Metric v, Measured (SegMeasure v n) t) => t -> v n

-- | A newtype wrapper around trails which exists solely for its
--   Parametric, DomainBounds and EndValues instances.
--   The idea is that if tr is a trail, you can write, e.g.
--   
--   
--   getSegment tr atParam 0.6
--   
--   
--   
--   or
--   
--   
--   atStart (getSegment tr)
--   
--   
--   
--   to get the segment at parameter 0.6 or the first segment in the trail,
--   respectively.
--   
--   The codomain for GetSegment, i.e. the result you get
--   from calling atParam, atStart, or atEnd, is
--   GetSegmentCodomain, which is a newtype wrapper around Maybe
--   (v, Segment Closed v, AnIso' n n). Nothing results if
--   the trail is empty; otherwise, you get:
--   
--   
--   
- the offset from the start of the trail to the beginning of the
--   segment,
--   
- the segment itself, and
--   
- a reparameterization isomorphism: in the forward direction, it
--   translates from parameters on the whole trail to a parameters on the
--   segment. Note that for technical reasons you have to call
--   cloneIso on the AnIso' value to get a real isomorphism
--   you can use.
--   
newtype GetSegment t
GetSegment :: t -> GetSegment t

-- | Create a GetSegment wrapper around a trail, after which you can
--   call atParam, atStart, or atEnd to extract a
--   segment.
getSegment :: t -> GetSegment t
newtype GetSegmentCodomain v n
GetSegmentCodomain :: Maybe (v n, Segment Closed v n, AnIso' n n) -> GetSegmentCodomain v n
instance (GHC.Classes.Ord n, Linear.Metric.Metric v, GHC.Float.Floating n) => Data.FingerTree.Measured (Diagrams.Segment.SegMeasure v n) (Diagrams.Trail.SegTree v n)
instance (GHC.Float.Floating n, GHC.Classes.Ord n, Linear.Metric.Metric v) => Diagrams.Core.Transform.Transformable (Diagrams.Trail.SegTree v n)
instance (GHC.Classes.Ord n, GHC.Float.Floating n, Linear.Metric.Metric v) => GHC.Base.Monoid (Diagrams.Trail.SegTree v n)
instance GHC.Show.Show (v n) => GHC.Show.Show (Diagrams.Trail.SegTree v n)
instance GHC.Classes.Ord (v n) => GHC.Classes.Ord (Diagrams.Trail.SegTree v n)
instance GHC.Classes.Eq (v n) => GHC.Classes.Eq (Diagrams.Trail.SegTree v n)
instance (GHC.Classes.Ord n, GHC.Float.Floating n, Linear.Metric.Metric v) => GHC.Base.Semigroup (Diagrams.Trail.SegTree v n)
instance GHC.Classes.Eq (v n) => GHC.Classes.Eq (Diagrams.Trail.Trail' l v n)
instance GHC.Classes.Ord (v n) => GHC.Classes.Ord (Diagrams.Trail.Trail' l v n)
instance GHC.Show.Show (v n) => GHC.Show.Show (Diagrams.Trail.Trail v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, GHC.Real.Real n) => Diagrams.Parametric.Parametric (Diagrams.Tangent.Tangent (Diagrams.Trail.Trail v n))
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, GHC.Real.Real n) => Diagrams.Parametric.EndValues (Diagrams.Tangent.Tangent (Diagrams.Trail.Trail v n))
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, GHC.Real.Real n) => Diagrams.Parametric.Parametric (Diagrams.Trail.GetSegment (Diagrams.Trail.Trail v n))
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, GHC.Real.Real n) => Diagrams.Parametric.EndValues (Diagrams.Trail.GetSegment (Diagrams.Trail.Trail v n))
instance GHC.Classes.Eq (v n) => GHC.Classes.Eq (Diagrams.Trail.Trail v n)
instance GHC.Classes.Ord (v n) => GHC.Classes.Ord (Diagrams.Trail.Trail v n)
instance (Diagrams.Core.Envelope.OrderedField n, Linear.Metric.Metric v) => GHC.Base.Semigroup (Diagrams.Trail.Trail v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => GHC.Base.Monoid (Diagrams.Trail.Trail v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Control.Lens.Empty.AsEmpty (Diagrams.Trail.Trail v n)
instance (Diagrams.Core.Transform.HasLinearMap v, Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.Core.Transform.Transformable (Diagrams.Trail.Trail v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.Core.Envelope.Enveloped (Diagrams.Trail.Trail v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, GHC.Real.Real n) => Diagrams.Parametric.Parametric (Diagrams.Trail.Trail v n)
instance GHC.Num.Num n => Diagrams.Parametric.DomainBounds (Diagrams.Trail.Trail v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, GHC.Real.Real n) => Diagrams.Parametric.EndValues (Diagrams.Trail.Trail v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, GHC.Real.Real n) => Diagrams.Parametric.Sectionable (Diagrams.Trail.Trail v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, GHC.Real.Real n) => Diagrams.Parametric.HasArcLength (Diagrams.Trail.Trail v n)
instance Control.Lens.Wrapped.Rewrapped (Diagrams.Trail.Trail v n) (Diagrams.Trail.Trail v' n')
instance Control.Lens.Wrapped.Wrapped (Diagrams.Trail.Trail v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Control.Lens.Internal.Iso.Reversing (Diagrams.Trail.Trail v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Control.Lens.Internal.Iso.Reversing (Diagrams.Located.Located (Diagrams.Trail.Trail v n))
instance (Data.Serialize.Serialize (v n), Diagrams.Core.Envelope.OrderedField n, Linear.Metric.Metric v) => Data.Serialize.Serialize (Diagrams.Trail.Trail v n)
instance (Diagrams.Parametric.Parametric (Diagrams.Trail.GetSegment (Diagrams.Trail.Trail' c v n)), Linear.Vector.Additive v, GHC.Num.Num n) => Diagrams.Parametric.Parametric (Diagrams.Tangent.Tangent (Diagrams.Trail.Trail' c v n))
instance (Diagrams.Parametric.Parametric (Diagrams.Trail.GetSegment (Diagrams.Trail.Trail' c v n)), Diagrams.Parametric.EndValues (Diagrams.Trail.GetSegment (Diagrams.Trail.Trail' c v n)), Linear.Vector.Additive v, GHC.Num.Num n) => Diagrams.Parametric.EndValues (Diagrams.Tangent.Tangent (Diagrams.Trail.Trail' c v n))
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.Parametric.Parametric (Diagrams.Trail.GetSegment (Diagrams.Trail.Trail' Diagrams.Trail.Line v n))
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.Parametric.EndValues (Diagrams.Trail.GetSegment (Diagrams.Trail.Trail' Diagrams.Trail.Line v n))
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, GHC.Real.Real n) => Diagrams.Parametric.Parametric (Diagrams.Trail.GetSegment (Diagrams.Trail.Trail' Diagrams.Trail.Loop v n))
instance Diagrams.Parametric.DomainBounds t => Diagrams.Parametric.DomainBounds (Diagrams.Trail.GetSegment t)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, GHC.Real.Real n) => Diagrams.Parametric.EndValues (Diagrams.Trail.GetSegment (Diagrams.Trail.Trail' Diagrams.Trail.Loop v n))
instance GHC.Show.Show (v n) => GHC.Show.Show (Diagrams.Trail.Trail' l v n)
instance (Diagrams.Core.Envelope.OrderedField n, Linear.Metric.Metric v) => GHC.Base.Semigroup (Diagrams.Trail.Trail' Diagrams.Trail.Line v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => GHC.Base.Monoid (Diagrams.Trail.Trail' Diagrams.Trail.Line v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Control.Lens.Empty.AsEmpty (Diagrams.Trail.Trail' Diagrams.Trail.Line v n)
instance (Diagrams.Core.Transform.HasLinearMap v, Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.Core.Transform.Transformable (Diagrams.Trail.Trail' l v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.Core.Envelope.Enveloped (Diagrams.Trail.Trail' l v n)
instance (Diagrams.Core.Transform.HasLinearMap v, Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.Core.Types.Renderable (Diagrams.Trail.Trail' o v n) Diagrams.Core.Types.NullBackend
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, GHC.Real.Real n) => Diagrams.Parametric.Parametric (Diagrams.Trail.Trail' l v n)
instance GHC.Num.Num n => Diagrams.Parametric.DomainBounds (Diagrams.Trail.Trail' l v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, GHC.Real.Real n) => Diagrams.Parametric.EndValues (Diagrams.Trail.Trail' l v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, GHC.Real.Real n) => Diagrams.Parametric.Sectionable (Diagrams.Trail.Trail' Diagrams.Trail.Line v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, GHC.Real.Real n) => Diagrams.Parametric.HasArcLength (Diagrams.Trail.Trail' l v n)
instance Control.Lens.Wrapped.Rewrapped (Diagrams.Trail.Trail' Diagrams.Trail.Line v n) (Diagrams.Trail.Trail' Diagrams.Trail.Line v' n')
instance Control.Lens.Wrapped.Wrapped (Diagrams.Trail.Trail' Diagrams.Trail.Line v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, Linear.Metric.Metric u, Diagrams.Core.Envelope.OrderedField n') => Control.Lens.Cons.Cons (Diagrams.Trail.Trail' Diagrams.Trail.Line v n) (Diagrams.Trail.Trail' Diagrams.Trail.Line u n') (Diagrams.Segment.Segment Diagrams.Segment.Closed v n) (Diagrams.Segment.Segment Diagrams.Segment.Closed u n')
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, Linear.Metric.Metric u, Diagrams.Core.Envelope.OrderedField n') => Control.Lens.Cons.Snoc (Diagrams.Trail.Trail' Diagrams.Trail.Line v n) (Diagrams.Trail.Trail' Diagrams.Trail.Line u n') (Diagrams.Segment.Segment Diagrams.Segment.Closed v n) (Diagrams.Segment.Segment Diagrams.Segment.Closed u n')
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Control.Lens.Internal.Iso.Reversing (Diagrams.Trail.Trail' l v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Control.Lens.Internal.Iso.Reversing (Diagrams.Located.Located (Diagrams.Trail.Trail' l v n))
instance Control.Lens.Wrapped.Wrapped (Diagrams.Trail.SegTree v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, Linear.Metric.Metric u, Diagrams.Core.Envelope.OrderedField n') => Control.Lens.Cons.Cons (Diagrams.Trail.SegTree v n) (Diagrams.Trail.SegTree u n') (Diagrams.Segment.Segment Diagrams.Segment.Closed v n) (Diagrams.Segment.Segment Diagrams.Segment.Closed u n')
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, Linear.Metric.Metric u, Diagrams.Core.Envelope.OrderedField n') => Control.Lens.Cons.Snoc (Diagrams.Trail.SegTree v n) (Diagrams.Trail.SegTree u n') (Diagrams.Segment.Segment Diagrams.Segment.Closed v n) (Diagrams.Segment.Segment Diagrams.Segment.Closed u n')
instance Control.Lens.Wrapped.Rewrapped (Diagrams.Trail.SegTree v n) (Diagrams.Trail.SegTree v' n')
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, GHC.Real.Real n) => Diagrams.Parametric.Parametric (Diagrams.Trail.SegTree v n)
instance GHC.Num.Num n => Diagrams.Parametric.DomainBounds (Diagrams.Trail.SegTree v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, GHC.Real.Real n) => Diagrams.Parametric.EndValues (Diagrams.Trail.SegTree v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, GHC.Real.Real n) => Diagrams.Parametric.Sectionable (Diagrams.Trail.SegTree v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n, GHC.Real.Real n) => Diagrams.Parametric.HasArcLength (Diagrams.Trail.SegTree v n)
instance (Diagrams.Core.Envelope.OrderedField n, Linear.Metric.Metric v, Data.Serialize.Serialize (v n)) => Data.Serialize.Serialize (Diagrams.Trail.SegTree v n)
instance (Data.FingerTree.Measured m a, Diagrams.Core.Transform.Transformable a) => Diagrams.Core.Transform.Transformable (Data.FingerTree.FingerTree m a)
instance (Data.FingerTree.Measured m a, Data.FingerTree.Measured n b) => Control.Lens.Cons.Cons (Data.FingerTree.FingerTree m a) (Data.FingerTree.FingerTree n b) a b
instance (Data.FingerTree.Measured m a, Data.FingerTree.Measured n b) => Control.Lens.Cons.Snoc (Data.FingerTree.FingerTree m a) (Data.FingerTree.FingerTree n b) a b

-- | The TrailLike class abstracts over anything which can be
--   constructed from a concretely located Trail, including lines,
--   loops, trails, paths, vertex lists, and diagrams.
module Diagrams.TrailLike

-- | A type class for trail-like things, i.e. things which can be
--   constructed from a concretely located Trail. Instances include
--   lines, loops, trails, paths, lists of vertices, two-dimensional
--   Diagrams, and Located variants of all the above.
--   
--   Usually, type variables with TrailLike constraints are used as
--   the output types of functions, like
--   
--   
--   foo :: (TrailLike t) => ... -> t
--   
--   
--   
--   Functions with such a type can be used to construct trails, paths,
--   diagrams, lists of points, and so on, depending on the context.
--   
--   To write a function with a signature like the above, you can of course
--   call trailLike directly; more typically, one would use one of
--   the provided functions like fromOffsets, fromVertices,
--   fromSegments, or ~~.
class (Metric (V t), OrderedField (N t)) => TrailLike t
trailLike :: TrailLike t => Located (Trail (V t) (N t)) -> t

-- | Construct a trail-like thing from a list of segments, with the origin
--   as the location.
--   
--   
--   
--   fromSegmentsEx = fromSegments
--     [ straight (r2 (1,1))
--     , bézier3  (r2 (1,1)) unitX unit_Y
--     , straight unit_X
--     ]
--     # centerXY # pad 1.1
--   
fromSegments :: TrailLike t => [Segment Closed (V t) (N t)] -> t

-- | Construct a trail-like thing from a located list of segments.
fromLocSegments :: TrailLike t => Located [Segment Closed (V t) (N t)] -> t

-- | Construct a trail-like thing of linear segments from a list of
--   offsets, with the origin as the location.
--   
--   
--   
--   fromOffsetsEx = fromOffsets
--     [ unitX
--     , unitX # rotateBy (1/6)
--     , unitX # rotateBy (-1/6)
--     , unitX
--     ]
--     # centerXY # pad 1.1
--   
fromOffsets :: TrailLike t => [Vn t] -> t

-- | Construct a trail-like thing of linear segments from a located list of
--   offsets.
fromLocOffsets :: (V t ~ v, N t ~ n, V (v n) ~ v, N (v n) ~ n, TrailLike t) => Located [v n] -> t

-- | Construct a trail-like thing connecting the given vertices with linear
--   segments, with the first vertex as the location. If no vertices are
--   given, the empty trail is used with the origin as the location.
--   
--   
--   
--   import Data.List (transpose)
--   
--   fromVerticesEx =
--     ( [ pentagon 1
--       , pentagon 1.3 # rotateBy (1/15)
--       , pentagon 1.5 # rotateBy (2/15)
--       ]
--       # transpose
--       # concat
--     )
--     # fromVertices
--     # closeTrail # strokeTrail
--     # centerXY # pad 1.1
--   
fromVertices :: TrailLike t => [Point (V t) (N t)] -> t

-- | Create a linear trail between two given points.
--   
--   
--   
--   twiddleEx
--     = mconcat ((~~) <$> hexagon 1 <*> hexagon 1)
--     # centerXY # pad 1.1
--   
(~~) :: (V t ~ v, N t ~ n, TrailLike t) => Point v n -> Point v n -> t

-- | Given a concretely located trail, "explode" it by turning each segment
--   into its own separate trail. Useful for (say) applying a different
--   style to each segment.
--   
--   
--   
--   explodeTrailEx
--     = pentagon 1
--     # explodeTrail  -- generate a list of diagrams
--     # zipWith lc [orange, green, yellow, red, blue]
--     # mconcat # centerXY # pad 1.1
--   
explodeTrail :: (V t ~ v, N t ~ n, TrailLike t) => Located (Trail v n) -> [t]
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.TrailLike.TrailLike [Linear.Affine.Point v n]
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.TrailLike.TrailLike (Diagrams.Trail.Trail' Diagrams.Trail.Line v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.TrailLike.TrailLike (Diagrams.Trail.Trail' Diagrams.Trail.Loop v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.TrailLike.TrailLike (Diagrams.Trail.Trail v n)
instance Diagrams.TrailLike.TrailLike t => Diagrams.TrailLike.TrailLike (Diagrams.Core.Transform.TransInv t)
instance Diagrams.TrailLike.TrailLike t => Diagrams.TrailLike.TrailLike (Diagrams.Located.Located t)

-- | Two-dimensional arcs, approximated by cubic bezier curves.
module Diagrams.TwoD.Arc

-- | Given a start direction d and a sweep angle s,
--   arc d s is the path of a radius one arc starting at
--   d and sweeping out the angle s counterclockwise (for
--   positive s). The resulting Trail is allowed to wrap around
--   and overlap itself.
arc :: (InSpace V2 n t, OrderedField n, TrailLike t) => Direction V2 n -> Angle n -> t

-- | Given a radus r, a start direction d and an angle
--   s, arc' r d s is the path of a radius
--   (abs r) arc starting at d and sweeping out the angle
--   s counterclockwise (for positive s). The origin of the arc is
--   its center.
--   
--   
--   
--   arc'Ex = mconcat [ arc' r xDir (1/4 @@ turn) | r <- [0.5,-1,1.5] ]
--          # centerXY # pad 1.1
--   
arc' :: (InSpace V2 n t, OrderedField n, TrailLike t) => n -> Direction V2 n -> Angle n -> t

-- | Given a start direction d and a sweep angle s,
--   arcT d s is the Trail of a radius one arc
--   starting at d and sweeping out the angle s
--   counterclockwise (for positive s). The resulting Trail is
--   allowed to wrap around and overlap itself.
arcT :: OrderedField n => Direction V2 n -> Angle n -> Trail V2 n

-- | Given a start direction s and end direction e,
--   arcCCW s e is the path of a radius one arc counterclockwise
--   between the two directions. The origin of the arc is its center.
arcCCW :: (InSpace V2 n t, RealFloat n, TrailLike t) => Direction V2 n -> Direction V2 n -> t

-- | Like arcAngleCCW but clockwise.
arcCW :: (InSpace V2 n t, RealFloat n, TrailLike t) => Direction V2 n -> Direction V2 n -> t

-- | bezierFromSweep s constructs a series of Cubic
--   segments that start in the positive y direction and sweep counter
--   clockwise through the angle s. If s is negative, it
--   will start in the negative y direction and sweep clockwise. When
--   s is less than 0.0001 the empty list results. If the sweep is
--   greater than fullTurn later segments will overlap earlier
--   segments.
bezierFromSweep :: OrderedField n => Angle n -> [Segment Closed V2 n]

-- | Create a circular wedge of the given radius, beginning at the given
--   direction and extending through the given angle.
--   
--   
--   
--   wedgeEx = hcat' (with & sep .~ 0.5)
--     [ wedge 1 xDir (1/4 @@ turn)
--     , wedge 1 (rotate (7/30 @@ turn) xDir) (4/30 @@ turn)
--     , wedge 1 (rotate (1/8 @@ turn) xDir) (3/4 @@ turn)
--     ]
--     # fc blue
--     # centerXY # pad 1.1
--   
wedge :: (InSpace V2 n t, OrderedField n, TrailLike t) => n -> Direction V2 n -> Angle n -> t

-- | arcBetween p q height creates an arc beginning at p
--   and ending at q, with its midpoint at a distance of abs
--   height away from the straight line from p to q.
--   A positive value of height results in an arc to the left of
--   the line from p to q; a negative value yields one to
--   the right.
--   
--   
--   
--   arcBetweenEx = mconcat
--     [ arcBetween origin (p2 (2,1)) ht | ht <- [-0.2, -0.1 .. 0.2] ]
--     # centerXY # pad 1.1
--   
arcBetween :: (TrailLike t, V t ~ V2, N t ~ n, RealFloat n) => Point V2 n -> Point V2 n -> n -> t

-- | Create an annular wedge of the given radii, beginning at the first
--   direction and extending through the given sweep angle. The radius of
--   the outer circle is given first.
--   
--   
--   
--   annularWedgeEx = hsep 0.50
--     [ annularWedge 1 0.5 xDir (1/4 @@ turn)
--     , annularWedge 1 0.3 (rotate (7/30 @@ turn) xDir) (4/30 @@ turn)
--     , annularWedge 1 0.7 (rotate (1/8 @@ turn) xDir) (3/4 @@ turn)
--     ]
--     # fc blue
--     # centerXY # pad 1.1
--   
annularWedge :: (TrailLike t, V t ~ V2, N t ~ n, RealFloat n) => n -> n -> Direction V2 n -> Angle n -> t

-- | Two-dimensional ellipses (and, as a special case, circles).
module Diagrams.TwoD.Ellipse

-- | A circle of radius 1, with center at the origin.
unitCircle :: (TrailLike t, V t ~ V2, N t ~ n) => t

-- | A circle of the given radius, centered at the origin. As a path, it
--   begins at (r,0).
circle :: (TrailLike t, V t ~ V2, N t ~ n, Transformable t) => n -> t

-- | ellipse e constructs an ellipse with eccentricity e
--   by scaling the unit circle in the X direction. The eccentricity must
--   be within the interval [0,1).
ellipse :: (TrailLike t, V t ~ V2, N t ~ n, Transformable t) => n -> t

-- | ellipseXY x y creates an axis-aligned ellipse, centered at
--   the origin, with radius x along the x-axis and radius
--   y along the y-axis.
ellipseXY :: (TrailLike t, V t ~ V2, N t ~ n, Transformable t) => n -> n -> t

-- | A few utilities and class instances for Active (from the
--   active package). In particular, this module defines
--   
--   
--   
- An instance of V for Active: V
--   (Active a) = V a
--   
- HasOrigin, Transformable, and HasStyle
--   instances for Active which all work pointwise.
--   
- A TrailLike instance for Active p where
--   p is also TrailLike, which simply lifts a pathlike
--   thing to a constant active value.
--   
- A Juxtaposable instance for Active a where
--   a is also Juxtaposable. An active value can be
--   juxtaposed against another by doing the juxtaposition pointwise over
--   time. The era of juxtapose v a1 a2 will be the same as the
--   era of a2, unless a2 is constant, in which case it
--   will be the era of a1. (Note that juxtapose v a1 a2
--   and liftA2 (juxtapose v) a1 a2 therefore have different
--   semantics: the second is an active value whose era is the
--   combination of the eras of a1 and a2).
--   
- An Alignable instance for Active a where
--   a is also Alignable; the active value is aligned
--   pointwise over time.
--   
module Diagrams.Animation.Active
instance Diagrams.Core.HasOrigin.HasOrigin a => Diagrams.Core.HasOrigin.HasOrigin (Data.Active.Active a)
instance Diagrams.Core.Transform.Transformable a => Diagrams.Core.Transform.Transformable (Data.Active.Active a)
instance Diagrams.Core.Style.HasStyle a => Diagrams.Core.Style.HasStyle (Data.Active.Active a)
instance Diagrams.TrailLike.TrailLike t => Diagrams.TrailLike.TrailLike (Data.Active.Active t)
instance Diagrams.Core.Juxtapose.Juxtaposable a => Diagrams.Core.Juxtapose.Juxtaposable (Data.Active.Active a)

-- | Higher-level tools for combining diagrams.
module Diagrams.Combinators

-- | Use the envelope from some object as the envelope for a diagram, in
--   place of the diagram's default envelope.
--   
--   
--   
--   sqNewEnv =
--       circle 1 # fc green
--       |||
--       (    c # dashingG [0.1,0.1] 0 # lc white
--         <> square 2 # withEnvelope (c :: D V2 Double) # fc blue
--       )
--   c = circle 0.8
--   withEnvelopeEx = sqNewEnv # centerXY # pad 1.5
--   
withEnvelope :: (InSpace v n a, Monoid' m, Enveloped a) => a -> QDiagram b v n m -> QDiagram b v n m

-- | Use the trace from some object as the trace for a diagram, in place of
--   the diagram's default trace.
withTrace :: (InSpace v n a, Metric v, OrderedField n, Monoid' m, Traced a) => a -> QDiagram b v n m -> QDiagram b v n m

-- | phantom x produces a "phantom" diagram, which has the same
--   envelope and trace as x but produces no output.
phantom :: (InSpace v n a, Monoid' m, Enveloped a, Traced a) => a -> QDiagram b v n m

-- | strut v is a diagram which produces no output, but with
--   respect to alignment and envelope acts like a 1-dimensional segment
--   oriented along the vector v, with local origin at its center.
--   (Note, however, that it has an empty trace; for 2D struts with a
--   nonempty trace see strutR2 from
--   Diagrams.TwoD.Combinators.) Useful for manually creating
--   separation between two diagrams.
--   
--   
--   
--   strutEx = (circle 1 ||| strut unitX ||| circle 1) # centerXY # pad 1.1
--   
strut :: (Metric v, OrderedField n) => v n -> QDiagram b v n m

-- | pad s "pads" a diagram, expanding its envelope by a factor of
--   s (factors between 0 and 1 can be used to shrink the
--   envelope). Note that the envelope will expand with respect to the
--   local origin, so if the origin is not centered the padding may appear
--   "uneven". If this is not desired, the origin can be centered (using,
--   e.g., centerXY for 2D diagrams) before applying pad.
pad :: (Metric v, OrderedField n, Monoid' m) => n -> QDiagram b v n m -> QDiagram b v n m

-- | frame s increases the envelope of a diagram by and absolute
--   amount s, s is in the local units of the diagram. This
--   function is similar to pad, only it takes an absolute
--   quantity and pre-centering should not be necessary.
frame :: (Metric v, OrderedField n, Monoid' m) => n -> QDiagram b v n m -> QDiagram b v n m

-- | extrudeEnvelope v d asymmetrically "extrudes" the envelope of
--   a diagram in the given direction. All parts of the envelope within 90
--   degrees of this direction are modified, offset outwards by the
--   magnitude of the vector.
--   
--   This works by offsetting the envelope distance proportionally to the
--   cosine of the difference in angle, and leaving it unchanged when this
--   factor is negative.
extrudeEnvelope :: (Metric v, OrderedField n, Monoid' m) => v n -> QDiagram b v n m -> QDiagram b v n m

-- | intrudeEnvelope v d asymmetrically "intrudes" the envelope of
--   a diagram away from the given direction. All parts of the envelope
--   within 90 degrees of this direction are modified, offset inwards by
--   the magnitude of the vector.
--   
--   Note that this could create strange inverted envelopes, where 
--   diameter v d < 0 .
intrudeEnvelope :: (Metric v, OrderedField n, Monoid' m) => v n -> QDiagram b v n m -> QDiagram b v n m

-- | A convenient synonym for mappend on diagrams, designed to be
--   used infix (to help remember which diagram goes on top of which when
--   combining them, namely, the first on top of the second).
atop :: forall n (v :: Type -> Type) m b. (OrderedField n, Metric v, Semigroup m) => QDiagram b v n m -> QDiagram b v n m -> QDiagram b v n m
infixl 6 `atop`

-- | beneath is just a convenient synonym for flip
--   atop; that is, d1 `beneath` d2 is the diagram
--   with d2 superimposed on top of d1.
beneath :: (Metric v, OrderedField n, Monoid' m) => QDiagram b v n m -> QDiagram b v n m -> QDiagram b v n m
infixl 6 `beneath`

-- | Place two monoidal objects (i.e. diagrams, paths,
--   animations...) next to each other along the given vector. In
--   particular, place the second object so that the vector points from the
--   local origin of the first object to the local origin of the second
--   object, at a distance so that their envelopes are just tangent. The
--   local origin of the new, combined object is the local origin of the
--   first object (unless the first object is the identity element, in
--   which case the second object is returned unchanged).
--   
--   
--   
--   besideEx = beside (r2 (20,30))
--                     (circle 1 # fc orange)
--                     (circle 1.5 # fc purple)
--              # showOrigin
--              # centerXY # pad 1.1
--   
--   
--   Note that beside v is associative, so objects under
--   beside v form a semigroup for any given vector v. In
--   fact, they also form a monoid: mempty is clearly a right
--   identity (beside v d1 mempty === d1), and there should also
--   be a special case to make it a left identity, as described above.
--   
--   In older versions of diagrams, beside put the local origin of
--   the result at the point of tangency between the two inputs. That
--   semantics can easily be recovered by performing an alignment on the
--   first input before combining. That is, if beside' denotes the
--   old semantics,
--   
--   
--   beside' v x1 x2 = beside v (x1 # align v) x2
--   
--   
--   To get something like beside v x1 x2 whose local origin is
--   identified with that of x2 instead of x1, use
--   beside (negateV v) x2 x1.
beside :: (Juxtaposable a, Semigroup a) => Vn a -> a -> a -> a

-- | Place two diagrams (or other juxtaposable objects) adjacent to one
--   another, with the second diagram placed in the direction d
--   from the first. The local origin of the resulting combined diagram is
--   the same as the local origin of the first. See the documentation of
--   beside for more information.
atDirection :: (InSpace v n a, Metric v, Floating n, Juxtaposable a, Semigroup a) => Direction v n -> a -> a -> a

-- | appends x ys appends each of the objects in ys to
--   the object x in the corresponding direction. Note that each
--   object in ys is positioned beside x without
--   reference to the other objects in ys, so this is not the same
--   as iterating beside.
--   
--   
--   
--   appendsEx = appends c (zip (iterateN 6 (rotateBy (1/6)) unitX) (repeat c))
--               # centerXY # pad 1.1
--     where c = circle 1
--   
appends :: (Juxtaposable a, Monoid' a) => a -> [(Vn a, a)] -> a

-- | Position things absolutely: combine a list of objects (e.g. diagrams
--   or paths) by assigning them absolute positions in the vector space of
--   the combined object.
--   
--   
--   
--   positionEx = position (zip (map mkPoint [-3, -2.8 .. 3]) (repeat spot))
--     where spot      = circle 0.2 # fc black
--           mkPoint :: Double -> P2 Double
--           mkPoint x = p2 (x,x*x)
--   
position :: (InSpace v n a, HasOrigin a, Monoid' a) => [(Point v n, a)] -> a

-- | Curried version of position, takes a list of points and a
--   list of objects.
atPoints :: (InSpace v n a, HasOrigin a, Monoid' a) => [Point v n] -> [a] -> a

-- | cat v positions a list of objects so that their local origins
--   lie along a line in the direction of v. Successive objects
--   will have their envelopes just touching. The local origin of the
--   result will be the same as the local origin of the first object.
--   
--   See also cat', which takes an extra options record allowing
--   certain aspects of the operation to be tweaked.
cat :: (InSpace v n a, Metric v, Floating n, Juxtaposable a, Monoid' a, HasOrigin a) => v n -> [a] -> a

-- | Like cat, but taking an extra CatOpts arguments allowing
--   the user to specify
--   
--   
--   
- The spacing method: catenation (uniform spacing between envelopes)
--   or distribution (uniform spacing between local origins). The default
--   is catenation.
--   
- The amount of separation between successive diagram
--   envelopes/origins (depending on the spacing method). The default is
--   0.
--   
--   
--   CatOpts is an instance of Default, so with may be
--   used for the second argument, as in cat' (1,2) (with & sep .~
--   2).
--   
--   Note that cat' v (with & catMethod .~ Distrib) ===
--   mconcat (distributing with a separation of 0 is the same as
--   superimposing).
cat' :: (InSpace v n a, Metric v, Floating n, Juxtaposable a, Monoid' a, HasOrigin a) => v n -> CatOpts n -> [a] -> a

-- | Options for cat'.
data CatOpts n

-- | Which CatMethod should be used: normal catenation (default), or
--   distribution?
catMethod :: Lens' (CatOpts n) CatMethod

-- | How much separation should be used between successive diagrams
--   (default: 0)? When catMethod = Cat, this is the distance
--   between envelopes; when catMethod = Distrib, this is
--   the distance between origins.
sep :: Lens' (CatOpts n) n

-- | Methods for concatenating diagrams.
data CatMethod

-- | Normal catenation: simply put diagrams next to one another (possibly
--   with a certain distance in between each). The distance between
--   successive diagram envelopes will be consistent; the distance
--   between origins may vary if the diagrams are of different
--   sizes.
Cat :: CatMethod

-- | Distribution: place the local origins of diagrams at regular
--   intervals. With this method, the distance between successive
--   origins will be consistent but the distance between envelopes
--   may not be. Indeed, depending on the amount of separation, diagrams
--   may overlap.
Distrib :: CatMethod

-- | Compose a list of diagrams using the given composition function, first
--   aligning them all according to the given alignment, but retain
--   the local origin of the first diagram, as it would be if the
--   composition function were applied directly. That is,
--   composeAligned algn comp is equivalent to translate v .
--   comp . map algn for some appropriate translation vector
--   v.
--   
--   Unfortunately, this only works for diagrams (and not, say, paths)
--   because there is no most general type for alignment functions, and no
--   generic way to find out what an alignment function does to the origin
--   of things. (However, it should be possible to make a version of this
--   function that works specifically on paths, if such a thing were
--   deemed useful.)
--   
--   
--   
--   alignedEx1 = (hsep 2 # composeAligned alignT) (map circle [1,3,5,2])
--              # showOrigin
--              # frame 0.5
--   
--   
--   
--   
--   alignedEx2 = (mconcat # composeAligned alignTL) [circle 1, square 1, triangle 1, pentagon 1]
--              # showOrigin
--              # frame 0.1
--   
composeAligned :: (Monoid' m, Floating n, Ord n, Metric v) => (QDiagram b v n m -> QDiagram b v n m) -> ([QDiagram b v n m] -> QDiagram b v n m) -> [QDiagram b v n m] -> QDiagram b v n m
instance GHC.Num.Num n => Data.Default.Class.Default (Diagrams.Combinators.CatOpts n)

-- | "Traces", aka embedded raytracers, for finding points on the edge of a
--   diagram. See Diagrams.Core.Trace for internal implementation
--   details.
module Diagrams.Trace

-- | Every diagram comes equipped with a trace. Intuitively, the
--   trace for a diagram is like a raytracer: given a line (represented as
--   a base point and a direction vector), the trace computes a sorted list
--   of signed distances from the base point to all intersections of the
--   line with the boundary of the diagram.
--   
--   Note that the outputs are not absolute distances, but multipliers
--   relative to the input vector. That is, if the base point is p
--   and direction vector is v, and one of the output scalars is
--   s, then there is an intersection at the point p .+^ (s *^
--   v).
--   
data () => Trace (v :: Type -> Type) n

-- | Traced abstracts over things which have a trace.
class (Additive V a, Ord N a) => Traced a

-- | Lens onto the Trace of a QDiagram.
trace :: forall (v :: Type -> Type) n m b. (Metric v, OrderedField n, Semigroup m) => Lens' (QDiagram b v n m) (Trace v n)

-- | Replace the trace of a diagram.
setTrace :: forall b (v :: Type -> Type) n m. (OrderedField n, Metric v, Semigroup m) => Trace v n -> QDiagram b v n m -> QDiagram b v n m

-- | Use the trace from some object as the trace for a diagram, in place of
--   the diagram's default trace.
withTrace :: (InSpace v n a, Metric v, OrderedField n, Monoid' m, Traced a) => a -> QDiagram b v n m -> QDiagram b v n m

-- | Compute the vector from the given point p to the "smallest"
--   boundary intersection along the given vector v. The
--   "smallest" boundary intersection is defined as the one given by p
--   .+^ (s *^ v) for the smallest (most negative) value of
--   s. Return Nothing if there is no intersection. See
--   also traceP.
--   
--   See also rayTraceV which uses the smallest positive
--   intersection, which is often more intuitive behavior.
--   
traceV :: (n ~ N a, Num n, Traced a) => Point (V a) n -> V a n -> a -> Maybe (V a n)

-- | Compute the "smallest" boundary point along the line determined by the
--   given point p and vector v. The "smallest" boundary
--   point is defined as the one given by p .+^ (s *^ v) for the
--   smallest (most negative) value of s. Return Nothing
--   if there is no such boundary point. See also traceV.
--   
--   See also rayTraceP which uses the smallest positive
--   intersection, which is often more intuitive behavior.
--   
traceP :: (n ~ N a, Traced a, Num n) => Point (V a) n -> V a n -> a -> Maybe (Point (V a) n)

-- | Like traceV, but computes a vector to the "largest" boundary
--   point instead of the smallest. (Note, however, the "largest" boundary
--   point may still be in the opposite direction from the given vector, if
--   all the boundary points are, as in the third example shown below.)
--   
maxTraceV :: (n ~ N a, Num n, Traced a) => Point (V a) n -> V a n -> a -> Maybe (V a n)

-- | Like traceP, but computes the "largest" boundary point instead
--   of the smallest. (Note, however, the "largest" boundary point may
--   still be in the opposite direction from the given vector, if all the
--   boundary points are.)
--   
maxTraceP :: (n ~ N a, Num n, Traced a) => Point (V a) n -> V a n -> a -> Maybe (Point (V a) n)

-- | Compute the furthest point on the boundary of a subdiagram, beginning
--   from the location (local origin) of the subdiagram and moving in the
--   direction of the given vector. If there is no such point, the origin
--   is returned; see also boundaryFromMay.
boundaryFrom :: (OrderedField n, Metric v, Semigroup m) => Subdiagram b v n m -> v n -> Point v n

-- | Compute the furthest point on the boundary of a subdiagram, beginning
--   from the location (local origin) of the subdiagram and moving in the
--   direction of the given vector, or Nothing if there is no such
--   point.
boundaryFromMay :: (Metric v, OrderedField n, Semigroup m) => Subdiagram b v n m -> v n -> Maybe (Point v n)

-- | "Envelopes", aka functional bounding regions. See
--   Diagrams.Core.Envelope for internal implementation details.
module Diagrams.Envelope

-- | Every diagram comes equipped with an envelope. What is an
--   envelope?
--   
--   Consider first the idea of a bounding box. A bounding box
--   expresses the distance to a bounding plane in every direction parallel
--   to an axis. That is, a bounding box can be thought of as the
--   intersection of a collection of half-planes, two perpendicular to each
--   axis.
--   
--   More generally, the intersection of half-planes in every
--   direction would give a tight "bounding region", or convex hull.
--   However, representing such a thing intensionally would be impossible;
--   hence bounding boxes are often used as an approximation.
--   
--   An envelope is an extensional representation of such a
--   "bounding region". Instead of storing some sort of direct
--   representation, we store a function which takes a direction as
--   input and gives a distance to a bounding half-plane as output. The
--   important point is that envelopes can be composed, and transformed by
--   any affine transformation.
--   
--   Formally, given a vector v, the envelope computes a scalar
--   s such that
--   
--   
--   
- for every point u inside the diagram, if the projection
--   of (u - origin) onto v is s' *^ v, then
--   s' <= s.
--   
- s is the smallest such scalar.
--   
--   
--   There is also a special "empty envelope".
--   
--   The idea for envelopes came from Sebastian Setzer; see
--   http://byorgey.wordpress.com/2009/10/28/collecting-attributes/#comment-2030.
--   See also Brent Yorgey, Monoids: Theme and Variations, published
--   in the 2012 Haskell Symposium:
--   http://ozark.hendrix.edu/~yorgey/pub/monoid-pearl.pdf; video:
--   http://www.youtube.com/watch?v=X-8NCkD2vOw.
data () => Envelope (v :: Type -> Type) n

-- | Enveloped abstracts over things which have an envelope.
class (Metric V a, OrderedField N a) => Enveloped a

-- | Lens onto the Envelope of a QDiagram.
envelope :: forall n (v :: Type -> Type) m b. (OrderedField n, Metric v, Monoid' m) => Lens' (QDiagram b v n m) (Envelope v n)

-- | Replace the envelope of a diagram.
setEnvelope :: forall b (v :: Type -> Type) n m. (OrderedField n, Metric v, Monoid' m) => Envelope v n -> QDiagram b v n m -> QDiagram b v n m

-- | Use the envelope from some object as the envelope for a diagram, in
--   place of the diagram's default envelope.
--   
--   
--   
--   sqNewEnv =
--       circle 1 # fc green
--       |||
--       (    c # dashingG [0.1,0.1] 0 # lc white
--         <> square 2 # withEnvelope (c :: D V2 Double) # fc blue
--       )
--   c = circle 0.8
--   withEnvelopeEx = sqNewEnv # centerXY # pad 1.5
--   
withEnvelope :: (InSpace v n a, Monoid' m, Enveloped a) => a -> QDiagram b v n m -> QDiagram b v n m

-- | phantom x produces a "phantom" diagram, which has the same
--   envelope and trace as x but produces no output.
phantom :: (InSpace v n a, Monoid' m, Enveloped a, Traced a) => a -> QDiagram b v n m

-- | pad s "pads" a diagram, expanding its envelope by a factor of
--   s (factors between 0 and 1 can be used to shrink the
--   envelope). Note that the envelope will expand with respect to the
--   local origin, so if the origin is not centered the padding may appear
--   "uneven". If this is not desired, the origin can be centered (using,
--   e.g., centerXY for 2D diagrams) before applying pad.
pad :: (Metric v, OrderedField n, Monoid' m) => n -> QDiagram b v n m -> QDiagram b v n m

-- | extrudeEnvelope v d asymmetrically "extrudes" the envelope of
--   a diagram in the given direction. All parts of the envelope within 90
--   degrees of this direction are modified, offset outwards by the
--   magnitude of the vector.
--   
--   This works by offsetting the envelope distance proportionally to the
--   cosine of the difference in angle, and leaving it unchanged when this
--   factor is negative.
extrudeEnvelope :: (Metric v, OrderedField n, Monoid' m) => v n -> QDiagram b v n m -> QDiagram b v n m

-- | intrudeEnvelope v d asymmetrically "intrudes" the envelope of
--   a diagram away from the given direction. All parts of the envelope
--   within 90 degrees of this direction are modified, offset inwards by
--   the magnitude of the vector.
--   
--   Note that this could create strange inverted envelopes, where 
--   diameter v d < 0 .
intrudeEnvelope :: (Metric v, OrderedField n, Monoid' m) => v n -> QDiagram b v n m -> QDiagram b v n m

-- | Compute the vector from the local origin to a separating hyperplane in
--   the given direction, or Nothing for the empty envelope.
envelopeVMay :: Enveloped a => Vn a -> a -> Maybe (Vn a)

-- | Compute the vector from the local origin to a separating hyperplane in
--   the given direction. Returns the zero vector for the empty envelope.
envelopeV :: Enveloped a => Vn a -> a -> Vn a

-- | Compute the point on a separating hyperplane in the given direction,
--   or Nothing for the empty envelope.
envelopePMay :: (V a ~ v, N a ~ n, Enveloped a) => v n -> a -> Maybe (Point v n)

-- | Compute the point on a separating hyperplane in the given direction.
--   Returns the origin for the empty envelope.
envelopeP :: (V a ~ v, N a ~ n, Enveloped a) => v n -> a -> Point v n

-- | Compute the diameter of a enveloped object along a particular vector.
--   Returns zero for the empty envelope.
diameter :: (V a ~ v, N a ~ n, Enveloped a) => v n -> a -> n

-- | Compute the "radius" (1/2 the diameter) of an enveloped object along a
--   particular vector.
radius :: (V a ~ v, N a ~ n, Enveloped a) => v n -> a -> n

-- | This module defines paths, which are collections of concretely
--   located Trails. Many drawing systems (cairo, svg, ...) have a
--   similar notion of "path". Note that paths with multiple trails are
--   necessary for being able to draw e.g. filled objects with holes
--   in them.
module Diagrams.Path

-- | A path is a (possibly empty) list of Located
--   Trails. Hence, unlike trails, paths are not translationally
--   invariant, and they form a monoid under superposition (placing
--   one path on top of another) rather than concatenation.
newtype Path v n
Path :: [Located (Trail v n)] -> Path v n

-- | Extract the located trails making up a Path.
pathTrails :: Path v n -> [Located (Trail v n)]

-- | Type class for things that can be converted to a Path.
--   
--   Note that this class is very different from TrailLike.
--   TrailLike is usually the result of a library function to give
--   you a convenient, polymorphic result (Path, Diagram
--   etc.).
class ToPath t

-- | toPath takes something that can be converted to Path and
--   returns the Path.
toPath :: (ToPath t, Metric (V t), OrderedField (N t)) => t -> Path (V t) (N t)

-- | Convert a trail to a path beginning at the origin.
pathFromTrail :: (Metric v, OrderedField n) => Trail v n -> Path v n

-- | Convert a trail to a path with a particular starting point.
pathFromTrailAt :: (Metric v, OrderedField n) => Trail v n -> Point v n -> Path v n

-- | Convert a located trail to a singleton path. This is equivalent to
--   trailLike, but provided with a more specific name and type for
--   convenience.
pathFromLocTrail :: (Metric v, OrderedField n) => Located (Trail v n) -> Path v n

-- | Extract the points of a path, resulting in a separate list of points
--   for each component trail. Here a point is any place where two
--   segments join; see also pathVertices and trailPoints.
--   
--   This function allows you "observe" the fact that trails are
--   implemented as lists of segments, which may be problematic if we want
--   to think of trails as parametric vector functions. This also means
--   that the behavior of this function may not be stable under future
--   changes to the implementation of trails and paths. For an
--   unproblematic version which only yields vertices at which there is a
--   sharp corner, excluding points differentiable points, see
--   pathVertices.
--   
--   This function is not re-exported from Diagrams.Prelude; to use
--   it, import Diagrams.Path.
pathPoints :: (Metric v, OrderedField n) => Path v n -> [[Point v n]]

-- | Extract the vertices of a path, resulting in a separate list of
--   vertices for each component trail. Here a vertex is defined as
--   a non-differentiable point on the trail, i.e. a sharp corner.
--   (Vertices are thus a subset of the places where segments join; if you
--   want all joins between segments, see pathPoints.) The tolerance
--   determines how close the tangents of two segments must be at their
--   endpoints to consider the transition point to be differentiable. See
--   trailVertices for more information.
pathVertices' :: (Metric v, OrderedField n) => n -> Path v n -> [[Point v n]]

-- | Like pathVertices', with a default tolerance.
pathVertices :: (Metric v, OrderedField n) => Path v n -> [[Point v n]]

-- | Compute the total offset of each trail comprising a path (see
--   trailOffset).
pathOffsets :: (Metric v, OrderedField n) => Path v n -> [v n]

-- | Compute the centroid of a path (i.e. the average
--   location of its vertices; see pathVertices).
pathCentroid :: (Metric v, OrderedField n) => Path v n -> Point v n

-- | Convert a path into a list of lists of located segments.
pathLocSegments :: (Metric v, OrderedField n) => Path v n -> [[Located (Segment Closed v n)]]

-- | Convert a path into a list of lists of FixedSegments.
fixPath :: (Metric v, OrderedField n) => Path v n -> [[FixedSegment v n]]

-- | Scale a path using its centroid (see pathCentroid) as the base
--   point for the scale.
scalePath :: (HasLinearMap v, Metric v, OrderedField n) => n -> Path v n -> Path v n

-- | Reverse all the component trails of a path.
reversePath :: (Metric v, OrderedField n) => Path v n -> Path v n

-- | "Explode" a path by exploding every component trail (see
--   explodeTrail).
explodePath :: (V t ~ v, N t ~ n, TrailLike t) => Path v n -> [[t]]

-- | Partition a path into two paths based on a predicate on trails: the
--   first containing all the trails for which the predicate returns
--   True, and the second containing the remaining trails.
partitionPath :: (Located (Trail v n) -> Bool) -> Path v n -> (Path v n, Path v n)
instance GHC.Generics.Generic (Diagrams.Path.Path v n)
instance GHC.Base.Monoid (Diagrams.Path.Path v n)
instance GHC.Base.Semigroup (Diagrams.Path.Path v n)
instance GHC.Show.Show (v n) => GHC.Show.Show (Diagrams.Path.Path v n)
instance GHC.Classes.Eq (v n) => GHC.Classes.Eq (Diagrams.Path.Path v n)
instance GHC.Classes.Ord (v n) => GHC.Classes.Ord (Diagrams.Path.Path v n)
instance Diagrams.Path.ToPath (Diagrams.Path.Path v n)
instance Diagrams.Path.ToPath (Diagrams.Trail.Trail v n)
instance Diagrams.Path.ToPath (Diagrams.Trail.Trail' l v n)
instance Diagrams.Path.ToPath (Diagrams.Located.Located (Diagrams.Trail.Trail v n))
instance Diagrams.Path.ToPath (Diagrams.Located.Located (Diagrams.Trail.Trail' l v n))
instance Diagrams.Path.ToPath (Diagrams.Located.Located (Diagrams.Segment.Segment Diagrams.Segment.Closed v n))
instance Diagrams.Path.ToPath (Diagrams.Located.Located [Diagrams.Segment.Segment Diagrams.Segment.Closed v n])
instance Diagrams.Path.ToPath (Diagrams.Segment.FixedSegment v n)
instance Diagrams.Path.ToPath a => Diagrams.Path.ToPath [a]
instance (Diagrams.Core.Envelope.OrderedField n, Linear.Metric.Metric v, Data.Serialize.Serialize (v n), Data.Serialize.Serialize (Diagrams.Core.V.V (v n) (Diagrams.Core.V.N (v n)))) => Data.Serialize.Serialize (Diagrams.Path.Path v n)
instance Control.Lens.Wrapped.Wrapped (Diagrams.Path.Path v n)
instance Control.Lens.Wrapped.Rewrapped (Diagrams.Path.Path v n) (Diagrams.Path.Path v' n')
instance Control.Lens.Each.Each (Diagrams.Path.Path v n) (Diagrams.Path.Path v' n') (Diagrams.Located.Located (Diagrams.Trail.Trail v n)) (Diagrams.Located.Located (Diagrams.Trail.Trail v' n'))
instance Control.Lens.Empty.AsEmpty (Diagrams.Path.Path v n)
instance Control.Lens.Cons.Cons (Diagrams.Path.Path v n) (Diagrams.Path.Path v' n') (Diagrams.Located.Located (Diagrams.Trail.Trail v n)) (Diagrams.Located.Located (Diagrams.Trail.Trail v' n'))
instance Control.Lens.Cons.Snoc (Diagrams.Path.Path v n) (Diagrams.Path.Path v' n') (Diagrams.Located.Located (Diagrams.Trail.Trail v n)) (Diagrams.Located.Located (Diagrams.Trail.Trail v' n'))
instance (Linear.Vector.Additive v, GHC.Num.Num n) => Diagrams.Core.HasOrigin.HasOrigin (Diagrams.Path.Path v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.TrailLike.TrailLike (Diagrams.Path.Path v n)
instance (Diagrams.Core.Transform.HasLinearMap v, Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.Core.Transform.Transformable (Diagrams.Path.Path v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.Core.Envelope.Enveloped (Diagrams.Path.Path v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.Core.Juxtapose.Juxtaposable (Diagrams.Path.Path v n)
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.Align.Alignable (Diagrams.Path.Path v n)
instance (Diagrams.Core.Transform.HasLinearMap v, Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.Core.Types.Renderable (Diagrams.Path.Path v n) Diagrams.Core.Types.NullBackend
instance (Linear.Metric.Metric v, Diagrams.Core.Envelope.OrderedField n) => Control.Lens.Internal.Iso.Reversing (Diagrams.Path.Path v n)

-- | This module defines a general API for creating various types of
--   polygons.
module Diagrams.TwoD.Polygons

-- | Method used to determine the vertices of a polygon.
data PolyType n

-- | A "polar" polygon.
--   
--   
--   
- The first argument is a list of central angles from
--   each vertex to the next.
--   
- The second argument is a list of radii from the origin to
--   each successive vertex.
--   
--   
--   To construct an n-gon, use a list of n-1 angles and
--   n radii. Extra angles or radii are ignored.
--   
--   Cyclic polygons (with all vertices lying on a circle) can be
--   constructed using a second argument of (repeat r).
PolyPolar :: [Angle n] -> [n] -> PolyType n

-- | A polygon determined by the distance between successive vertices and
--   the external angles formed by each three successive vertices. In other
--   words, a polygon specified by "turtle graphics": go straight ahead x1
--   units; turn by external angle a1; go straight ahead x2 units; turn by
--   external angle a2; etc. The polygon will be centered at the
--   centroid of its vertices.
--   
--   
--   
- The first argument is a list of vertex angles,
--   giving the external angle at each vertex from the previous vertex to
--   the next. The first angle in the list is the external angle at the
--   second vertex; the first edge always starts out heading in the
--   positive y direction from the first vertex.
--   
- The second argument is a list of distances between successive
--   vertices.
--   
--   
--   To construct an n-gon, use a list of n-2 angles and
--   n-1 edge lengths. Extra angles or lengths are ignored.
PolySides :: [Angle n] -> [n] -> PolyType n

-- | A regular polygon with the given number of sides (first argument) and
--   the given radius (second argument).
PolyRegular :: Int -> n -> PolyType n

-- | Determine how a polygon should be oriented.
data PolyOrientation n

-- | No special orientation; the first vertex will be at (1,0).
NoOrient :: PolyOrientation n

-- | Orient horizontally, so the bottommost edge is parallel to the
--   x-axis. This is the default.
OrientH :: PolyOrientation n

-- | Orient vertically, so the leftmost edge is parallel to the
--   y-axis.
OrientV :: PolyOrientation n

-- | Orient so some edge is facing in the
--   direction of, that is, perpendicular to, the given
--   vector.
OrientTo :: V2 n -> PolyOrientation n

-- | Options for specifying a polygon.
data PolygonOpts n
PolygonOpts :: PolyType n -> PolyOrientation n -> Point V2 n -> PolygonOpts n
[_polyType] :: PolygonOpts n -> PolyType n
[_polyOrient] :: PolygonOpts n -> PolyOrientation n
[_polyCenter] :: PolygonOpts n -> Point V2 n

-- | Specification for the polygon's vertices.
polyType :: Lens' (PolygonOpts n) (PolyType n)

-- | Should a rotation be applied to the polygon in order to orient it in a
--   particular way?
polyOrient :: Lens' (PolygonOpts n) (PolyOrientation n)

-- | Should a translation be applied to the polygon in order to place the
--   center at a particular location?
polyCenter :: Lens' (PolygonOpts n) (Point V2 n)

-- | Generate the polygon described by the given options.
polygon :: (InSpace V2 n t, TrailLike t) => PolygonOpts n -> t

-- | Generate a polygon. See PolygonOpts for more information.
polyTrail :: OrderedField n => PolygonOpts n -> Located (Trail V2 n)

-- | Generate the located trail of a polygon specified by polar data
--   (central angles and radii). See PolyPolar.
polyPolarTrail :: OrderedField n => [Angle n] -> [n] -> Located (Trail V2 n)

-- | Generate the vertices of a polygon specified by side length and
--   angles, and a starting point for the trail such that the origin is at
--   the centroid of the vertices. See PolySides.
polySidesTrail :: OrderedField n => [Angle n] -> [n] -> Located (Trail V2 n)

-- | Generate the vertices of a regular polygon. See PolyRegular.
polyRegularTrail :: OrderedField n => Int -> n -> Located (Trail V2 n)

-- | Generate a transformation to orient a trail. orient v t
--   generates the smallest rotation such that one of the segments adjacent
--   to the vertex furthest in the direction of v is perpendicular
--   to v.
orient :: OrderedField n => V2 n -> Located (Trail V2 n) -> Transformation V2 n

-- | Options for creating "star" polygons, where the edges connect possibly
--   non-adjacent vertices.
data StarOpts

-- | Specify the order in which the vertices should be connected by a
--   function that maps each vertex index to the index of the vertex that
--   should come next. Indexing of vertices begins at 0.
StarFun :: (Int -> Int) -> StarOpts

-- | Specify a star polygon by a "skip". A skip of 1 indicates a normal
--   polygon, where edges go between successive vertices. A skip of 2 means
--   that edges will connect every second vertex, skipping one in between.
--   Generally, a skip of n means that edges will connect every
--   nth vertex.
StarSkip :: Int -> StarOpts

-- | Create a generalized star polygon. The StarOpts
--   are used to determine in which order the given vertices should be
--   connected. The intention is that the second argument of type
--   [Point v] could be generated by a call to polygon,
--   regPoly, or the like, since a list of vertices is
--   TrailLike. But of course the list can be generated any way you
--   like. A Path v is returned (instead of any
--   TrailLike) because the resulting path may have more than one
--   component, for example if the vertices are to be connected in several
--   disjoint cycles.
star :: OrderedField n => StarOpts -> [Point V2 n] -> Path V2 n

-- | Pieces of a function graph can either be cycles or "hairs".
data GraphPart a
Cycle :: [a] -> GraphPart a
Hair :: [a] -> GraphPart a

-- | orbits f n computes the graph of f on the integers
--   mod n.
orbits :: (Int -> Int) -> Int -> [GraphPart Int]

-- | Generate a function graph from the given function and labels.
mkGraph :: (Int -> Int) -> [a] -> [GraphPart a]
instance GHC.Base.Functor Diagrams.TwoD.Polygons.GraphPart
instance GHC.Show.Show a => GHC.Show.Show (Diagrams.TwoD.Polygons.GraphPart a)
instance GHC.Num.Num n => Data.Default.Class.Default (Diagrams.TwoD.Polygons.PolygonOpts n)
instance GHC.Read.Read n => GHC.Read.Read (Diagrams.TwoD.Polygons.PolyOrientation n)
instance GHC.Show.Show n => GHC.Show.Show (Diagrams.TwoD.Polygons.PolyOrientation n)
instance GHC.Classes.Ord n => GHC.Classes.Ord (Diagrams.TwoD.Polygons.PolyOrientation n)
instance GHC.Classes.Eq n => GHC.Classes.Eq (Diagrams.TwoD.Polygons.PolyOrientation n)

-- | Various two-dimensional shapes.
module Diagrams.TwoD.Shapes

-- | Create a centered horizontal (L-R) line of the given length.
--   
--   
--   
--   hruleEx = vcat' (with & sep .~ 0.2) (map hrule [1..5])
--           # centerXY # pad 1.1
--   
hrule :: (InSpace V2 n t, TrailLike t) => n -> t

-- | Create a centered vertical (T-B) line of the given length.
--   
--   
--   
--   vruleEx = hcat' (with & sep .~ 0.2) (map vrule [1, 1.2 .. 2])
--           # centerXY # pad 1.1
--   
vrule :: (InSpace V2 n t, TrailLike t) => n -> t

-- | Create a regular polygon. The first argument is the number of sides,
--   and the second is the length of the sides. (Compare to the
--   polygon function with a PolyRegular option, which
--   produces polygons of a given radius).
--   
--   The polygon will be oriented with one edge parallel to the x-axis.
regPoly :: (InSpace V2 n t, TrailLike t) => Int -> n -> t

-- | An equilateral triangle, with sides of the given length and base
--   parallel to the x-axis.
--   
triangle :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A synonym for triangle, provided for backwards compatibility.
eqTriangle :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A square with its center at the origin and sides of the given length,
--   oriented parallel to the axes.
--   
square :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A regular pentagon, with sides of the given length and base parallel
--   to the x-axis.
--   
pentagon :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A regular hexagon, with sides of the given length and base parallel to
--   the x-axis.
--   
hexagon :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A regular heptagon, with sides of the given length and base parallel
--   to the x-axis.
--   
heptagon :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A synonym for heptagon. It is, however, completely inferior,
--   being a base admixture of the Latin septum (seven) and the
--   Greek γωνία (angle).
septagon :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A regular octagon, with sides of the given length and base parallel to
--   the x-axis.
--   
octagon :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A regular nonagon, with sides of the given length and base parallel to
--   the x-axis.
--   
nonagon :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A regular decagon, with sides of the given length and base parallel to
--   the x-axis.
--   
decagon :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A regular hendecagon, with sides of the given length and base parallel
--   to the x-axis.
--   
hendecagon :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A regular dodecagon, with sides of the given length and base parallel
--   to the x-axis.
--   
dodecagon :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A square with its center at the origin and sides of length 1, oriented
--   parallel to the axes.
--   
unitSquare :: (InSpace V2 n t, TrailLike t) => t

-- | rect w h is an axis-aligned rectangle of width w and
--   height h, centered at the origin.
--   
rect :: (InSpace V2 n t, TrailLike t) => n -> n -> t

-- | roundedRect w h r generates a closed trail, or closed path
--   centered at the origin, of an axis-aligned rectangle with width
--   w, height h, and circular rounded corners of radius
--   r. If r is negative the corner will be cut out in a
--   reverse arc. If the size of r is larger than half the smaller
--   dimension of w and h, then it will be reduced to fit
--   in that range, to prevent the corners from overlapping. The trail or
--   path begins with the right edge and proceeds counterclockwise. If you
--   need to specify a different radius for each corner individually, use
--   roundedRect' instead.
--   
--   
--   
--   roundedRectEx = pad 1.1 . centerXY $ hcat' (with & sep .~ 0.2)
--     [ roundedRect  0.5 0.4 0.1
--     , roundedRect  0.5 0.4 (-0.1)
--     , roundedRect' 0.7 0.4 (with & radiusTL .~ 0.2
--                                  & radiusTR .~ -0.2
--                                  & radiusBR .~ 0.1)
--     ]
--   
roundedRect :: (InSpace V2 n t, TrailLike t, RealFloat n) => n -> n -> n -> t
data RoundedRectOpts d
RoundedRectOpts :: d -> d -> d -> d -> RoundedRectOpts d
[_radiusTL] :: RoundedRectOpts d -> d
[_radiusTR] :: RoundedRectOpts d -> d
[_radiusBL] :: RoundedRectOpts d -> d
[_radiusBR] :: RoundedRectOpts d -> d
radiusTL :: forall d_a1Jt1. Lens' (RoundedRectOpts d_a1Jt1) d_a1Jt1
radiusTR :: forall d_a1Jt1. Lens' (RoundedRectOpts d_a1Jt1) d_a1Jt1
radiusBL :: forall d_a1Jt1. Lens' (RoundedRectOpts d_a1Jt1) d_a1Jt1
radiusBR :: forall d_a1Jt1. Lens' (RoundedRectOpts d_a1Jt1) d_a1Jt1

-- | roundedRect' works like roundedRect but allows you
--   to set the radius of each corner indivually, using
--   RoundedRectOpts. The default corner radius is 0. Each radius
--   can also be negative, which results in the curves being reversed to be
--   inward instead of outward.
roundedRect' :: (InSpace V2 n t, TrailLike t, RealFloat n) => n -> n -> RoundedRectOpts n -> t
instance GHC.Num.Num d => Data.Default.Class.Default (Diagrams.TwoD.Shapes.RoundedRectOpts d)

-- | Paths in two dimensions are special since we may stroke them to create
--   a 2D diagram, and (eventually) perform operations such as intersection
--   and union. They also have a trace, whereas paths in higher dimensions
--   do not.
module Diagrams.TwoD.Path

-- | Convert a ToPath object into a diagram. The resulting diagram
--   has the names 0, 1, ... assigned to each of the path's vertices.
--   
--   See also stroke', which takes an extra options record allowing
--   its behaviour to be customized.
--   
--   
--   stroke :: Path V2 Double                  -> Diagram b
--   stroke :: Located (Trail V2 Double)       -> Diagram b
--   stroke :: Located (Trail' Loop V2 Double) -> Diagram b
--   stroke :: Located (Trail' Line V2 Double) -> Diagram b
--   
stroke :: (InSpace V2 n t, ToPath t, TypeableFloat n, Renderable (Path V2 n) b) => t -> QDiagram b V2 n Any

-- | A variant of stroke that takes an extra record of options to
--   customize its behaviour. In particular:
--   
--   
--   
- Names can be assigned to the path's vertices
--   
--   
--   StrokeOpts is an instance of Default, so stroke'
--   (with & ... ) syntax may be used.
stroke' :: (InSpace V2 n t, ToPath t, TypeableFloat n, Renderable (Path V2 n) b, IsName a) => StrokeOpts a -> t -> QDiagram b V2 n Any

-- | stroke specialised to Path.
strokePath :: (TypeableFloat n, Renderable (Path V2 n) b) => Path V2 n -> QDiagram b V2 n Any

-- | stroke specialised to Path.
strokeP :: (TypeableFloat n, Renderable (Path V2 n) b) => Path V2 n -> QDiagram b V2 n Any

-- | stroke' specialised to Path.
strokePath' :: (TypeableFloat n, Renderable (Path V2 n) b, IsName a) => StrokeOpts a -> Path V2 n -> QDiagram b V2 n Any

-- | stroke' specialised to Path.
strokeP' :: (TypeableFloat n, Renderable (Path V2 n) b, IsName a) => StrokeOpts a -> Path V2 n -> QDiagram b V2 n Any

-- | stroke specialised to Trail.
strokeTrail :: (TypeableFloat n, Renderable (Path V2 n) b) => Trail V2 n -> QDiagram b V2 n Any

-- | stroke specialised to Trail.
strokeT :: (TypeableFloat n, Renderable (Path V2 n) b) => Trail V2 n -> QDiagram b V2 n Any

-- | A composition of stroke' and pathFromTrail for
--   conveniently converting a trail directly into a diagram.
strokeTrail' :: (TypeableFloat n, Renderable (Path V2 n) b, IsName a) => StrokeOpts a -> Trail V2 n -> QDiagram b V2 n Any

-- | Deprecated synonym for strokeTrail'.
strokeT' :: (TypeableFloat n, Renderable (Path V2 n) b, IsName a) => StrokeOpts a -> Trail V2 n -> QDiagram b V2 n Any

-- | A composition of strokeT and wrapLine for conveniently
--   converting a line directly into a diagram.
strokeLine :: (TypeableFloat n, Renderable (Path V2 n) b) => Trail' Line V2 n -> QDiagram b V2 n Any

-- | A composition of strokeT and wrapLoop for conveniently
--   converting a loop directly into a diagram.
strokeLoop :: (TypeableFloat n, Renderable (Path V2 n) b) => Trail' Loop V2 n -> QDiagram b V2 n Any

-- | A convenience function for converting a Located Trail
--   directly into a diagram; strokeLocTrail = stroke . trailLike.
strokeLocTrail :: (TypeableFloat n, Renderable (Path V2 n) b) => Located (Trail V2 n) -> QDiagram b V2 n Any

-- | Deprecated synonym for strokeLocTrail.
strokeLocT :: (TypeableFloat n, Renderable (Path V2 n) b) => Located (Trail V2 n) -> QDiagram b V2 n Any

-- | A convenience function for converting a Located line directly
--   into a diagram; strokeLocLine = stroke . trailLike . mapLoc
--   wrapLine.
strokeLocLine :: (TypeableFloat n, Renderable (Path V2 n) b) => Located (Trail' Line V2 n) -> QDiagram b V2 n Any

-- | A convenience function for converting a Located loop directly
--   into a diagram; strokeLocLoop = stroke . trailLike . mapLoc
--   wrapLoop.
strokeLocLoop :: (TypeableFloat n, Renderable (Path V2 n) b) => Located (Trail' Loop V2 n) -> QDiagram b V2 n Any

-- | Enumeration of algorithms or "rules" for determining which points lie
--   in the interior of a (possibly self-intersecting) path.
data FillRule

-- | Interior points are those with a nonzero winding number.
--   See http://en.wikipedia.org/wiki/Nonzero-rule.
Winding :: FillRule

-- | Interior points are those where a ray extended infinitely in a
--   particular direction crosses the path an odd number of times. See
--   http://en.wikipedia.org/wiki/Even-odd_rule.
EvenOdd :: FillRule

-- | Extract the fill rule from a FillRuleA attribute.
getFillRule :: FillRule -> FillRule

-- | Specify the fill rule that should be used for determining which points
--   are inside a path.
fillRule :: HasStyle a => FillRule -> a -> a

-- | Lens onto the fill rule of a style.
_fillRule :: Lens' (Style V2 n) FillRule

-- | A record of options that control how a path is stroked.
--   StrokeOpts is an instance of Default, so a
--   StrokeOpts records can be created using with {
--   ... } notation.
data StrokeOpts a
StrokeOpts :: [[a]] -> FillRule -> StrokeOpts a
[_vertexNames] :: StrokeOpts a -> [[a]]
[_queryFillRule] :: StrokeOpts a -> FillRule

-- | Atomic names that should be assigned to the vertices of the path so
--   that they can be referenced later. If there are not enough names, the
--   extra vertices are not assigned names; if there are too many, the
--   extra names are ignored. Note that this is a list of lists of
--   names, since paths can consist of multiple trails. The first list of
--   names are assigned to the vertices of the first trail, the second list
--   to the second trail, and so on.
--   
--   The default value is the empty list.
vertexNames :: Lens (StrokeOpts a) (StrokeOpts a') [[a]] [[a']]

-- | The fill rule used for determining which points are inside the path.
--   The default is Winding. NOTE: for now, this only affects the
--   resulting diagram's Query, not how it will be drawn! To
--   set the fill rule determining how it is to be drawn, use the
--   fillRule function.
queryFillRule :: Lens' (StrokeOpts a) FillRule

-- | The sum of signed crossings of a path as we travel in the
--   positive x direction from a given point.
--   
--   
--   
- A point is filled according to the Winding fill rule, if
--   the number of Crossings is non-zero (see
--   isInsideWinding).
--   
- A point is filled according to the EvenOdd fill rule, if
--   the number of Crossings is odd (see
--   isInsideEvenOdd).
--   
--   
--   This is the HasQuery result for Paths, Located
--   Trails and Located Loops.
--   
--   
--   sample :: Path V2 Double                  -> Point V2 Double -> Crossings
--   sample :: Located (Trail V2 Double)       -> Point V2 Double -> Crossings
--   sample :: Located (Trail' Loop V2 Double) -> Point V2 Double -> Crossings
--   
--   
--   Note that Lines have no inside or outside, so don't contribute
--   crossings
newtype Crossings
Crossings :: Int -> Crossings

-- | Test whether the given point is inside the given path, by testing
--   whether the point's winding number is nonzero. Note that
--   False is always returned for paths consisting of lines
--   (as opposed to loops), regardless of the winding number.
--   
--   
--   isInsideWinding :: Path V2 Double                  -> Point V2 Double -> Bool
--   isInsideWinding :: Located (Trail V2 Double)       -> Point V2 Double -> Bool
--   isInsideWinding :: Located (Trail' Loop V2 Double) -> Point V2 Double -> Bool
--   
isInsideWinding :: HasQuery t Crossings => t -> Point (V t) (N t) -> Bool

-- | Test whether the given point is inside the given path, by testing
--   whether a ray extending from the point in the positive x direction
--   crosses the path an even (outside) or odd (inside) number of times.
--   Note that False is always returned for paths
--   consisting of lines (as opposed to loops), regardless of the number of
--   crossings.
--   
--   
--   isInsideEvenOdd :: Path V2 Double                  -> Point V2 Double -> Bool
--   isInsideEvenOdd :: Located (Trail V2 Double)       -> Point V2 Double -> Bool
--   isInsideEvenOdd :: Located (Trail' Loop V2 Double) -> Point V2 Double -> Bool
--   
isInsideEvenOdd :: HasQuery t Crossings => t -> Point (V t) (N t) -> Bool

-- | Clip tracks the accumulated clipping paths applied to a
--   diagram. Note that the semigroup structure on Clip is list
--   concatenation, so applying multiple clipping paths is sensible. The
--   clipping region is the intersection of all the applied clipping paths.
newtype Clip n
Clip :: [Path V2 n] -> Clip n
_Clip :: Iso (Clip n) (Clip n') [Path V2 n] [Path V2 n']

-- | Lens onto the Clip in a style. An empty list means no clipping.
_clip :: (Typeable n, OrderedField n) => Lens' (Style V2 n) [Path V2 n]

-- | Clip a diagram by the given path:
--   
--   
--   
- Only the parts of the diagram which lie in the interior of the
--   path will be drawn.
--   
- The envelope of the diagram is unaffected.
--   
clipBy :: (HasStyle a, V a ~ V2, N a ~ n, TypeableFloat n) => Path V2 n -> a -> a

-- | Clip a diagram to the given path setting its envelope to the pointwise
--   minimum of the envelopes of the diagram and path. The trace consists
--   of those parts of the original diagram's trace which fall within the
--   clipping path, or parts of the path's trace within the original
--   diagram.
clipTo :: TypeableFloat n => Path V2 n -> QDiagram b V2 n Any -> QDiagram b V2 n Any

-- | Clip a diagram to the clip path taking the envelope and trace of the
--   clip path.
clipped :: TypeableFloat n => Path V2 n -> QDiagram b V2 n Any -> QDiagram b V2 n Any

-- | Find the intersect points of two objects that can be converted to a
--   path.
intersectPoints :: (InSpace V2 n t, SameSpace t s, ToPath t, ToPath s, OrderedField n) => t -> s -> [P2 n]

-- | Find the intersect points of two objects that can be converted to a
--   path within the given tolerance.
intersectPoints' :: (InSpace V2 n t, SameSpace t s, ToPath t, ToPath s, OrderedField n) => n -> t -> s -> [P2 n]

-- | Compute the intersect points between two paths.
intersectPointsP :: OrderedField n => Path V2 n -> Path V2 n -> [P2 n]

-- | Compute the intersect points between two paths within given tolerance.
intersectPointsP' :: OrderedField n => n -> Path V2 n -> Path V2 n -> [P2 n]

-- | Compute the intersect points between two located trails.
intersectPointsT :: OrderedField n => Located (Trail V2 n) -> Located (Trail V2 n) -> [P2 n]

-- | Compute the intersect points between two located trails within the
--   given tolerance.
intersectPointsT' :: OrderedField n => n -> Located (Trail V2 n) -> Located (Trail V2 n) -> [P2 n]
instance (Diagrams.TwoD.Path.Clip n1 GHC.Types.~ t) => Control.Lens.Wrapped.Rewrapped (Diagrams.TwoD.Path.Clip n2) t
instance Control.Lens.Wrapped.Wrapped (Diagrams.TwoD.Path.Clip n)
instance Data.Typeable.Internal.Typeable n => Diagrams.Core.Style.AttributeClass (Diagrams.TwoD.Path.Clip n)
instance Control.Lens.Empty.AsEmpty (Diagrams.TwoD.Path.Clip n)
instance Diagrams.Core.Envelope.OrderedField n => Diagrams.Core.Transform.Transformable (Diagrams.TwoD.Path.Clip n)
instance GHC.Float.RealFloat n => Diagrams.Query.HasQuery (Diagrams.TwoD.Path.Clip n) Data.Semigroup.Internal.All
instance GHC.Real.Integral Diagrams.TwoD.Path.Crossings
instance GHC.Real.Real Diagrams.TwoD.Path.Crossings
instance GHC.Enum.Enum Diagrams.TwoD.Path.Crossings
instance GHC.Num.Num Diagrams.TwoD.Path.Crossings
instance GHC.Classes.Ord Diagrams.TwoD.Path.Crossings
instance GHC.Classes.Eq Diagrams.TwoD.Path.Crossings
instance GHC.Show.Show Diagrams.TwoD.Path.Crossings
instance GHC.Base.Semigroup (Diagrams.TwoD.Path.Clip n)
instance GHC.Base.Semigroup Diagrams.TwoD.Path.Crossings
instance GHC.Base.Monoid Diagrams.TwoD.Path.Crossings
instance GHC.Float.RealFloat n => Diagrams.Query.HasQuery (Diagrams.Located.Located (Diagrams.Trail.Trail Linear.V2.V2 n)) Diagrams.TwoD.Path.Crossings
instance GHC.Float.RealFloat n => Diagrams.Query.HasQuery (Diagrams.Located.Located (Diagrams.Trail.Trail' l Linear.V2.V2 n)) Diagrams.TwoD.Path.Crossings
instance GHC.Float.RealFloat n => Diagrams.Query.HasQuery (Diagrams.Path.Path Linear.V2.V2 n) Diagrams.TwoD.Path.Crossings
instance Data.Default.Class.Default (Diagrams.TwoD.Path.StrokeOpts a)
instance (Diagrams.Core.Types.TypeableFloat n, Diagrams.Core.Types.Renderable (Diagrams.Path.Path Linear.V2.V2 n) b) => Diagrams.TrailLike.TrailLike (Diagrams.Core.Types.QDiagram b Linear.V2.V2 n Data.Semigroup.Internal.Any)
instance GHC.Classes.Ord Diagrams.TwoD.Path.FillRule
instance GHC.Classes.Eq Diagrams.TwoD.Path.FillRule
instance GHC.Show.Show Diagrams.TwoD.Path.FillRule
instance Diagrams.Core.Style.AttributeClass Diagrams.TwoD.Path.FillRule
instance GHC.Base.Semigroup Diagrams.TwoD.Path.FillRule
instance Data.Default.Class.Default Diagrams.TwoD.Path.FillRule
instance GHC.Float.RealFloat n => Diagrams.Core.Trace.Traced (Diagrams.Trail.Trail Linear.V2.V2 n)
instance GHC.Float.RealFloat n => Diagrams.Core.Trace.Traced (Diagrams.Path.Path Linear.V2.V2 n)

-- | Compute offsets to segments in two dimensions. More details can be
--   found in the manual at
--   https://diagrams.github.io/doc/manual.html#offsets-of-segments-trails-and-paths.
module Diagrams.TwoD.Offset
offsetSegment :: RealFloat n => n -> n -> Segment Closed V2 n -> Located (Trail V2 n)

-- | Compute the offset of a segment. Given a segment compute the offset
--   curve that is a fixed distance from the original curve. For linear
--   segments nothing special happens, the same linear segment is returned
--   with a point that is offset by a perpendicular vector of the given
--   offset length.
--   
--   Cubic segments require a search for a subdivision of cubic segments
--   that gives an approximation of the offset within the given epsilon
--   factor (the given epsilon factor is applied to the radius giving a
--   concrete epsilon value). We must do this because the offset of a cubic
--   is not a cubic itself (the degree of the curve increases). Cubics do,
--   however, approach constant curvature as we subdivide. In light of this
--   we scale the handles of the offset cubic segment in proportion to the
--   radius of curvature difference between the original subsegment and the
--   offset which will have a radius increased by the offset parameter.
--   
--   In the following example the blue lines are the original segments and
--   the alternating green and red lines are the resulting offset trail
--   segments.
--   
--   
--   Note that when the original curve has a cusp, the offset curve forms a
--   radius around the cusp, and when there is a loop in the original
--   curve, there can be two cusps in the offset curve.
--   
--   Options for specifying line join and segment epsilon for an offset
--   involving multiple segments.
data OffsetOpts d
OffsetOpts :: LineJoin -> d -> d -> OffsetOpts d
[_offsetJoin] :: OffsetOpts d -> LineJoin
[_offsetMiterLimit] :: OffsetOpts d -> d
[_offsetEpsilon] :: OffsetOpts d -> d

-- | Specifies the style of join for between adjacent offset segments.
offsetJoin :: Lens' (OffsetOpts d) LineJoin

-- | Specifies the miter limit for the join.
offsetMiterLimit :: Lens' (OffsetOpts d) d

-- | Epsilon perimeter for offsetSegment.
offsetEpsilon :: Lens' (OffsetOpts d) d

-- | Offset a Trail with the default options and a given radius. See
--   offsetTrail'.
offsetTrail :: RealFloat n => n -> Located (Trail V2 n) -> Located (Trail V2 n)

-- | Offset a Trail with options and by a given radius. This
--   generates a new trail that is always radius r away from the
--   given Trail (depending on the line join option) on the right.
--   
--   The styles applied to an outside corner can be seen here (with the
--   original trail in blue and the result of offsetTrail' in
--   green):
--   
--   
--   When a negative radius is given, the offset trail will be on the left:
--   
--   
--   When offseting a counter-clockwise loop a positive radius gives an
--   outer loop while a negative radius gives an inner loop (both
--   counter-clockwise).
--   
offsetTrail' :: RealFloat n => OffsetOpts n -> n -> Located (Trail V2 n) -> Located (Trail V2 n)

-- | Offset a Path with the default options and given radius. See
--   offsetPath'.
offsetPath :: RealFloat n => n -> Path V2 n -> Path V2 n

-- | Offset a Path by applying offsetTrail' to each trail in
--   the path.
offsetPath' :: RealFloat n => OffsetOpts n -> n -> Path V2 n -> Path V2 n

-- | Options for specifying how a Trail should be expanded.
data ExpandOpts d
ExpandOpts :: LineJoin -> d -> LineCap -> d -> ExpandOpts d
[_expandJoin] :: ExpandOpts d -> LineJoin
[_expandMiterLimit] :: ExpandOpts d -> d
[_expandCap] :: ExpandOpts d -> LineCap
[_expandEpsilon] :: ExpandOpts d -> d

-- | Specifies the style of join for between adjacent offset segments.
expandJoin :: Lens' (ExpandOpts d) LineJoin

-- | Specifies the miter limit for the join.
expandMiterLimit :: Lens' (ExpandOpts d) d

-- | Specifies how the ends are handled.
expandCap :: Lens' (ExpandOpts d) LineCap

-- | Epsilon perimeter for offsetSegment.
expandEpsilon :: Lens' (ExpandOpts d) d

-- | Expand a Trail with the given radius and default options. See
--   expandTrail'.
expandTrail :: RealFloat n => n -> Located (Trail V2 n) -> Path V2 n

-- | Expand a Trail with the given options and radius r
--   around a given Trail. Expanding can be thought of as generating
--   the loop that, when filled, represents stroking the trail with a
--   radius r brush.
--   
--   The cap styles applied to an outside corner can be seen here (with the
--   original trail in white and the result of expandTrail' filled
--   in green):
--   
--   
--   Loops result in a path with an inner and outer loop:
--   
expandTrail' :: (OrderedField n, RealFloat n, RealFrac n) => ExpandOpts n -> n -> Located (Trail V2 n) -> Path V2 n

-- | Expand a Path with the given radius and default options. See
--   expandPath'.
expandPath :: RealFloat n => n -> Path V2 n -> Path V2 n

-- | Expand a Path using expandTrail' on each trail in the
--   path.
expandPath' :: RealFloat n => ExpandOpts n -> n -> Path V2 n -> Path V2 n
instance GHC.Real.Fractional d => Data.Default.Class.Default (Diagrams.TwoD.Offset.ExpandOpts d)
instance GHC.Show.Show d => GHC.Show.Show (Diagrams.TwoD.Offset.ExpandOpts d)
instance GHC.Classes.Eq d => GHC.Classes.Eq (Diagrams.TwoD.Offset.ExpandOpts d)
instance GHC.Real.Fractional d => Data.Default.Class.Default (Diagrams.TwoD.Offset.OffsetOpts d)
instance GHC.Classes.Eq d => GHC.Classes.Eq (Diagrams.TwoD.Offset.OffsetOpts d)
instance GHC.Show.Show d => GHC.Show.Show (Diagrams.TwoD.Offset.OffsetOpts d)

-- | Importing external images into diagrams. Usage example: To create a
--   diagram from an embedded image with width 1 and height set according
--   to the aspect ratio, use image img # scaleUToX 1, where
--   img is a value of type DImage n e, created with a
--   function like loadImageEmb, loadImageExt, or
--   raster.
module Diagrams.TwoD.Image

-- | An image primitive, the two ints are width followed by height. Will
--   typically be created by loadImageEmb or loadImageExt
--   which, will handle setting the width and height to the actual width
--   and height of the image.
data DImage :: Type -> Type -> Type
[DImage] :: ImageData t -> Int -> Int -> Transformation V2 n -> DImage n t

-- | ImageData is either a JuicyPixels DynamicImage tagged
--   as Embedded or a reference tagged as External.
--   Additionally Native is provided for external libraries to hook
--   into.
data ImageData :: Type -> Type
[ImageRaster] :: DynamicImage -> ImageData Embedded
[ImageRef] :: FilePath -> ImageData External
[ImageNative] :: t -> ImageData (Native t)
data Embedded
data External
data Native (t :: Type)

-- | Make a DImage into a Diagram.
image :: (TypeableFloat n, Typeable a, Renderable (DImage n a) b) => DImage n a -> QDiagram b V2 n Any

-- | Read a JuicyPixels DynamicImage and wrap it in a
--   DImage. The width and height of the image are set to their
--   actual values.
embeddedImage :: Num n => DynamicImage -> DImage n Embedded

-- | Use JuicyPixels to read a file in any format and wrap it in a
--   DImage. The width and height of the image are set to their
--   actual values.
loadImageEmb :: Num n => FilePath -> IO (Either String (DImage n Embedded))

-- | A pure variant of loadImageEmb
loadImageEmbBS :: Num n => ByteString -> Either String (DImage n Embedded)

-- | Check that a file exists, and use JuicyPixels to figure out the right
--   size, but save a reference to the image instead of the raster data
loadImageExt :: Num n => FilePath -> IO (Either String (DImage n External))

-- | Make an "unchecked" image reference; have to specify a width and
--   height. Unless the aspect ratio of the external image is the w :: h,
--   then the image will be distorted.
uncheckedImageRef :: Num n => FilePath -> Int -> Int -> DImage n External

-- | Create an image "from scratch" by specifying the pixel data
raster :: Num n => (Int -> Int -> AlphaColour Double) -> Int -> Int -> DImage n Embedded

-- | Crate a diagram from raw raster data.
rasterDia :: (TypeableFloat n, Renderable (DImage n Embedded) b) => (Int -> Int -> AlphaColour Double) -> Int -> Int -> QDiagram b V2 n Any
instance GHC.Float.RealFloat n => Diagrams.Query.HasQuery (Diagrams.TwoD.Image.DImage n a) Data.Semigroup.Internal.Any
instance GHC.Real.Fractional n => Diagrams.Core.Transform.Transformable (Diagrams.TwoD.Image.DImage n a)
instance GHC.Real.Fractional n => Diagrams.Core.HasOrigin.HasOrigin (Diagrams.TwoD.Image.DImage n a)
instance GHC.Real.Fractional n => Diagrams.Core.Types.Renderable (Diagrams.TwoD.Image.DImage n a) Diagrams.Core.Types.NullBackend

-- | Diagrams may have attributes which affect the way they are
--   rendered. This module defines Textures (Gradients and Colors)
--   in two dimensions. Like the attributes defined in the
--   Diagrams.Attributes module, all attributes defined here use the
--   Last or Recommend semigroup structure.
--   FillColor and LineColor attributes are provided so
--   that backends that don't support gradients need not be concerned with
--   using textures. Backends should only implement color attributes or
--   textures attributes, not both.
module Diagrams.TwoD.Attributes

-- | A Texture is either a color SC, linear gradient LG, or
--   radial gradient RG. An object can have only one texture which
--   is determined by the Last semigroup structure.
data Texture n
SC :: SomeColor -> Texture n
LG :: LGradient n -> Texture n
RG :: RGradient n -> Texture n

-- | Convert a solid colour into a texture.
solid :: Color a => a -> Texture n
_SC :: forall n_a1Wn9. Prism' (Texture n_a1Wn9) SomeColor

-- | Prism onto an AlphaColour Double of a SC texture.
_AC :: Prism' (Texture n) (AlphaColour Double)
_LG :: forall n_a1Wn9. Prism' (Texture n_a1Wn9) (LGradient n_a1Wn9)
_RG :: forall n_a1Wn9. Prism' (Texture n_a1Wn9) (RGradient n_a1Wn9)

-- | A default is provided so that linear gradients can easily be created
--   using lenses. For example, lg = defaultLG & lGradStart .~
--   (0.25 ^& 0.33). Note that no default value is provided for
--   lGradStops, this must be set before the gradient value is
--   used, otherwise the object will appear transparent.
defaultLG :: Fractional n => Texture n

-- | A default is provided so that radial gradients can easily be created
--   using lenses. For example, rg = defaultRG & rGradRadius1 .~
--   0.25. Note that no default value is provided for
--   rGradStops, this must be set before the gradient value is
--   used, otherwise the object will appear transparent.
defaultRG :: Fractional n => Texture n

-- | A gradient stop contains a color and fraction (usually between 0 and
--   1)
data GradientStop d
GradientStop :: SomeColor -> d -> GradientStop d
[_stopColor] :: GradientStop d -> SomeColor
[_stopFraction] :: GradientStop d -> d

-- | A color for the stop.
stopColor :: Lens' (GradientStop n) SomeColor

-- | The fraction for stop.
stopFraction :: Lens' (GradientStop n) n

-- | A convenient function for making gradient stops from a list of
--   triples. (An opaque color, a stop fraction, an opacity).
mkStops :: [(Colour Double, d, Double)] -> [GradientStop d]

-- | The SpreadMethod determines what happens before
--   lGradStart and after lGradEnd. GradPad fills the
--   space before the start of the gradient with the color of the first
--   stop and the color after end of the gradient with the color of the
--   last stop. GradRepeat restarts the gradient and
--   GradReflect restarts the gradient with the stops in reverse
--   order.
data SpreadMethod
GradPad :: SpreadMethod
GradReflect :: SpreadMethod
GradRepeat :: SpreadMethod

-- | Apply a linear gradient.
lineLGradient :: (InSpace V2 n a, Typeable n, Floating n, HasStyle a) => LGradient n -> a -> a

-- | Apply a radial gradient.
lineRGradient :: (InSpace V2 n a, Typeable n, Floating n, HasStyle a) => RGradient n -> a -> a

-- | Linear Gradient
data LGradient n
LGradient :: [GradientStop n] -> Point V2 n -> Point V2 n -> Transformation V2 n -> SpreadMethod -> LGradient n
[_lGradStops] :: LGradient n -> [GradientStop n]
[_lGradStart] :: LGradient n -> Point V2 n
[_lGradEnd] :: LGradient n -> Point V2 n
[_lGradTrans] :: LGradient n -> Transformation V2 n
[_lGradSpreadMethod] :: LGradient n -> SpreadMethod

-- | A list of stops (colors and fractions).
lGradStops :: Lens' (LGradient n) [GradientStop n]

-- | A transformation to be applied to the gradient. Usually this field
--   will start as the identity transform and capture the transforms that
--   are applied to the gradient.
lGradTrans :: Lens' (LGradient n) (Transformation V2 n)

-- | The starting point for the first gradient stop. The coordinates are in
--   local units and the default is (-0.5, 0).
lGradStart :: Lens' (LGradient n) (Point V2 n)

-- | The ending point for the last gradient stop.The coordinates are in
--   local units and the default is (0.5, 0).
lGradEnd :: Lens' (LGradient n) (Point V2 n)

-- | For setting the spread method.
lGradSpreadMethod :: Lens' (LGradient n) SpreadMethod

-- | Make a linear gradient texture from a stop list, start point, end
--   point, and SpreadMethod. The lGradTrans field is set to
--   the identity transfrom, to change it use the lGradTrans lens.
mkLinearGradient :: Num n => [GradientStop n] -> Point V2 n -> Point V2 n -> SpreadMethod -> Texture n

-- | Radial Gradient
data RGradient n
RGradient :: [GradientStop n] -> Point V2 n -> n -> Point V2 n -> n -> Transformation V2 n -> SpreadMethod -> RGradient n
[_rGradStops] :: RGradient n -> [GradientStop n]
[_rGradCenter0] :: RGradient n -> Point V2 n
[_rGradRadius0] :: RGradient n -> n
[_rGradCenter1] :: RGradient n -> Point V2 n
[_rGradRadius1] :: RGradient n -> n
[_rGradTrans] :: RGradient n -> Transformation V2 n
[_rGradSpreadMethod] :: RGradient n -> SpreadMethod

-- | A list of stops (colors and fractions).
rGradStops :: Lens' (RGradient n) [GradientStop n]

-- | A transformation to be applied to the gradient. Usually this field
--   will start as the identity transform and capture the transforms that
--   are applied to the gradient.
rGradTrans :: Lens' (RGradient n) (Transformation V2 n)

-- | The center point of the inner circle.
rGradCenter0 :: Lens' (RGradient n) (Point V2 n)

-- | The radius of the inner cirlce in local coordinates.
rGradRadius0 :: Lens' (RGradient n) n

-- | The center of the outer circle.
rGradCenter1 :: Lens' (RGradient n) (Point V2 n)

-- | The radius of the outer circle in local coordinates.
rGradRadius1 :: Lens' (RGradient n) n

-- | For setting the spread method.
rGradSpreadMethod :: Lens' (RGradient n) SpreadMethod

-- | Make a radial gradient texture from a stop list, radius, start point,
--   end point, and SpreadMethod. The rGradTrans field is set
--   to the identity transfrom, to change it use the rGradTrans
--   lens.
mkRadialGradient :: Num n => [GradientStop n] -> Point V2 n -> n -> Point V2 n -> n -> SpreadMethod -> Texture n

-- | The texture with which lines are drawn. Note that child textures
--   always override parent textures. More precisely, the semigroup
--   structure on line texture attributes is that of Last.
newtype LineTexture n
LineTexture :: Last (Texture n) -> LineTexture n
_LineTexture :: Iso (LineTexture n) (LineTexture n') (Texture n) (Texture n')
getLineTexture :: LineTexture n -> Texture n
lineTexture :: (InSpace V2 n a, Typeable n, Floating n, HasStyle a) => Texture n -> a -> a
lineTextureA :: (InSpace V2 n a, Typeable n, Floating n, HasStyle a) => LineTexture n -> a -> a
mkLineTexture :: Texture n -> LineTexture n
_lineTexture :: (Floating n, Typeable n) => Lens' (Style V2 n) (Texture n)

-- | Set the line (stroke) color. This function is polymorphic in the color
--   type (so it can be used with either Colour or
--   AlphaColour), but this can sometimes create problems for type
--   inference, so the lc and lcA variants are provided with
--   more concrete types.
lineColor :: (InSpace V2 n a, Color c, Typeable n, Floating n, HasStyle a) => c -> a -> a

-- | A synonym for lineColor, specialized to Colour
--   Double (i.e. opaque colors). See comment in lineColor
--   about backends.
lc :: (InSpace V2 n a, Typeable n, Floating n, HasStyle a) => Colour Double -> a -> a

-- | A synonym for lineColor, specialized to AlphaColour
--   Double (i.e. colors with transparency). See comment in
--   lineColor about backends.
lcA :: (InSpace V2 n a, Typeable n, Floating n, HasStyle a) => AlphaColour Double -> a -> a

-- | The texture with which objects are filled. The semigroup structure on
--   fill texture attributes is that of 'Recommed . Last'.
newtype FillTexture n
FillTexture :: Recommend (Last (Texture n)) -> FillTexture n
_FillTexture :: Iso' (FillTexture n) (Recommend (Texture n))
getFillTexture :: FillTexture n -> Texture n
fillTexture :: (InSpace V2 n a, Typeable n, Floating n, HasStyle a) => Texture n -> a -> a
mkFillTexture :: Texture n -> FillTexture n

-- | Commit a fill texture in a style. This is not a valid setter
--   because it doesn't abide the functor law (see committed).
_fillTexture :: (Typeable n, Floating n) => Lens' (Style V2 n) (Texture n)

-- | Lens onto the Recommend of a fill texture in a style.
_fillTextureR :: (Typeable n, Floating n) => Lens' (Style V2 n) (Recommend (Texture n))

-- | Set the fill color. This function is polymorphic in the color type (so
--   it can be used with either Colour or AlphaColour), but
--   this can sometimes create problems for type inference, so the
--   fc and fcA variants are provided with more concrete
--   types.
fillColor :: (InSpace V2 n a, Color c, Typeable n, Floating n, HasStyle a) => c -> a -> a

-- | A synonym for fillColor, specialized to Colour
--   Double (i.e. opaque colors). See comment after fillColor
--   about backends.
fc :: (InSpace V2 n a, Floating n, Typeable n, HasStyle a) => Colour Double -> a -> a

-- | A synonym for fillColor, specialized to AlphaColour
--   Double (i.e. colors with transparency). See comment after
--   fillColor about backends.
fcA :: (InSpace V2 n a, Floating n, Typeable n, HasStyle a) => AlphaColour Double -> a -> a

-- | Set a "recommended" fill color, to be used only if no explicit calls
--   to fillColor (or fc, or fcA) are used. See
--   comment after fillColor about backends.
recommendFillColor :: (InSpace V2 n a, Color c, Typeable n, Floating n, HasStyle a) => c -> a -> a

-- | Push fill attributes down until they are at the root of subtrees
--   containing only loops. This makes life much easier for backends, which
--   typically have a semantics where fill attributes are applied to
--   linesnon-closed paths as well as loopsclosed paths, whereas in
--   the semantics of diagrams, fill attributes only apply to loops.
splitTextureFills :: forall b v n a. Typeable n => RTree b v n a -> RTree b v n a
instance GHC.Base.Semigroup (Diagrams.TwoD.Attributes.LineTexture n)
instance GHC.Base.Semigroup (Diagrams.TwoD.Attributes.FillTexture n)
instance Data.Typeable.Internal.Typeable n => Diagrams.Attributes.Compile.SplitAttribute (Diagrams.TwoD.Attributes.FillTextureLoops n)
instance Data.Typeable.Internal.Typeable n => Diagrams.Core.Style.AttributeClass (Diagrams.TwoD.Attributes.FillTexture n)
instance GHC.Float.Floating n => Diagrams.Core.Transform.Transformable (Diagrams.TwoD.Attributes.FillTexture n)
instance Data.Default.Class.Default (Diagrams.TwoD.Attributes.FillTexture n)
instance Data.Typeable.Internal.Typeable n => Diagrams.Core.Style.AttributeClass (Diagrams.TwoD.Attributes.LineTexture n)
instance GHC.Float.Floating n => Diagrams.Core.Transform.Transformable (Diagrams.TwoD.Attributes.LineTexture n)
instance Data.Default.Class.Default (Diagrams.TwoD.Attributes.LineTexture n)
instance GHC.Float.Floating n => Diagrams.Core.Transform.Transformable (Diagrams.TwoD.Attributes.Texture n)
instance GHC.Real.Fractional n => Diagrams.Core.Transform.Transformable (Diagrams.TwoD.Attributes.RGradient n)
instance GHC.Real.Fractional n => Diagrams.Core.Transform.Transformable (Diagrams.TwoD.Attributes.LGradient n)

-- | Very basic text primitives along with associated attributes.
module Diagrams.TwoD.Text

-- | A Text primitive consists of the string contents, text
--   alignment and the transformation to be applied. The transformation is
--   scale invarient, the average scale of the transform should always be
--   1. All text scaling is obtained from the FontSize attribute.
--   
--   This constructor should not be used directly. Use text,
--   alignedText or baselineText.
data Text n
Text :: T2 n -> TextAlignment n -> String -> Text n

-- | TextAlignment specifies the alignment of the text's origin.
data TextAlignment n
BaselineText :: TextAlignment n
BoxAlignedText :: n -> n -> TextAlignment n

-- | Create a primitive text diagram from the given string, with center
--   alignment, equivalent to alignedText 0.5 0.5.
--   
--   Note that it takes up no space, as text size information is not
--   available.
text :: (TypeableFloat n, Renderable (Text n) b) => String -> QDiagram b V2 n Any

-- | Create a primitive text diagram from the given string, origin at the
--   top left corner of the text's bounding box, equivalent to
--   alignedText 0 1.
--   
--   Note that it takes up no space.
topLeftText :: (TypeableFloat n, Renderable (Text n) b) => String -> QDiagram b V2 n Any

-- | Create a primitive text diagram from the given string, with the origin
--   set to a point interpolated within the bounding box. The first
--   parameter varies from 0 (left) to 1 (right), and the second parameter
--   from 0 (bottom) to 1 (top). Some backends do not implement this and
--   instead snap to closest corner or the center.
--   
--   The height of this box is determined by the font's potential ascent
--   and descent, rather than the height of the particular string.
--   
--   Note that it takes up no space.
alignedText :: (TypeableFloat n, Renderable (Text n) b) => n -> n -> String -> QDiagram b V2 n Any

-- | Create a primitive text diagram from the given string, with the origin
--   set to be on the baseline, at the beginning (although not bounding).
--   This is the reference point of showText in the Cairo graphics library.
--   
--   Note that it takes up no space.
baselineText :: (TypeableFloat n, Renderable (Text n) b) => String -> QDiagram b V2 n Any

-- | Make a text from a TextAlignment, recommending a fill colour of
--   black and fontSize of local 1.
mkText :: (TypeableFloat n, Renderable (Text n) b) => TextAlignment n -> String -> QDiagram b V2 n Any

-- | Make a text from a TextAlignment without any default size or
--   fill colour. This is useful is you want to recommend your own using
--   recommendFillColor or recommendFontSize.
mkText' :: (TypeableFloat n, Renderable (Text n) b) => TextAlignment n -> String -> QDiagram b V2 n Any

-- | The Font attribute specifies the name of a font family. Inner
--   Font attributes override outer ones.
newtype Font
Font :: Last String -> Font
_Font :: Iso' Font String

-- | Extract the font family name from a Font attribute.
getFont :: Font -> String

-- | Specify a font family to be used for all text within a diagram.
font :: HasStyle a => String -> a -> a

-- | Lens onto the font name of a style.
_font :: Lens' (Style v n) (Maybe String)

-- | The FontSize attribute specifies the size of a font's
--   em-square. Inner FontSize attributes override outer ones.
newtype FontSize n
FontSize :: Recommend (Last n) -> FontSize n
_FontSize :: Iso' (FontSize n) (Recommend n)

-- | Set the font size, that is, the size of the font's em-square as
--   measured within the current local vector space. The default size is
--   local 1 (which is applied by recommendFontSize).
fontSize :: (N a ~ n, Typeable n, HasStyle a) => Measure n -> a -> a

-- | Recommend a font size. Any use of fontSize above this
--   will overwrite any recommended size. This should only be used with
--   mkText', other text functions already has a recommended font
--   size so this will be ignored.
recommendFontSize :: (N a ~ n, Typeable n, HasStyle a) => Measure n -> a -> a

-- | A convenient synonym for 'fontSize (Normalized w)'.
fontSizeN :: (N a ~ n, Typeable n, Num n, HasStyle a) => n -> a -> a

-- | A convenient synonym for 'fontSize (Output w)'.
fontSizeO :: (N a ~ n, Typeable n, HasStyle a) => n -> a -> a

-- | A convenient sysnonym for 'fontSize (Local w)'.
fontSizeL :: (N a ~ n, Typeable n, Num n, HasStyle a) => n -> a -> a

-- | A convenient synonym for 'fontSize (Global w)'.
fontSizeG :: (N a ~ n, Typeable n, Num n, HasStyle a) => n -> a -> a

-- | Extract the size from a FontSize attribute.
getFontSize :: FontSize n -> n

-- | Apply a FontSize attribute.
fontSizeM :: (N a ~ n, Typeable n, HasStyle a) => FontSizeM n -> a -> a
_fontSizeR :: (Typeable n, OrderedField n) => Lens' (Style v n) (Measured n (Recommend n))

-- | Lens to commit a font size. This is *not* a valid lens (see
--   commited.
_fontSize :: (Typeable n, OrderedField n) => Lens' (Style v n) (Measure n)
_fontSizeU :: Typeable n => Lens' (Style v n) (Maybe n)

-- | The FontSlantA attribute specifies the slant (normal, italic,
--   or oblique) that should be used for all text within a diagram. Inner
--   FontSlantA attributes override outer ones.
data FontSlant
FontSlantNormal :: FontSlant
FontSlantItalic :: FontSlant
FontSlantOblique :: FontSlant

-- | Extract the font slant from a FontSlantA attribute.
getFontSlant :: FontSlant -> FontSlant

-- | Specify the slant (normal, italic, or oblique) that should be used for
--   all text within a diagram. See also italic and oblique
--   for useful special cases.
fontSlant :: HasStyle a => FontSlant -> a -> a

-- | Set all text in italics.
italic :: HasStyle a => a -> a

-- | Set all text using an oblique slant.
oblique :: HasStyle a => a -> a

-- | Lens onto the font slant in a style.
_fontSlant :: Lens' (Style v n) FontSlant

-- | The FontWeightA attribute specifies the weight (normal or
--   bold) that should be used for all text within a diagram. Inner
--   FontWeightA attributes override outer ones.
data FontWeight
FontWeightNormal :: FontWeight
FontWeightBold :: FontWeight
FontWeightBolder :: FontWeight
FontWeightLighter :: FontWeight
FontWeightThin :: FontWeight
FontWeightUltraLight :: FontWeight
FontWeightLight :: FontWeight
FontWeightMedium :: FontWeight
FontWeightSemiBold :: FontWeight
FontWeightUltraBold :: FontWeight
FontWeightHeavy :: FontWeight

-- | Extract the font weight.
getFontWeight :: FontWeight -> FontWeight

-- | Specify the weight (normal, bolder, lighter or bold) that should be
--   used for all text within a diagram. See also bold for a useful
--   special case.
fontWeight :: HasStyle a => FontWeight -> a -> a

-- | Set all text using a bold font weight.
bold :: HasStyle a => a -> a

-- | Set all text to be bolder than the inherited font weight.
bolder :: HasStyle a => a -> a

-- | Set all text to be lighter than the inherited font weight.
lighter :: HasStyle a => a -> a

-- | Lens onto the font weight in a style.
_fontWeight :: Lens' (Style v n) FontWeight

-- | Set all text using a thin font weight.
thinWeight :: HasStyle a => a -> a

-- | Set all text using a extra light font weight.
ultraLight :: HasStyle a => a -> a

-- | Set all text using a light font weight.
light :: HasStyle a => a -> a

-- | Set all text using a medium font weight.
mediumWeight :: HasStyle a => a -> a

-- | Set all text using a heavy/black font weight.
heavy :: HasStyle a => a -> a

-- | Set all text using a semi-bold font weight.
semiBold :: HasStyle a => a -> a

-- | Set all text using an ultra-bold font weight.
ultraBold :: HasStyle a => a -> a
instance GHC.Classes.Eq Diagrams.TwoD.Text.Font
instance GHC.Base.Semigroup Diagrams.TwoD.Text.Font
instance GHC.Base.Semigroup (Diagrams.TwoD.Text.FontSize n)
instance GHC.Classes.Ord Diagrams.TwoD.Text.FontSlant
instance GHC.Show.Show Diagrams.TwoD.Text.FontSlant
instance GHC.Classes.Eq Diagrams.TwoD.Text.FontSlant
instance GHC.Show.Show Diagrams.TwoD.Text.FontWeight
instance GHC.Classes.Ord Diagrams.TwoD.Text.FontWeight
instance GHC.Classes.Eq Diagrams.TwoD.Text.FontWeight
instance Diagrams.Core.Style.AttributeClass Diagrams.TwoD.Text.FontWeight
instance GHC.Base.Semigroup Diagrams.TwoD.Text.FontWeight
instance Data.Default.Class.Default Diagrams.TwoD.Text.FontWeight
instance Diagrams.Core.Style.AttributeClass Diagrams.TwoD.Text.FontSlant
instance GHC.Base.Semigroup Diagrams.TwoD.Text.FontSlant
instance Data.Default.Class.Default Diagrams.TwoD.Text.FontSlant
instance GHC.Num.Num n => Data.Default.Class.Default (Diagrams.TwoD.Text.FontSizeM n)
instance GHC.Base.Functor Diagrams.TwoD.Text.FontSize
instance Data.Typeable.Internal.Typeable n => Diagrams.Core.Style.AttributeClass (Diagrams.TwoD.Text.FontSize n)
instance Diagrams.Core.Style.AttributeClass Diagrams.TwoD.Text.Font
instance GHC.Float.Floating n => Diagrams.Core.Transform.Transformable (Diagrams.TwoD.Text.Text n)
instance GHC.Float.Floating n => Diagrams.Core.HasOrigin.HasOrigin (Diagrams.TwoD.Text.Text n)
instance GHC.Float.Floating n => Diagrams.Core.Types.Renderable (Diagrams.TwoD.Text.Text n) Diagrams.Core.Types.NullBackend

-- | Standard arrowheads and tails. Each arrowhead or tail is designed to
--   be drawn filled, with a line width of 0, and is normalized to fit
--   inside a circle of diameter 1.
module Diagrams.TwoD.Arrowheads

tri :: RealFloat n => ArrowHT n

dart :: RealFloat n => ArrowHT n

halfDart :: RealFloat n => ArrowHT n

spike :: RealFloat n => ArrowHT n

thorn :: RealFloat n => ArrowHT n

-- | A line the same width as the shaft.
lineHead :: RealFloat n => ArrowHT n
noHead :: ArrowHT n

-- | Isoceles triangle style. The above example specifies an angle of `2/5
--   Turn`.
--   
arrowheadTriangle :: RealFloat n => Angle n -> ArrowHT n

-- | Isoceles triangle with linear concave base. Inkscape type 1 - dart
--   like.
arrowheadDart :: RealFloat n => Angle n -> ArrowHT n

-- | Top half of an arrowheadDart.
arrowheadHalfDart :: RealFloat n => Angle n -> ArrowHT n

-- | Isoceles triangle with curved concave base. Inkscape type 2.
arrowheadSpike :: RealFloat n => Angle n -> ArrowHT n

-- | Curved sides, linear concave base. Illustrator CS5 #3
arrowheadThorn :: RealFloat n => Angle n -> ArrowHT n

tri' :: RealFloat n => ArrowHT n

dart' :: RealFloat n => ArrowHT n

halfDart' :: RealFloat n => ArrowHT n

spike' :: RealFloat n => ArrowHT n

thorn' :: RealFloat n => ArrowHT n

-- | A line the same width as the shaft.
lineTail :: RealFloat n => ArrowHT n
noTail :: ArrowHT n

quill :: (Floating n, Ord n) => ArrowHT n

block :: RealFloat n => ArrowHT n

-- | The angle is where the top left corner intersects the circle.
arrowtailQuill :: OrderedField n => Angle n -> ArrowHT n
arrowtailBlock :: forall n. RealFloat n => Angle n -> ArrowHT n
type ArrowHT n = n -> n -> (Path V2 n, Path V2 n)

-- | Drawing arrows in two dimensions. For a tutorial on drawing arrows
--   using this module, see the diagrams website:
--   https://diagrams.github.io/doc/arrow.html.
module Diagrams.TwoD.Arrow

-- | arrowV v creates an arrow with the direction and norm of the
--   vector v (with its tail at the origin), using default
--   parameters.
arrowV :: (TypeableFloat n, Renderable (Path V2 n) b) => V2 n -> QDiagram b V2 n Any

-- | arrowV' v creates an arrow with the direction and norm of the
--   vector v (with its tail at the origin).
arrowV' :: (TypeableFloat n, Renderable (Path V2 n) b) => ArrowOpts n -> V2 n -> QDiagram b V2 n Any

-- | Create an arrow starting at s with length and direction determined by
--   the vector v.
arrowAt :: (TypeableFloat n, Renderable (Path V2 n) b) => Point V2 n -> V2 n -> QDiagram b V2 n Any
arrowAt' :: (TypeableFloat n, Renderable (Path V2 n) b) => ArrowOpts n -> Point V2 n -> V2 n -> QDiagram b V2 n Any

-- | arrowBetween s e creates an arrow pointing from s to
--   e with default parameters.
arrowBetween :: (TypeableFloat n, Renderable (Path V2 n) b) => Point V2 n -> Point V2 n -> QDiagram b V2 n Any

-- | arrowBetween' opts s e creates an arrow pointing from
--   s to e using the given options. In particular, it
--   scales and rotates arrowShaft to go between s and
--   e, taking head, tail, and gaps into account.
arrowBetween' :: (TypeableFloat n, Renderable (Path V2 n) b) => ArrowOpts n -> Point V2 n -> Point V2 n -> QDiagram b V2 n Any

-- | Connect two diagrams with a straight arrow.
connect :: (TypeableFloat n, Renderable (Path V2 n) b, IsName n1, IsName n2) => n1 -> n2 -> QDiagram b V2 n Any -> QDiagram b V2 n Any

-- | Connect two diagrams with an arbitrary arrow.
connect' :: (TypeableFloat n, Renderable (Path V2 n) b, IsName n1, IsName n2) => ArrowOpts n -> n1 -> n2 -> QDiagram b V2 n Any -> QDiagram b V2 n Any

-- | Connect two diagrams at point on the perimeter of the diagrams,
--   choosen by angle.
connectPerim :: (TypeableFloat n, Renderable (Path V2 n) b, IsName n1, IsName n2) => n1 -> n2 -> Angle n -> Angle n -> QDiagram b V2 n Any -> QDiagram b V2 n Any
connectPerim' :: (TypeableFloat n, Renderable (Path V2 n) b, IsName n1, IsName n2) => ArrowOpts n -> n1 -> n2 -> Angle n -> Angle n -> QDiagram b V2 n Any -> QDiagram b V2 n Any

-- | Draw an arrow from diagram named "n1" to diagram named "n2". The arrow
--   lies on the line between the centres of the diagrams, but is drawn so
--   that it stops at the boundaries of the diagrams, using traces to find
--   the intersection points.
connectOutside :: (TypeableFloat n, Renderable (Path V2 n) b, IsName n1, IsName n2) => n1 -> n2 -> QDiagram b V2 n Any -> QDiagram b V2 n Any
connectOutside' :: (TypeableFloat n, Renderable (Path V2 n) b, IsName n1, IsName n2) => ArrowOpts n -> n1 -> n2 -> QDiagram b V2 n Any -> QDiagram b V2 n Any

-- | arrow len creates an arrow of length len with
--   default parameters, starting at the origin and ending at the point
--   (len,0).
arrow :: (TypeableFloat n, Renderable (Path V2 n) b) => n -> QDiagram b V2 n Any

-- | arrow' opts len creates an arrow of length len using
--   the given options, starting at the origin and ending at the point
--   (len,0). In particular, it scales the given arrowShaft
--   so that the entire arrow has length len.
arrow' :: (TypeableFloat n, Renderable (Path V2 n) b) => ArrowOpts n -> n -> QDiagram b V2 n Any

-- | Turn a located trail into a default arrow by putting an arrowhead at
--   the end of the trail.
arrowFromLocatedTrail :: (Renderable (Path V2 n) b, RealFloat n, Typeable n) => Located (Trail V2 n) -> QDiagram b V2 n Any

-- | Turn a located trail into an arrow using the given options.
arrowFromLocatedTrail' :: (Renderable (Path V2 n) b, RealFloat n, Typeable n) => ArrowOpts n -> Located (Trail V2 n) -> QDiagram b V2 n Any
data ArrowOpts n
ArrowOpts :: ArrowHT n -> ArrowHT n -> Trail V2 n -> Measure n -> Measure n -> Style V2 n -> Measure n -> Style V2 n -> Measure n -> Style V2 n -> ArrowOpts n
[_arrowHead] :: ArrowOpts n -> ArrowHT n
[_arrowTail] :: ArrowOpts n -> ArrowHT n
[_arrowShaft] :: ArrowOpts n -> Trail V2 n
[_headGap] :: ArrowOpts n -> Measure n
[_tailGap] :: ArrowOpts n -> Measure n
[_headStyle] :: ArrowOpts n -> Style V2 n
[_headLength] :: ArrowOpts n -> Measure n
[_tailStyle] :: ArrowOpts n -> Style V2 n
[_tailLength] :: ArrowOpts n -> Measure n
[_shaftStyle] :: ArrowOpts n -> Style V2 n

-- | A shape to place at the head of the arrow.
arrowHead :: Lens' (ArrowOpts n) (ArrowHT n)

-- | A shape to place at the tail of the arrow.
arrowTail :: Lens' (ArrowOpts n) (ArrowHT n)

-- | The trail to use for the arrow shaft.
arrowShaft :: Lens' (ArrowOpts n) (Trail V2 n)

-- | Distance to leave between the head and the target point.
headGap :: Lens' (ArrowOpts n) (Measure n)

-- | Distance to leave between the starting point and the tail.
tailGap :: Lens' (ArrowOpts n) (Measure n)

-- | Set both the headGap and tailGap simultaneously.
gaps :: Traversal' (ArrowOpts n) (Measure n)

-- | Same as gaps, provided for backward compatiiblity.
gap :: Traversal' (ArrowOpts n) (Measure n)

-- | A lens for setting or modifying the texture of an arrowhead. For
--   example, one may write ... (with & headTexture .~ grad)
--   to get an arrow with a head filled with a gradient, assuming grad has
--   been defined. Or ... (with & headTexture .~ solid blue to
--   set the head color to blue. For more general control over the style of
--   arrowheads, see headStyle.
headTexture :: TypeableFloat n => Lens' (ArrowOpts n) (Texture n)

-- | Style to apply to the head. headStyle is modified by using
--   the lens combinator %~ to change the current style. For
--   example, to change an opaque black arrowhead to translucent orange:
--   (with & headStyle %~ fc orange . opacity 0.75).
headStyle :: Lens' (ArrowOpts n) (Style V2 n)

-- | The length from the start of the joint to the tip of the head.
headLength :: Lens' (ArrowOpts n) (Measure n)

-- | A lens for setting or modifying the texture of an arrow tail. This is
--   *not* a valid lens (see committed).
tailTexture :: TypeableFloat n => Lens' (ArrowOpts n) (Texture n)

-- | Style to apply to the tail. See headStyle.
tailStyle :: Lens' (ArrowOpts n) (Style V2 n)

-- | The length of the tail plus its joint.
tailLength :: Lens' (ArrowOpts n) (Measure n)

-- | Set both the headLength and tailLength
--   simultaneously.
lengths :: Traversal' (ArrowOpts n) (Measure n)

-- | A lens for setting or modifying the texture of an arrow shaft.
shaftTexture :: TypeableFloat n => Lens' (ArrowOpts n) (Texture n)

-- | Style to apply to the shaft. See headStyle.
shaftStyle :: Lens' (ArrowOpts n) (Style V2 n)

-- | Straight line arrow shaft.
straightShaft :: OrderedField n => Trail V2 n
instance Diagrams.Core.Types.TypeableFloat n => Data.Default.Class.Default (Diagrams.TwoD.Arrow.ArrowOpts n)

-- | Linear maps. Unlike Transformations these are not restricted to
--   the same space. In practice these are used for projections in
--   Diagrams.ThreeD.Projection. Unless you want to work with
--   projections you're probably better off using Transform.
--   
--   Currently only path-like things can be projected. In the future we
--   hope to support projecting diagrams.
module Diagrams.LinearMap

-- | Type for holding linear maps. Note that these are not affine
--   transforms so attemping apply a translation with LinearMap will
--   likely produce incorrect results.
newtype LinearMap v u n
LinearMap :: (v n -> u n) -> LinearMap v u n
[lapply] :: LinearMap v u n -> v n -> u n

-- | Class of things that have vectors that can be mapped over.
class LinearMappable a b

-- | Apply a linear map to an object. If the map is not linear, behaviour
--   will likely be wrong.
vmap :: LinearMappable a b => (Vn a -> Vn b) -> a -> b

-- | Apply a linear map.
linmap :: (InSpace v n a, LinearMappable a b, N b ~ n) => LinearMap v (V b) n -> a -> b

-- | Affine linear maps. Unlike Transformation these do not have to
--   be invertible so we can map between spaces.
data AffineMap v u n
AffineMap :: LinearMap v u n -> u n -> AffineMap v u n
class (LinearMappable a b, N a ~ N b) => AffineMappable a b

-- | Affine map over an object. Has a default implimentation of only
--   applying the linear map
amap :: (AffineMappable a b, Additive (V a), Foldable (V a), Additive (V b), Num (N b)) => AffineMap (V a) (V b) (N b) -> a -> b

-- | Make an affine map from a linear function and a translation.
mkAffineMap :: (v n -> u n) -> u n -> AffineMap v u n
toAffineMap :: Transformation v n -> AffineMap v v n
instance (r GHC.Types.~ Diagrams.Segment.Offset c u n) => Diagrams.LinearMap.AffineMappable (Diagrams.Segment.Offset c v n) r
instance (r GHC.Types.~ Diagrams.Segment.Segment c u n) => Diagrams.LinearMap.AffineMappable (Diagrams.Segment.Segment c v n) r
instance (Linear.Metric.Metric v, Linear.Metric.Metric u, Diagrams.Core.Envelope.OrderedField n, r GHC.Types.~ Diagrams.Trail.SegTree u n) => Diagrams.LinearMap.AffineMappable (Diagrams.Trail.SegTree v n) r
instance (Linear.Metric.Metric v, Linear.Metric.Metric u, Diagrams.Core.Envelope.OrderedField n, r GHC.Types.~ Diagrams.Trail.Trail' l u n) => Diagrams.LinearMap.AffineMappable (Diagrams.Trail.Trail' l v n) r
instance (Linear.Metric.Metric v, Linear.Metric.Metric u, Diagrams.Core.Envelope.OrderedField n, r GHC.Types.~ Diagrams.Trail.Trail u n) => Diagrams.LinearMap.AffineMappable (Diagrams.Trail.Trail v n) r
instance (Linear.Vector.Additive v, GHC.Num.Num n, r GHC.Types.~ Linear.Affine.Point u n) => Diagrams.LinearMap.AffineMappable (Linear.Affine.Point v n) r
instance (r GHC.Types.~ Diagrams.Segment.FixedSegment u n) => Diagrams.LinearMap.AffineMappable (Diagrams.Segment.FixedSegment v n) r
instance (Diagrams.LinearMap.LinearMappable a b, Diagrams.Core.V.N a GHC.Types.~ Diagrams.Core.V.N b, r GHC.Types.~ Diagrams.Located.Located b) => Diagrams.LinearMap.AffineMappable (Diagrams.Located.Located a) r
instance (Linear.Metric.Metric v, Linear.Metric.Metric u, Diagrams.Core.Envelope.OrderedField n, r GHC.Types.~ Diagrams.Path.Path u n) => Diagrams.LinearMap.AffineMappable (Diagrams.Path.Path v n) r
instance (r GHC.Types.~ Diagrams.Segment.Offset c u m) => Diagrams.LinearMap.LinearMappable (Diagrams.Segment.Offset c v n) r
instance (r GHC.Types.~ Diagrams.Segment.Segment c u m) => Diagrams.LinearMap.LinearMappable (Diagrams.Segment.Segment c v n) r
instance (Linear.Metric.Metric v, Linear.Metric.Metric u, Diagrams.Core.Envelope.OrderedField n, Diagrams.Core.Envelope.OrderedField m, r GHC.Types.~ Diagrams.Trail.SegTree u m) => Diagrams.LinearMap.LinearMappable (Diagrams.Trail.SegTree v n) r
instance (Linear.Metric.Metric v, Linear.Metric.Metric u, Diagrams.Core.Envelope.OrderedField n, Diagrams.Core.Envelope.OrderedField m, r GHC.Types.~ Diagrams.Trail.Trail' l u m) => Diagrams.LinearMap.LinearMappable (Diagrams.Trail.Trail' l v n) r
instance (Linear.Metric.Metric v, Linear.Metric.Metric u, Diagrams.Core.Envelope.OrderedField n, Diagrams.Core.Envelope.OrderedField m, r GHC.Types.~ Diagrams.Trail.Trail u m) => Diagrams.LinearMap.LinearMappable (Diagrams.Trail.Trail v n) r
instance Diagrams.LinearMap.LinearMappable (Linear.Affine.Point v n) (Linear.Affine.Point u m)
instance (r GHC.Types.~ Diagrams.Segment.FixedSegment u m) => Diagrams.LinearMap.LinearMappable (Diagrams.Segment.FixedSegment v n) r
instance (Diagrams.LinearMap.LinearMappable a b, r GHC.Types.~ Diagrams.Located.Located b) => Diagrams.LinearMap.LinearMappable (Diagrams.Located.Located a) r
instance (Linear.Metric.Metric v, Linear.Metric.Metric u, Diagrams.Core.Envelope.OrderedField n, Diagrams.Core.Envelope.OrderedField m, r GHC.Types.~ Diagrams.Path.Path u m) => Diagrams.LinearMap.LinearMappable (Diagrams.Path.Path v n) r

module Diagrams.Deform

-- | Deformations are a superset of the affine transformations
--   represented by the Transformation type. In general they are not
--   invertible. Deformations include projective transformations.
--   Deformation can represent other functions from points to
--   points which are "well-behaved", in that they do not introduce small
--   wiggles.
newtype Deformation v u n
Deformation :: (Point v n -> Point u n) -> Deformation v u n
class Deformable a b

-- | deform' epsilon d a transforms a by the deformation
--   d. If the type of a is not closed under projection,
--   approximate to accuracy epsilon.
deform' :: Deformable a b => N a -> Deformation (V a) (V b) (N a) -> a -> b

-- | deform d a transforms a by the deformation
--   d. If the type of a is not closed under projection,
--   deform should call deform' with some reasonable
--   default value of epsilon.
deform :: Deformable a b => Deformation (V a) (V b) (N a) -> a -> b

-- | asDeformation converts a Transformation to a
--   Deformation by discarding the inverse transform. This allows
--   reusing Transformations in the construction of
--   Deformations.
asDeformation :: (Additive v, Num n) => Transformation v n -> Deformation v v n
instance (r GHC.Types.~ Linear.Affine.Point u n) => Diagrams.Deform.Deformable (Linear.Affine.Point v n) r
instance (Linear.Metric.Metric v, Linear.Metric.Metric u, Diagrams.Core.Envelope.OrderedField n, r GHC.Types.~ Diagrams.Located.Located (Diagrams.Trail.Trail u n)) => Diagrams.Deform.Deformable (Diagrams.Located.Located (Diagrams.Trail.Trail v n)) r
instance (Linear.Metric.Metric v, Linear.Metric.Metric u, Diagrams.Core.Envelope.OrderedField n, r GHC.Types.~ Diagrams.Path.Path u n) => Diagrams.Deform.Deformable (Diagrams.Path.Path v n) r
instance GHC.Base.Semigroup (Diagrams.Deform.Deformation v v n)
instance GHC.Base.Monoid (Diagrams.Deform.Deformation v v n)

module Diagrams.TwoD.Deform

-- | The parallel projection onto the plane x=0
parallelX0 :: (R1 v, Num n) => Deformation v v n

-- | The perspective division onto the plane x=1 along lines going through
--   the origin.
perspectiveX1 :: (R1 v, Functor v, Fractional n) => Deformation v v n

-- | The parallel projection onto the plane y=0
parallelY0 :: (R2 v, Num n) => Deformation v v n

-- | The perspective division onto the plane y=1 along lines going through
--   the origin.
perspectiveY1 :: (R2 v, Functor v, Floating n) => Deformation v v n

-- | The viewing transform for a viewer facing along the positive X axis. X
--   coördinates stay fixed, while Y coördinates are compressed with
--   increasing distance. asDeformation (translation unitX) <>
--   parallelX0 <> frustrumX = perspectiveX1
facingX :: (R1 v, Functor v, Fractional n) => Deformation v v n
facingY :: (R2 v, Functor v, Fractional n) => Deformation v v n

-- | 3D projections are a way of viewing a three-dimensional objects on a
--   two-dimensional plane.
--   
--   This module can be used with the functions in
--   Linear.Projection.
--   
--   Disclaimer: This module should be considered experimental and is
--   likely to change.
module Diagrams.ThreeD.Projection

-- | Look at the xy-plane with y as the up direction.
facingXY :: (Epsilon n, Floating n) => AffineMap V3 V2 n

-- | Look at the xz-plane with z as the up direction.
facingXZ :: (Epsilon n, Floating n) => AffineMap V3 V2 n

-- | Look at the yz-plane with z as the up direction.
facingYZ :: (Epsilon n, Floating n) => AffineMap V3 V2 n

-- | Apply an isometric projection given the up direction
isometricApply :: (InSpace V3 n a, InSpace V2 n b, AffineMappable a b, Floating n, Epsilon n) => Direction V3 n -> a -> b

-- | Make an isometric affine map with the given up direction.
isometric :: (Floating n, Epsilon n) => Direction V3 n -> AffineMap V3 V2 n
lookingAt :: (Epsilon n, Floating n) => P3 n -> P3 n -> Direction V3 n -> AffineMap V3 V2 n

-- | Apply the affine part of a homogeneous matrix.
m44AffineApply :: (InSpace V3 n a, InSpace V2 n b, AffineMappable a b) => M44 n -> a -> b

-- | Create an AffineMap from a 4x4 homogeneous matrix, ignoring any
--   perspective transforms.
m44AffineMap :: Num n => M44 n -> AffineMap V3 V2 n

-- | Apply a transformation matrix and translation.
m33AffineApply :: (InSpace V3 n a, InSpace V2 n b, AffineMappable a b) => M33 n -> V2 n -> a -> b

-- | Create an AffineMap from a 3x3 transformation matrix and a
--   translation vector.
m33AffineMap :: Num n => M33 n -> V2 n -> AffineMap V3 V2 n

-- | Make a deformation from a 4x4 homogeneous matrix.
m44Deformation :: Fractional n => M44 n -> Deformation V3 V2 n

module Diagrams.ThreeD.Deform

-- | The parallel projection onto the plane x=0
parallelX0 :: (R1 v, Num n) => Deformation v v n

-- | The perspective division onto the plane x=1 along lines going through
--   the origin.
perspectiveX1 :: (R1 v, Functor v, Fractional n) => Deformation v v n

-- | The viewing transform for a viewer facing along the positive X axis. X
--   coördinates stay fixed, while Y coördinates are compressed with
--   increasing distance. asDeformation (translation unitX) <>
--   parallelX0 <> frustrumX = perspectiveX1
facingX :: (R1 v, Functor v, Fractional n) => Deformation v v n

-- | The parallel projection onto the plane y=0
parallelY0 :: (R2 v, Num n) => Deformation v v n

-- | The perspective division onto the plane y=1 along lines going through
--   the origin.
perspectiveY1 :: (R2 v, Functor v, Floating n) => Deformation v v n
facingY :: (R2 v, Functor v, Fractional n) => Deformation v v n

-- | The parallel projection onto the plane z=0
parallelZ0 :: (R3 v, Num n) => Deformation v v n

-- | The perspective division onto the plane z=1 along lines going through
--   the origin.
perspectiveZ1 :: (R3 v, Functor v, Fractional n) => Deformation v v n
facingZ :: (R3 v, Functor v, Fractional n) => Deformation v v n

-- | This module defines the three-dimensional vector space R^3,
--   three-dimensional transformations, and various predefined
--   three-dimensional shapes. This module re-exports useful functionality
--   from a group of more specific modules:
--   
--   
--   
- Diagrams.ThreeD.Types defines basic types for
--   two-dimensional diagrams, including types representing the 3D
--   Euclidean vector space and various systems of representing
--   directions.
--   
- Diagrams.ThreeD.Transform defines R^3-specific
--   transformations such as rotation by an angle, and scaling,
--   translation, and reflection in the X, Y, and Z directions.
--   Diagrams.ThreeD.Deform defines several R^3-specific non-affine
--   transformations, such as projections.
--   
- Diagrams.ThreeD.Shapes defines three-dimensional solids,
--   e.g. spheres and cubes.
--   
- Diagrams.ThreeD.Vector defines some special 3D vectors and
--   functions for converting between vectors and directions.
--   
- Diagrams.ThreeD.Light and Diagrams.ThreeD.Camera
--   define types needed for rendering 3D geometry to (2D) images.
--   
- Diagrams.ThreeD.Align defines many alignment combinators
--   specialized to three dimensions.
--   
- Diagrams.ThreeD.Attributes defines 3D-specific attributes
--   such as surface color, diffuse reflectance, and specular
--   highlights.
--   
module Diagrams.ThreeD

-- | Boehm's algorithm for converting a cubic B-spline into a sequence of
--   cubic Bezier curves.
--   
--   See
--   
--   
--   
- Thomas W. Sederberg, An Introduction to B-Spline Curves,
--   http://web.archive.org/web/20120227050519/http://tom.cs.byu.edu/~455/bs.pdf
--   
- Lyle Ramshaw, Blossoming: A Connect-the-Dots Approach to
--   Splines,
--   http://www.hpl.hp.com/techreports/Compaq-DEC/SRC-RR-19.pdf
--   
module Diagrams.CubicSpline.Boehm
type BSpline v n = [Point v n]

-- | Convert a uniform cubic B-spline to a sequence of cubic beziers.
--   (Uniform refers to the fact that the knots are assumed to be
--   evenly spaced, with no duplicates.) The knots at the end are
--   replicated so the cubic spline begins and ends at the first and last
--   control points, tangent to the line from the end control point to the
--   next.
bsplineToBeziers :: (Additive v, Fractional n, Num n, Ord n) => BSpline v n -> [FixedSegment v n]

-- | Generate a uniform cubic B-spline from the given control points. The
--   spline starts and ends at the first and last control points, and is
--   tangent to the line to the second(-to-last) control point. It does not
--   necessarily pass through any of the other control points.
--   
--   
--   
--   pts = map p2 [(0,0), (2,3), (5,-2), (-4,1), (0,3)]
--   spot = circle 0.2 # fc blue # lw none
--   bsplineEx = mconcat
--     [ position (zip pts (repeat spot))
--     , bspline pts
--     ]
--     # frame 0.5
--   
bspline :: (TrailLike t, V t ~ v, N t ~ n) => BSpline v n -> t

-- | A cubic spline is a smooth, connected sequence of cubic curves.
--   This module provides two methods for constructing splines.
--   
--   The cubicSpline method can be used to create closed or open
--   cubic splines from a list of points. The resulting splines pass
--   through all the control points, but depend on the control points
--   in a "global" way (that is, changing one control point may alter the
--   entire curve). For access to the internals of the spline generation
--   algorithm, see Diagrams.CubicSpline.Internal.
--   
--   bspline creates a cubic B-spline, which starts and ends at the
--   first and last control points, but does not necessarily pass through
--   any of the other control points. It depends on the control points in a
--   "local" way, that is, changing one control point will only affect a
--   local portion of the curve near that control point.
module Diagrams.CubicSpline

-- | Construct a spline path-like thing of cubic segments from a list of
--   vertices, with the first vertex as the starting point. The first
--   argument specifies whether the path should be closed.
--   
--   
--   
--   pts = map p2 [(0,0), (2,3), (5,-2), (-4,1), (0,3)]
--   spot = circle 0.2 # fc blue # lw none
--   mkPath closed = position (zip pts (repeat spot))
--                <> cubicSpline closed pts
--   cubicSplineEx = (mkPath False ||| strutX 2 ||| mkPath True)
--                 # centerXY # pad 1.1
--   
--   
--   For more information, see
--   http://mathworld.wolfram.com/CubicSpline.html.
cubicSpline :: (V t ~ v, N t ~ n, TrailLike t, Fractional (v n)) => Bool -> [Point v n] -> t
type BSpline v n = [Point v n]

-- | Generate a uniform cubic B-spline from the given control points. The
--   spline starts and ends at the first and last control points, and is
--   tangent to the line to the second(-to-last) control point. It does not
--   necessarily pass through any of the other control points.
--   
--   
--   
--   pts = map p2 [(0,0), (2,3), (5,-2), (-4,1), (0,3)]
--   spot = circle 0.2 # fc blue # lw none
--   bsplineEx = mconcat
--     [ position (zip pts (repeat spot))
--     , bspline pts
--     ]
--     # frame 0.5
--   
bspline :: (TrailLike t, V t ~ v, N t ~ n) => BSpline v n -> t

-- | Tools for visualizing diagrams' internal model: local origins,
--   envelopes, traces, etc.
module Diagrams.TwoD.Model

-- | Mark the origin of a diagram by placing a red dot 1/50th its size.
showOrigin :: (TypeableFloat n, Renderable (Path V2 n) b, Monoid' m) => QDiagram b V2 n m -> QDiagram b V2 n m

-- | Mark the origin of a diagram, with control over colour and scale of
--   marker dot.
showOrigin' :: (TypeableFloat n, Renderable (Path V2 n) b, Monoid' m) => OriginOpts n -> QDiagram b V2 n m -> QDiagram b V2 n m
data OriginOpts n
OriginOpts :: Colour Double -> n -> n -> OriginOpts n
[_oColor] :: OriginOpts n -> Colour Double
[_oScale] :: OriginOpts n -> n
[_oMinSize] :: OriginOpts n -> n
oColor :: forall n_a2f1w. Lens' (OriginOpts n_a2f1w) (Colour Double)
oScale :: forall n_a2f1w. Lens' (OriginOpts n_a2f1w) n_a2f1w
oMinSize :: forall n_a2f1w. Lens' (OriginOpts n_a2f1w) n_a2f1w

-- | Mark the envelope with an approximating cubic spline using 32 points,
--   medium line width and red line color.
showEnvelope :: (Enum n, TypeableFloat n, Renderable (Path V2 n) b) => QDiagram b V2 n Any -> QDiagram b V2 n Any

-- | Mark the envelope with an approximating cubic spline with control over
--   the color, line width and number of points.
showEnvelope' :: (Enum n, TypeableFloat n, Renderable (Path V2 n) b) => EnvelopeOpts n -> QDiagram b V2 n Any -> QDiagram b V2 n Any
data EnvelopeOpts n
EnvelopeOpts :: Colour Double -> Measure n -> Int -> EnvelopeOpts n
[_eColor] :: EnvelopeOpts n -> Colour Double
[_eLineWidth] :: EnvelopeOpts n -> Measure n
[_ePoints] :: EnvelopeOpts n -> Int
eColor :: forall n_a2f2B. Lens' (EnvelopeOpts n_a2f2B) (Colour Double)
eLineWidth :: forall n_a2f2B n_a2f5A. Lens (EnvelopeOpts n_a2f2B) (EnvelopeOpts n_a2f5A) (Measure n_a2f2B) (Measure n_a2f5A)
ePoints :: forall n_a2f2B. Lens' (EnvelopeOpts n_a2f2B) Int

-- | Mark the trace of a diagram by placing 64 red dots 1/100th its size
--   along the trace.
showTrace :: (Enum n, TypeableFloat n, Renderable (Path V2 n) b) => QDiagram b V2 n Any -> QDiagram b V2 n Any

-- | Mark the trace of a diagram, with control over colour and scale of
--   marker dot and the number of points on the trace.
showTrace' :: (Enum n, TypeableFloat n, Renderable (Path V2 n) b) => TraceOpts n -> QDiagram b V2 n Any -> QDiagram b V2 n Any
data TraceOpts n
TraceOpts :: Colour Double -> n -> n -> Int -> TraceOpts n
[_tColor] :: TraceOpts n -> Colour Double
[_tScale] :: TraceOpts n -> n
[_tMinSize] :: TraceOpts n -> n
[_tPoints] :: TraceOpts n -> Int
tColor :: forall n_a2f5Z. Lens' (TraceOpts n_a2f5Z) (Colour Double)
tScale :: forall n_a2f5Z. Lens' (TraceOpts n_a2f5Z) n_a2f5Z
tMinSize :: forall n_a2f5Z. Lens' (TraceOpts n_a2f5Z) n_a2f5Z
tPoints :: forall n_a2f5Z. Lens' (TraceOpts n_a2f5Z) Int
showLabels :: (TypeableFloat n, Renderable (Text n) b, Semigroup m) => QDiagram b V2 n m -> QDiagram b V2 n Any
instance GHC.Float.Floating n => Data.Default.Class.Default (Diagrams.TwoD.Model.TraceOpts n)
instance Diagrams.Core.Envelope.OrderedField n => Data.Default.Class.Default (Diagrams.TwoD.Model.EnvelopeOpts n)
instance GHC.Real.Fractional n => Data.Default.Class.Default (Diagrams.TwoD.Model.OriginOpts n)

-- | Bounding boxes are not very compositional (e.g. it is not
--   possible to do anything sensible with them under rotation), so they
--   are not used in the diagrams core. However, they do have their uses;
--   this module provides definitions and functions for working with them.
module Diagrams.BoundingBox

-- | A bounding box is an axis-aligned region determined by two points
--   indicating its "lower" and "upper" corners. It can also represent an
--   empty bounding box - the points are wrapped in Maybe.
data BoundingBox v n

-- | An empty bounding box. This is the same thing as mempty, but
--   it doesn't require the same type constraints that the Monoid
--   instance does.
emptyBox :: BoundingBox v n

-- | Create a bounding box from a point that is component-wise
--   (<=) than the other. If this is not the case, then
--   mempty is returned.
fromCorners :: (Additive v, Foldable v, Ord n) => Point v n -> Point v n -> BoundingBox v n

-- | Create a degenerate bounding "box" containing only a single point.
fromPoint :: Point v n -> BoundingBox v n

-- | Create the smallest bounding box containing all the given points.
fromPoints :: (Additive v, Ord n) => [Point v n] -> BoundingBox v n

-- | Create a bounding box for any enveloped object (such as a diagram or
--   path).
boundingBox :: (InSpace v n a, HasBasis v, Enveloped a) => a -> BoundingBox v n

-- | Queries whether the BoundingBox is empty.
isEmptyBox :: BoundingBox v n -> Bool

-- | Gets the lower and upper corners that define the bounding box.
getCorners :: BoundingBox v n -> Maybe (Point v n, Point v n)

-- | Computes all of the corners of the bounding box.
getAllCorners :: (Additive v, Traversable v) => BoundingBox v n -> [Point v n]

-- | Get the size of the bounding box - the vector from the
--   (component-wise) lesser point to the greater point.
boxExtents :: (Additive v, Num n) => BoundingBox v n -> v n

-- | Get the center point in a bounding box.
boxCenter :: (Additive v, Fractional n) => BoundingBox v n -> Maybe (Point v n)

-- | Get the center of a the bounding box of an enveloped object, return
--   Nothing for object with empty envelope.
mCenterPoint :: (InSpace v n a, HasBasis v, Enveloped a) => a -> Maybe (Point v n)

-- | Get the center of a the bounding box of an enveloped object, return
--   the origin for object with empty envelope.
centerPoint :: (InSpace v n a, HasBasis v, Enveloped a) => a -> Point v n

-- | Create a transformation mapping points from one bounding box to the
--   other. Returns Nothing if either of the boxes are empty.
boxTransform :: (Additive v, Fractional n) => BoundingBox v n -> BoundingBox v n -> Maybe (Transformation v n)

-- | Transforms an enveloped thing to fit within a BoundingBox. If
--   the bounding box is empty, then the result is also mempty.
boxFit :: (InSpace v n a, HasBasis v, Enveloped a, Transformable a, Monoid a) => BoundingBox v n -> a -> a

-- | Check whether a point is contained in a bounding box (including its
--   edges).
contains :: (Additive v, Foldable v, Ord n) => BoundingBox v n -> Point v n -> Bool

-- | Check whether a point is strictly contained in a bounding box.
contains' :: (Additive v, Foldable v, Ord n) => BoundingBox v n -> Point v n -> Bool

-- | Test whether the first bounding box is contained inside the second.
inside :: (Additive v, Foldable v, Ord n) => BoundingBox v n -> BoundingBox v n -> Bool

-- | Test whether the first bounding box is strictly contained
--   inside the second.
inside' :: (Additive v, Foldable v, Ord n) => BoundingBox v n -> BoundingBox v n -> Bool

-- | Test whether the first bounding box lies outside the second (although
--   they may intersect in their boundaries).
outside :: (Additive v, Foldable v, Ord n) => BoundingBox v n -> BoundingBox v n -> Bool

-- | Test whether the first bounding box lies strictly outside the
--   second (they do not intersect at all).
outside' :: (Additive v, Foldable v, Ord n) => BoundingBox v n -> BoundingBox v n -> Bool

-- | boxGrid f box returns a grid of regularly spaced points
--   inside the box, such that there are (1/f) points along each
--   dimension. For example, for a 3D box with corners at (0,0,0) and
--   (2,2,2), boxGrid 0.1 would yield a grid of approximately 1000
--   points (it might actually be 11^3 instead of 10^3)
--   spaced 0.2 units apart.
boxGrid :: (Traversable v, Additive v, Num n, Enum n) => n -> BoundingBox v n -> [Point v n]

-- | Form the smallest bounding box containing the given two bound union.
--   This function is just an alias for mappend.
union :: (Additive v, Ord n) => BoundingBox v n -> BoundingBox v n -> BoundingBox v n

-- | Form the largest bounding box contained within this given two bounding
--   boxes, or Nothing if the two bounding boxes do not overlap at
--   all.
intersection :: (Additive v, Foldable v, Ord n) => BoundingBox v n -> BoundingBox v n -> BoundingBox v n
instance GHC.Base.Functor v => GHC.Base.Functor (Diagrams.BoundingBox.NonEmptyBoundingBox v)
instance GHC.Classes.Eq (v n) => GHC.Classes.Eq (Diagrams.BoundingBox.NonEmptyBoundingBox v n)
instance GHC.Base.Functor v => GHC.Base.Functor (Diagrams.BoundingBox.BoundingBox v)
instance GHC.Classes.Eq (v n) => GHC.Classes.Eq (Diagrams.BoundingBox.BoundingBox v n)
instance (Linear.Vector.Additive v, GHC.Classes.Ord n) => GHC.Base.Semigroup (Diagrams.BoundingBox.BoundingBox v n)
instance (Linear.Vector.Additive v, GHC.Classes.Ord n) => GHC.Base.Monoid (Diagrams.BoundingBox.BoundingBox v n)
instance Control.Lens.Empty.AsEmpty (Diagrams.BoundingBox.BoundingBox v n)
instance (Linear.Vector.Additive v', Data.Foldable.Foldable v', GHC.Classes.Ord n') => Control.Lens.Each.Each (Diagrams.BoundingBox.BoundingBox v n) (Diagrams.BoundingBox.BoundingBox v' n') (Linear.Affine.Point v n) (Linear.Affine.Point v' n')
instance (Linear.Vector.Additive v, GHC.Num.Num n) => Diagrams.Core.HasOrigin.HasOrigin (Diagrams.BoundingBox.BoundingBox v n)
instance (Linear.Vector.Additive v, Data.Foldable.Foldable v, GHC.Classes.Ord n) => Diagrams.Query.HasQuery (Diagrams.BoundingBox.BoundingBox v n) Data.Semigroup.Internal.Any
instance (Linear.Metric.Metric v, Data.Traversable.Traversable v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.Core.Envelope.Enveloped (Diagrams.BoundingBox.BoundingBox v n)
instance GHC.Float.RealFloat n => Diagrams.Core.Trace.Traced (Diagrams.BoundingBox.BoundingBox Linear.V2.V2 n)
instance Diagrams.Core.Types.TypeableFloat n => Diagrams.Core.Trace.Traced (Diagrams.BoundingBox.BoundingBox Linear.V3.V3 n)
instance (Linear.Metric.Metric v, Data.Traversable.Traversable v, Diagrams.Core.Envelope.OrderedField n) => Diagrams.Align.Alignable (Diagrams.BoundingBox.BoundingBox v n)
instance GHC.Show.Show (v n) => GHC.Show.Show (Diagrams.BoundingBox.BoundingBox v n)
instance GHC.Read.Read (v n) => GHC.Read.Read (Diagrams.BoundingBox.BoundingBox v n)
instance (Linear.Vector.Additive v, GHC.Classes.Ord n) => GHC.Base.Semigroup (Diagrams.BoundingBox.NonEmptyBoundingBox v n)

-- | Diagram combinators specialized to two dimensions. For more general
--   combinators, see Diagrams.Combinators.
module Diagrams.TwoD.Combinators

-- | Place two diagrams (or other objects) vertically adjacent to one
--   another, with the first diagram above the second. Since Haskell
--   ignores whitespace in expressions, one can thus write
--   
--   
--    c
--   ===
--    d
--   
--   
--   
--   to place c above d. The local origin of the
--   resulting combined diagram is the same as the local origin of the
--   first. (===) is associative and has mempty as an
--   identity. See the documentation of beside for more information.
(===) :: (InSpace V2 n a, Juxtaposable a, Semigroup a) => a -> a -> a
infixl 6 ===

-- | Place two diagrams (or other juxtaposable objects) horizontally
--   adjacent to one another, with the first diagram to the left of the
--   second. The local origin of the resulting combined diagram is the same
--   as the local origin of the first. (|||) is associative and
--   has mempty as an identity. See the documentation of
--   beside for more information.
(|||) :: (InSpace V2 n a, Juxtaposable a, Semigroup a) => a -> a -> a
infixl 6 |||

-- | Lay out a list of juxtaposable objects in a row from left to right, so
--   that their local origins lie along a single horizontal line, with
--   successive envelopes tangent to one another.
--   
--   
--   
- For more control over the spacing, see hcat'.
--   
- To align the diagrams vertically (or otherwise), use alignment
--   combinators (such as alignT or alignB) from
--   Diagrams.TwoD.Align before applying hcat.
--   
- For non-axis-aligned layout, see cat.
--   
hcat :: (InSpace V2 n a, Floating n, Juxtaposable a, HasOrigin a, Monoid' a) => [a] -> a

-- | A variant of hcat taking an extra CatOpts record to
--   control the spacing. See the cat' documentation for a
--   description of the possibilities. For the common case of setting just
--   a separation amount, see hsep.
hcat' :: (InSpace V2 n a, Floating n, Juxtaposable a, HasOrigin a, Monoid' a) => CatOpts n -> [a] -> a

-- | A convenient synonym for horizontal concatenation with separation:
--   hsep s === hcat' (with & sep .~ s).
hsep :: (InSpace V2 n a, Floating n, Juxtaposable a, HasOrigin a, Monoid' a) => n -> [a] -> a

-- | Lay out a list of juxtaposable objects in a column from top to bottom,
--   so that their local origins lie along a single vertical line, with
--   successive envelopes tangent to one another.
--   
--   
--   
- For more control over the spacing, see vcat'.
--   
- To align the diagrams horizontally (or otherwise), use alignment
--   combinators (such as alignL or alignR) from
--   Diagrams.TwoD.Align before applying vcat.
--   
- For non-axis-aligned layout, see cat.
--   
vcat :: (InSpace V2 n a, Floating n, Juxtaposable a, HasOrigin a, Monoid' a) => [a] -> a

-- | A variant of vcat taking an extra CatOpts record to
--   control the spacing. See the cat' documentation for a
--   description of the possibilities. For the common case of setting just
--   a separation amount, see vsep.
vcat' :: (InSpace V2 n a, Floating n, Juxtaposable a, HasOrigin a, Monoid' a) => CatOpts n -> [a] -> a

-- | A convenient synonym for vertical concatenation with separation:
--   vsep s === vcat' (with & sep .~ s).
vsep :: (InSpace V2 n a, Floating n, Juxtaposable a, HasOrigin a, Monoid' a) => n -> [a] -> a

-- | strutR2 v is a two-dimensional diagram which produces no
--   output, but with respect to alignment, envelope, and trace acts
--   like a 1-dimensional segment oriented along the vector v,
--   with local origin at its center. If you don't care about the trace
--   then there's no difference between strutR2 and the more
--   general strut.
strutR2 :: (RealFloat n, Monoid' m) => V2 n -> QDiagram b V2 n m

-- | strutX w is an empty diagram with width w, height 0,
--   and a centered local origin. Note that strutX (-w) behaves
--   the same as strutX w.
strutX :: (Metric v, R1 v, OrderedField n) => n -> QDiagram b v n m

-- | strutY h is an empty diagram with height h, width 0,
--   and a centered local origin. Note that strutY (-h) behaves
--   the same as strutY h.
strutY :: (Metric v, R2 v, OrderedField n) => n -> QDiagram b v n m

-- | padX s "pads" a diagram in the x-direction, expanding its
--   envelope horizontally by a factor of s (factors between 0 and
--   1 can be used to shrink the envelope). Note that the envelope will
--   expand with respect to the local origin, so if the origin is not
--   centered horizontally the padding may appear "uneven". If this is not
--   desired, the origin can be centered (using centerX) before
--   applying padX.
padX :: (Metric v, R2 v, OrderedField n, Monoid' m) => n -> QDiagram b v n m -> QDiagram b v n m

-- | padY s "pads" a diagram in the y-direction, expanding its
--   envelope vertically by a factor of s (factors between 0 and 1
--   can be used to shrink the envelope). Note that the envelope will
--   expand with respect to the local origin, so if the origin is not
--   centered vertically the padding may appear "uneven". If this is not
--   desired, the origin can be centered (using centerY) before
--   applying padY.
padY :: (Metric v, R2 v, Monoid' m, OrderedField n) => n -> QDiagram b v n m -> QDiagram b v n m

-- | extrudeLeft s "extrudes" a diagram in the negative
--   x-direction, offsetting its envelope by the provided distance. When
--    s < 0 , the envelope is inset instead.
--   
--   See the documentation for extrudeEnvelope for more information.
extrudeLeft :: (OrderedField n, Monoid' m) => n -> QDiagram b V2 n m -> QDiagram b V2 n m

-- | extrudeRight s "extrudes" a diagram in the positive
--   x-direction, offsetting its envelope by the provided distance. When
--    s < 0 , the envelope is inset instead.
--   
--   See the documentation for extrudeEnvelope for more information.
extrudeRight :: (OrderedField n, Monoid' m) => n -> QDiagram b V2 n m -> QDiagram b V2 n m

-- | extrudeBottom s "extrudes" a diagram in the negative
--   y-direction, offsetting its envelope by the provided distance. When
--    s < 0 , the envelope is inset instead.
--   
--   See the documentation for extrudeEnvelope for more information.
extrudeBottom :: (OrderedField n, Monoid' m) => n -> QDiagram b V2 n m -> QDiagram b V2 n m

-- | extrudeTop s "extrudes" a diagram in the positive
--   y-direction, offsetting its envelope by the provided distance. When
--    s < 0 , the envelope is inset instead.
--   
--   See the documentation for extrudeEnvelope for more information.
extrudeTop :: (OrderedField n, Monoid' m) => n -> QDiagram b V2 n m -> QDiagram b V2 n m

-- | rectEnvelope p v sets the envelope of a diagram to a
--   rectangle whose lower-left corner is at p and whose
--   upper-right corner is at p .+^ v. Useful for selecting the
--   rectangular portion of a diagram which should actually be "viewed" in
--   the final render, if you don't want to see the entire diagram.
rectEnvelope :: forall b n m. (OrderedField n, Monoid' m) => Point V2 n -> V2 n -> QDiagram b V2 n m -> QDiagram b V2 n m

-- | A synonym for rectEnvelope.
crop :: forall b n m. (OrderedField n, Monoid' m) => Point V2 n -> V2 n -> QDiagram b V2 n m -> QDiagram b V2 n m

-- | Construct a bounding rectangle for an enveloped object, that is, the
--   smallest axis-aligned rectangle which encloses the object.
boundingRect :: (InSpace V2 n a, SameSpace a t, Enveloped t, Transformable t, TrailLike t, Monoid t, Enveloped a) => a -> t

-- | "Set the background color" of a diagram. That is, place a diagram atop
--   a bounding rectangle of the given color. The background does not
--   change the result of queries.
bg :: (TypeableFloat n, Renderable (Path V2 n) b, Monoid' q) => Colour Double -> QDiagram b V2 n q -> QDiagram b V2 n q

-- | Similar to bg but makes the colored background rectangle larger
--   than the diagram. The first parameter is used to set how far the
--   background extends beyond the diagram. The background does not change
--   the result of queries.
bgFrame :: (TypeableFloat n, Renderable (Path V2 n) b, Monoid' q) => n -> Colour Double -> QDiagram b V2 n q -> QDiagram b V2 n q

-- | Utilities for working with sizes of objects.
module Diagrams.Size

-- | A SizeSpec is a way of specifying a size without needed lengths
--   for all the dimensions.
data SizeSpec v n

-- | Make a SizeSpec from a vector of maybe values. Any negative
--   values will be ignored. For 2D SizeSpecs see mkWidth
--   and mkHeight from Diagrams.TwoD.Size.
mkSizeSpec :: (Functor v, Num n) => v (Maybe n) -> SizeSpec v n

-- | Make a SizeSpec from a vector. Any negative values will be
--   ignored.
dims :: v n -> SizeSpec v n

-- | A size spec with no hints to the size.
absolute :: (Additive v, Num n) => SizeSpec v n

-- | Retrieve a size spec as a vector of maybe values. Only positive sizes
--   are returned.
getSpec :: (Functor v, Num n, Ord n) => SizeSpec v n -> v (Maybe n)

-- | specToSize n spec extracts a size from a SizeSpec
--   sz. Any values not specified in the spec are replaced by the
--   smallest of the values that are specified. If there are no specified
--   values (i.e. absolute) then n is used.
specToSize :: (Foldable v, Functor v, Num n, Ord n) => n -> SizeSpec v n -> v n

-- | requiredScale spec sz returns the largest scaling factor to
--   make something of size sz fit the requested size
--   spec without changing the aspect ratio. sz should be
--   non-zero (otherwise a scale of 1 is returned). For non-uniform scaling
--   see boxFit.
requiredScale :: (Additive v, Foldable v, Fractional n, Ord n) => SizeSpec v n -> v n -> n

-- | Return the Transformation calcuated from requiredScale.
requiredScaling :: (Additive v, Foldable v, Fractional n, Ord n) => SizeSpec v n -> v n -> Transformation v n

-- | Uniformly scale any enveloped object so that it fits within the given
--   size. For non-uniform scaling see boxFit.
sized :: (InSpace v n a, HasLinearMap v, Transformable a, Enveloped a) => SizeSpec v n -> a -> a

-- | Uniformly scale an enveloped object so that it "has the same size as"
--   (fits within the width and height of) some other object.
sizedAs :: (InSpace v n a, SameSpace a b, HasLinearMap v, Transformable a, Enveloped a, Enveloped b) => b -> a -> a

-- | Get the adjustment to fit a BoundingBox in the given
--   SizeSpec. The vector is the new size and the transformation to
--   position the lower corner at the origin and scale to the size spec.
sizeAdjustment :: (Additive v, Foldable v, OrderedField n) => SizeSpec v n -> BoundingBox v n -> (v n, Transformation v n)
instance GHC.Show.Show (v n) => GHC.Show.Show (Diagrams.Size.SizeSpec v n)
instance Data.Hashable.Class.Hashable (v n) => Data.Hashable.Class.Hashable (Diagrams.Size.SizeSpec v n)
instance GHC.Generics.Generic (Diagrams.Size.SizeSpec v n)
instance GHC.Base.Functor v => GHC.Base.Functor (Diagrams.Size.SizeSpec v)
instance GHC.Classes.Eq (v n) => GHC.Classes.Eq (Diagrams.Size.SizeSpec v n)

-- | Utilities for working with sizes of two-dimensional objects.
module Diagrams.TwoD.Size

-- | Compute the width of an enveloped object.
--   
--   Note this is just diameter unitX.
width :: (InSpace V2 n a, Enveloped a) => a -> n

-- | Compute the height of an enveloped object.
height :: (InSpace V2 n a, Enveloped a) => a -> n

-- | Compute the absolute x-coordinate range of an enveloped object in the
--   form (lo,hi). Return Nothing for objects with an
--   empty envelope.
--   
--   Note this is just extent unitX.
extentX :: (InSpace v n a, R1 v, Enveloped a) => a -> Maybe (n, n)

-- | Compute the absolute y-coordinate range of an enveloped object in the
--   form (lo,hi). Return Nothing for objects with an
--   empty envelope.
extentY :: (InSpace v n a, R2 v, Enveloped a) => a -> Maybe (n, n)

-- | Make a SizeSpec from possibly-specified width and height.
mkSizeSpec2D :: Num n => Maybe n -> Maybe n -> SizeSpec V2 n

-- | Make a SizeSpec with only width defined.
mkWidth :: Num n => n -> SizeSpec V2 n

-- | Make a SizeSpec with only height defined.
mkHeight :: Num n => n -> SizeSpec V2 n

-- | Make a SizeSpec from a width and height.
dims2D :: n -> n -> SizeSpec V2 n

-- | This module defines the two-dimensional vector space R^2,
--   two-dimensional transformations, and various predefined
--   two-dimensional shapes. This module re-exports useful functionality
--   from a group of more specific modules:
--   
--   
--   
- Diagrams.TwoD.Types defines basic types for two-dimensional
--   diagrams, including types representing the 2D Euclidean vector space
--   and various systems of angle measurement.
--   
- Diagrams.TwoD.Align defines alignment combinators
--   specialized to two dimensions (see Diagrams.Align for more
--   general alignment).
--   
- Diagrams.TwoD.Combinators defines ways of combining
--   diagrams specialized to two dimensions (see also
--   Diagrams.Combinators for more general combining).
--   
- Diagrams.TwoD.Attributes defines attributes specific to two
--   dimensions, *e.g.* fill color, line color, and gradients.
--   
- Diagrams.TwoD.Transform defines R^2-specific
--   transformations such as rotation by an angle, and scaling,
--   translation, and reflection in the X and Y directions.
--   
- Diagrams.TwoD.Deform defines some non-affine
--   transformations specific to two dimensions, *e.g.* parallel and
--   perspective projections.
--   
- Diagrams.TwoD.Ellipse defines circles and ellipses.
--   
- Diagrams.TwoD.Arc defines circular arcs.
--   
- Diagrams.TwoD.Path exports various operations on
--   two-dimensional paths when viewed as regions of the plane.
--   
- Diagrams.TwoD.Polygons defines general algorithms for
--   drawing various types of polygons.
--   
- Diagrams.TwoD.Shapes defines other two-dimensional shapes,
--   e.g. various polygons.
--   
- Diagrams.TwoD.Arrow contains tools for drawing arrows
--   between things, and Diagrams.TwoD.Arrowheads defines a
--   collection of arrowheads.
--   
- Diagrams.TwoD.Text defines primitive text diagrams.
--   
- Diagrams.TwoD.Image allows importing external images into
--   diagrams.
--   
- Diagrams.TwoD.Vector defines some special 2D vectors and
--   functions for converting between vectors and angles.
--   
- Diagrams.TwoD.Size defines functions for working with the
--   size of 2D objects.
--   
- Diagrams.TwoD.Model defines some aids for visualizing
--   diagrams' internal model (local origins, envelopes, etc.)
--   
module Diagrams.TwoD

-- | A 2-dimensional vector
--   
--   
--   >>> pure 1 :: V2 Int
--   V2 1 1
--   
--   
--   
--   >>> V2 1 2 + V2 3 4
--   V2 4 6
--   
--   
--   
--   >>> V2 1 2 * V2 3 4
--   V2 3 8
--   
--   
--   
--   >>> sum (V2 1 2)
--   3
--   
data () => V2 a
V2 :: !a -> !a -> V2 a

-- | A space that has at least 1 basis vector _x.
class () => R1 (t :: Type -> Type)

-- | 
--   >>> V1 2 ^._x
--   2
--   
--   
--   
--   >>> V1 2 & _x .~ 3
--   V1 3
--   
_x :: R1 t => Lens' (t a) a

-- | A space that distinguishes 2 orthogonal basis vectors _x and
--   _y, but may have more.
class R1 t => R2 (t :: Type -> Type)

-- | 
--   >>> V2 1 2 ^._y
--   2
--   
--   
--   
--   >>> V2 1 2 & _y .~ 3
--   V2 1 3
--   
_y :: R2 t => Lens' (t a) a
_xy :: R2 t => Lens' (t a) (V2 a)
type P2 = Point V2
type T2 = Transformation V2

-- | Construct a 2D vector from a pair of components. See also
--   &.
r2 :: (n, n) -> V2 n

-- | Convert a 2D vector back into a pair of components. See also
--   coords.
unr2 :: V2 n -> (n, n)

-- | Curried form of r2.
mkR2 :: n -> n -> V2 n

-- | Construct a 2D point from a pair of coordinates. See also
--   ^&.
p2 :: (n, n) -> P2 n

-- | Convert a 2D point back into a pair of coordinates. See also
--   coords.
unp2 :: P2 n -> (n, n)

-- | Curried form of p2.
mkP2 :: n -> n -> P2 n

-- | The unit vector in the positive X direction.
unitX :: (R1 v, Additive v, Num n) => v n

-- | The unit vector in the positive Y direction.
unitY :: (R2 v, Additive v, Num n) => v n

-- | The unit vector in the negative X direction.
unit_X :: (R1 v, Additive v, Num n) => v n

-- | The unit vector in the negative Y direction.
unit_Y :: (R2 v, Additive v, Num n) => v n

-- | the counter-clockwise perpendicular vector
--   
--   
--   >>> perp $ V2 10 20
--   V2 (-20) 10
--   
perp :: Num a => V2 a -> V2 a

-- | leftTurn v1 v2 tests whether the direction of v2 is
--   a left turn from v1 (that is, if the direction of v2
--   can be obtained from that of v1 by adding an angle 0 <=
--   theta <= tau/2).
leftTurn :: (Num n, Ord n) => V2 n -> V2 n -> Bool

-- | A Direction pointing in the X direction.
xDir :: (R1 v, Additive v, Num n) => Direction v n

-- | A Direction pointing in the Y direction.
yDir :: (R2 v, Additive v, Num n) => Direction v n

-- | The circle constant, the ratio of a circle's circumference to its
--   radius. Note that pi = tau/2.
--   
--   For more information and a well-reasoned argument why we should all be
--   using tau instead of pi, see The Tau Manifesto,
--   http://tauday.com/.
--   
--   To hear what it sounds like (and to easily memorize the first 30
--   digits or so), try http://youtu.be/3174T-3-59Q.
tau :: Floating a => a

-- | A unit vector at a specified angle counter-clockwise from the positive
--   x-axis
angleV :: Floating n => Angle n -> V2 n

-- | A direction at a specified angle counter-clockwise from the
--   xDir.
angleDir :: Floating n => Angle n -> Direction V2 n

-- | Signed angle between two vectors. Currently defined as
--   
--   
--   signedAngleBetween u v = (u ^. _theta) ^-^ (v ^. _theta)
--   
signedAngleBetween :: RealFloat n => V2 n -> V2 n -> Angle n

-- | Same as signedAngleBetween but for Directionss.
signedAngleBetweenDirs :: RealFloat n => Direction V2 n -> Direction V2 n -> Angle n

-- | A space which has magnitude _r that can be calculated
--   numerically.
class HasR t
_r :: (HasR t, RealFloat n) => Lens' (t n) n
r2PolarIso :: RealFloat n => Iso' (V2 n) (n, Angle n)

-- | Convert a ToPath object into a diagram. The resulting diagram
--   has the names 0, 1, ... assigned to each of the path's vertices.
--   
--   See also stroke', which takes an extra options record allowing
--   its behaviour to be customized.
--   
--   
--   stroke :: Path V2 Double                  -> Diagram b
--   stroke :: Located (Trail V2 Double)       -> Diagram b
--   stroke :: Located (Trail' Loop V2 Double) -> Diagram b
--   stroke :: Located (Trail' Line V2 Double) -> Diagram b
--   
stroke :: (InSpace V2 n t, ToPath t, TypeableFloat n, Renderable (Path V2 n) b) => t -> QDiagram b V2 n Any

-- | A variant of stroke that takes an extra record of options to
--   customize its behaviour. In particular:
--   
--   
--   
- Names can be assigned to the path's vertices
--   
--   
--   StrokeOpts is an instance of Default, so stroke'
--   (with & ... ) syntax may be used.
stroke' :: (InSpace V2 n t, ToPath t, TypeableFloat n, Renderable (Path V2 n) b, IsName a) => StrokeOpts a -> t -> QDiagram b V2 n Any

-- | stroke specialised to Path.
strokePath :: (TypeableFloat n, Renderable (Path V2 n) b) => Path V2 n -> QDiagram b V2 n Any

-- | stroke specialised to Path.
strokeP :: (TypeableFloat n, Renderable (Path V2 n) b) => Path V2 n -> QDiagram b V2 n Any

-- | stroke' specialised to Path.
strokePath' :: (TypeableFloat n, Renderable (Path V2 n) b, IsName a) => StrokeOpts a -> Path V2 n -> QDiagram b V2 n Any

-- | stroke' specialised to Path.
strokeP' :: (TypeableFloat n, Renderable (Path V2 n) b, IsName a) => StrokeOpts a -> Path V2 n -> QDiagram b V2 n Any

-- | stroke specialised to Trail.
strokeTrail :: (TypeableFloat n, Renderable (Path V2 n) b) => Trail V2 n -> QDiagram b V2 n Any

-- | stroke specialised to Trail.
strokeT :: (TypeableFloat n, Renderable (Path V2 n) b) => Trail V2 n -> QDiagram b V2 n Any

-- | A composition of stroke' and pathFromTrail for
--   conveniently converting a trail directly into a diagram.
strokeTrail' :: (TypeableFloat n, Renderable (Path V2 n) b, IsName a) => StrokeOpts a -> Trail V2 n -> QDiagram b V2 n Any

-- | Deprecated synonym for strokeTrail'.
strokeT' :: (TypeableFloat n, Renderable (Path V2 n) b, IsName a) => StrokeOpts a -> Trail V2 n -> QDiagram b V2 n Any

-- | A composition of strokeT and wrapLine for conveniently
--   converting a line directly into a diagram.
strokeLine :: (TypeableFloat n, Renderable (Path V2 n) b) => Trail' Line V2 n -> QDiagram b V2 n Any

-- | A composition of strokeT and wrapLoop for conveniently
--   converting a loop directly into a diagram.
strokeLoop :: (TypeableFloat n, Renderable (Path V2 n) b) => Trail' Loop V2 n -> QDiagram b V2 n Any

-- | A convenience function for converting a Located Trail
--   directly into a diagram; strokeLocTrail = stroke . trailLike.
strokeLocTrail :: (TypeableFloat n, Renderable (Path V2 n) b) => Located (Trail V2 n) -> QDiagram b V2 n Any

-- | Deprecated synonym for strokeLocTrail.
strokeLocT :: (TypeableFloat n, Renderable (Path V2 n) b) => Located (Trail V2 n) -> QDiagram b V2 n Any

-- | A convenience function for converting a Located line directly
--   into a diagram; strokeLocLine = stroke . trailLike . mapLoc
--   wrapLine.
strokeLocLine :: (TypeableFloat n, Renderable (Path V2 n) b) => Located (Trail' Line V2 n) -> QDiagram b V2 n Any

-- | A convenience function for converting a Located loop directly
--   into a diagram; strokeLocLoop = stroke . trailLike . mapLoc
--   wrapLoop.
strokeLocLoop :: (TypeableFloat n, Renderable (Path V2 n) b) => Located (Trail' Loop V2 n) -> QDiagram b V2 n Any

-- | Enumeration of algorithms or "rules" for determining which points lie
--   in the interior of a (possibly self-intersecting) path.
data FillRule

-- | Interior points are those with a nonzero winding number.
--   See http://en.wikipedia.org/wiki/Nonzero-rule.
Winding :: FillRule

-- | Interior points are those where a ray extended infinitely in a
--   particular direction crosses the path an odd number of times. See
--   http://en.wikipedia.org/wiki/Even-odd_rule.
EvenOdd :: FillRule

-- | Specify the fill rule that should be used for determining which points
--   are inside a path.
fillRule :: HasStyle a => FillRule -> a -> a

-- | Lens onto the fill rule of a style.
_fillRule :: Lens' (Style V2 n) FillRule

-- | A record of options that control how a path is stroked.
--   StrokeOpts is an instance of Default, so a
--   StrokeOpts records can be created using with {
--   ... } notation.
data StrokeOpts a
StrokeOpts :: [[a]] -> FillRule -> StrokeOpts a
[_vertexNames] :: StrokeOpts a -> [[a]]
[_queryFillRule] :: StrokeOpts a -> FillRule

-- | Atomic names that should be assigned to the vertices of the path so
--   that they can be referenced later. If there are not enough names, the
--   extra vertices are not assigned names; if there are too many, the
--   extra names are ignored. Note that this is a list of lists of
--   names, since paths can consist of multiple trails. The first list of
--   names are assigned to the vertices of the first trail, the second list
--   to the second trail, and so on.
--   
--   The default value is the empty list.
vertexNames :: Lens (StrokeOpts a) (StrokeOpts a') [[a]] [[a']]

-- | The fill rule used for determining which points are inside the path.
--   The default is Winding. NOTE: for now, this only affects the
--   resulting diagram's Query, not how it will be drawn! To
--   set the fill rule determining how it is to be drawn, use the
--   fillRule function.
queryFillRule :: Lens' (StrokeOpts a) FillRule

-- | Find the intersect points of two objects that can be converted to a
--   path.
intersectPoints :: (InSpace V2 n t, SameSpace t s, ToPath t, ToPath s, OrderedField n) => t -> s -> [P2 n]

-- | Find the intersect points of two objects that can be converted to a
--   path within the given tolerance.
intersectPoints' :: (InSpace V2 n t, SameSpace t s, ToPath t, ToPath s, OrderedField n) => n -> t -> s -> [P2 n]

-- | Compute the intersect points between two paths.
intersectPointsP :: OrderedField n => Path V2 n -> Path V2 n -> [P2 n]

-- | Compute the intersect points between two paths within given tolerance.
intersectPointsP' :: OrderedField n => n -> Path V2 n -> Path V2 n -> [P2 n]

-- | Compute the intersect points between two located trails.
intersectPointsT :: OrderedField n => Located (Trail V2 n) -> Located (Trail V2 n) -> [P2 n]

-- | Compute the intersect points between two located trails within the
--   given tolerance.
intersectPointsT' :: OrderedField n => n -> Located (Trail V2 n) -> Located (Trail V2 n) -> [P2 n]

-- | Clip a diagram by the given path:
--   
--   
--   
- Only the parts of the diagram which lie in the interior of the
--   path will be drawn.
--   
- The envelope of the diagram is unaffected.
--   
clipBy :: (HasStyle a, V a ~ V2, N a ~ n, TypeableFloat n) => Path V2 n -> a -> a

-- | Clip a diagram to the given path setting its envelope to the pointwise
--   minimum of the envelopes of the diagram and path. The trace consists
--   of those parts of the original diagram's trace which fall within the
--   clipping path, or parts of the path's trace within the original
--   diagram.
clipTo :: TypeableFloat n => Path V2 n -> QDiagram b V2 n Any -> QDiagram b V2 n Any

-- | Clip a diagram to the clip path taking the envelope and trace of the
--   clip path.
clipped :: TypeableFloat n => Path V2 n -> QDiagram b V2 n Any -> QDiagram b V2 n Any
_Clip :: Iso (Clip n) (Clip n') [Path V2 n] [Path V2 n']

-- | Lens onto the Clip in a style. An empty list means no clipping.
_clip :: (Typeable n, OrderedField n) => Lens' (Style V2 n) [Path V2 n]

-- | Create a centered horizontal (L-R) line of the given length.
--   
--   
--   
--   hruleEx = vcat' (with & sep .~ 0.2) (map hrule [1..5])
--           # centerXY # pad 1.1
--   
hrule :: (InSpace V2 n t, TrailLike t) => n -> t

-- | Create a centered vertical (T-B) line of the given length.
--   
--   
--   
--   vruleEx = hcat' (with & sep .~ 0.2) (map vrule [1, 1.2 .. 2])
--           # centerXY # pad 1.1
--   
vrule :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A circle of radius 1, with center at the origin.
unitCircle :: (TrailLike t, V t ~ V2, N t ~ n) => t

-- | A circle of the given radius, centered at the origin. As a path, it
--   begins at (r,0).
circle :: (TrailLike t, V t ~ V2, N t ~ n, Transformable t) => n -> t

-- | ellipse e constructs an ellipse with eccentricity e
--   by scaling the unit circle in the X direction. The eccentricity must
--   be within the interval [0,1).
ellipse :: (TrailLike t, V t ~ V2, N t ~ n, Transformable t) => n -> t

-- | ellipseXY x y creates an axis-aligned ellipse, centered at
--   the origin, with radius x along the x-axis and radius
--   y along the y-axis.
ellipseXY :: (TrailLike t, V t ~ V2, N t ~ n, Transformable t) => n -> n -> t

-- | Given a start direction d and a sweep angle s,
--   arc d s is the path of a radius one arc starting at
--   d and sweeping out the angle s counterclockwise (for
--   positive s). The resulting Trail is allowed to wrap around
--   and overlap itself.
arc :: (InSpace V2 n t, OrderedField n, TrailLike t) => Direction V2 n -> Angle n -> t

-- | Given a radus r, a start direction d and an angle
--   s, arc' r d s is the path of a radius
--   (abs r) arc starting at d and sweeping out the angle
--   s counterclockwise (for positive s). The origin of the arc is
--   its center.
--   
--   
--   
--   arc'Ex = mconcat [ arc' r xDir (1/4 @@ turn) | r <- [0.5,-1,1.5] ]
--          # centerXY # pad 1.1
--   
arc' :: (InSpace V2 n t, OrderedField n, TrailLike t) => n -> Direction V2 n -> Angle n -> t

-- | Like arcAngleCCW but clockwise.
arcCW :: (InSpace V2 n t, RealFloat n, TrailLike t) => Direction V2 n -> Direction V2 n -> t

-- | Given a start direction s and end direction e,
--   arcCCW s e is the path of a radius one arc counterclockwise
--   between the two directions. The origin of the arc is its center.
arcCCW :: (InSpace V2 n t, RealFloat n, TrailLike t) => Direction V2 n -> Direction V2 n -> t

-- | Create a circular wedge of the given radius, beginning at the given
--   direction and extending through the given angle.
--   
--   
--   
--   wedgeEx = hcat' (with & sep .~ 0.5)
--     [ wedge 1 xDir (1/4 @@ turn)
--     , wedge 1 (rotate (7/30 @@ turn) xDir) (4/30 @@ turn)
--     , wedge 1 (rotate (1/8 @@ turn) xDir) (3/4 @@ turn)
--     ]
--     # fc blue
--     # centerXY # pad 1.1
--   
wedge :: (InSpace V2 n t, OrderedField n, TrailLike t) => n -> Direction V2 n -> Angle n -> t

-- | arcBetween p q height creates an arc beginning at p
--   and ending at q, with its midpoint at a distance of abs
--   height away from the straight line from p to q.
--   A positive value of height results in an arc to the left of
--   the line from p to q; a negative value yields one to
--   the right.
--   
--   
--   
--   arcBetweenEx = mconcat
--     [ arcBetween origin (p2 (2,1)) ht | ht <- [-0.2, -0.1 .. 0.2] ]
--     # centerXY # pad 1.1
--   
arcBetween :: (TrailLike t, V t ~ V2, N t ~ n, RealFloat n) => Point V2 n -> Point V2 n -> n -> t

-- | Create an annular wedge of the given radii, beginning at the first
--   direction and extending through the given sweep angle. The radius of
--   the outer circle is given first.
--   
--   
--   
--   annularWedgeEx = hsep 0.50
--     [ annularWedge 1 0.5 xDir (1/4 @@ turn)
--     , annularWedge 1 0.3 (rotate (7/30 @@ turn) xDir) (4/30 @@ turn)
--     , annularWedge 1 0.7 (rotate (1/8 @@ turn) xDir) (3/4 @@ turn)
--     ]
--     # fc blue
--     # centerXY # pad 1.1
--   
annularWedge :: (TrailLike t, V t ~ V2, N t ~ n, RealFloat n) => n -> n -> Direction V2 n -> Angle n -> t

-- | Generate the polygon described by the given options.
polygon :: (InSpace V2 n t, TrailLike t) => PolygonOpts n -> t

-- | Generate a polygon. See PolygonOpts for more information.
polyTrail :: OrderedField n => PolygonOpts n -> Located (Trail V2 n)

-- | Options for specifying a polygon.
data PolygonOpts n
PolygonOpts :: PolyType n -> PolyOrientation n -> Point V2 n -> PolygonOpts n
[_polyType] :: PolygonOpts n -> PolyType n
[_polyOrient] :: PolygonOpts n -> PolyOrientation n
[_polyCenter] :: PolygonOpts n -> Point V2 n

-- | Specification for the polygon's vertices.
polyType :: Lens' (PolygonOpts n) (PolyType n)

-- | Should a rotation be applied to the polygon in order to orient it in a
--   particular way?
polyOrient :: Lens' (PolygonOpts n) (PolyOrientation n)

-- | Should a translation be applied to the polygon in order to place the
--   center at a particular location?
polyCenter :: Lens' (PolygonOpts n) (Point V2 n)

-- | Method used to determine the vertices of a polygon.
data PolyType n

-- | A "polar" polygon.
--   
--   
--   
- The first argument is a list of central angles from
--   each vertex to the next.
--   
- The second argument is a list of radii from the origin to
--   each successive vertex.
--   
--   
--   To construct an n-gon, use a list of n-1 angles and
--   n radii. Extra angles or radii are ignored.
--   
--   Cyclic polygons (with all vertices lying on a circle) can be
--   constructed using a second argument of (repeat r).
PolyPolar :: [Angle n] -> [n] -> PolyType n

-- | A polygon determined by the distance between successive vertices and
--   the external angles formed by each three successive vertices. In other
--   words, a polygon specified by "turtle graphics": go straight ahead x1
--   units; turn by external angle a1; go straight ahead x2 units; turn by
--   external angle a2; etc. The polygon will be centered at the
--   centroid of its vertices.
--   
--   
--   
- The first argument is a list of vertex angles,
--   giving the external angle at each vertex from the previous vertex to
--   the next. The first angle in the list is the external angle at the
--   second vertex; the first edge always starts out heading in the
--   positive y direction from the first vertex.
--   
- The second argument is a list of distances between successive
--   vertices.
--   
--   
--   To construct an n-gon, use a list of n-2 angles and
--   n-1 edge lengths. Extra angles or lengths are ignored.
PolySides :: [Angle n] -> [n] -> PolyType n

-- | A regular polygon with the given number of sides (first argument) and
--   the given radius (second argument).
PolyRegular :: Int -> n -> PolyType n

-- | Determine how a polygon should be oriented.
data PolyOrientation n

-- | No special orientation; the first vertex will be at (1,0).
NoOrient :: PolyOrientation n

-- | Orient horizontally, so the bottommost edge is parallel to the
--   x-axis. This is the default.
OrientH :: PolyOrientation n

-- | Orient vertically, so the leftmost edge is parallel to the
--   y-axis.
OrientV :: PolyOrientation n

-- | Orient so some edge is facing in the
--   direction of, that is, perpendicular to, the given
--   vector.
OrientTo :: V2 n -> PolyOrientation n

-- | Options for creating "star" polygons, where the edges connect possibly
--   non-adjacent vertices.
data StarOpts

-- | Specify the order in which the vertices should be connected by a
--   function that maps each vertex index to the index of the vertex that
--   should come next. Indexing of vertices begins at 0.
StarFun :: (Int -> Int) -> StarOpts

-- | Specify a star polygon by a "skip". A skip of 1 indicates a normal
--   polygon, where edges go between successive vertices. A skip of 2 means
--   that edges will connect every second vertex, skipping one in between.
--   Generally, a skip of n means that edges will connect every
--   nth vertex.
StarSkip :: Int -> StarOpts

-- | Create a generalized star polygon. The StarOpts
--   are used to determine in which order the given vertices should be
--   connected. The intention is that the second argument of type
--   [Point v] could be generated by a call to polygon,
--   regPoly, or the like, since a list of vertices is
--   TrailLike. But of course the list can be generated any way you
--   like. A Path v is returned (instead of any
--   TrailLike) because the resulting path may have more than one
--   component, for example if the vertices are to be connected in several
--   disjoint cycles.
star :: OrderedField n => StarOpts -> [Point V2 n] -> Path V2 n

-- | Create a regular polygon. The first argument is the number of sides,
--   and the second is the length of the sides. (Compare to the
--   polygon function with a PolyRegular option, which
--   produces polygons of a given radius).
--   
--   The polygon will be oriented with one edge parallel to the x-axis.
regPoly :: (InSpace V2 n t, TrailLike t) => Int -> n -> t

-- | An equilateral triangle, with sides of the given length and base
--   parallel to the x-axis.
--   
triangle :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A synonym for triangle, provided for backwards compatibility.
eqTriangle :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A square with its center at the origin and sides of the given length,
--   oriented parallel to the axes.
--   
square :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A regular pentagon, with sides of the given length and base parallel
--   to the x-axis.
--   
pentagon :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A regular hexagon, with sides of the given length and base parallel to
--   the x-axis.
--   
hexagon :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A regular heptagon, with sides of the given length and base parallel
--   to the x-axis.
--   
heptagon :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A synonym for heptagon. It is, however, completely inferior,
--   being a base admixture of the Latin septum (seven) and the
--   Greek γωνία (angle).
septagon :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A regular octagon, with sides of the given length and base parallel to
--   the x-axis.
--   
octagon :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A regular nonagon, with sides of the given length and base parallel to
--   the x-axis.
--   
nonagon :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A regular decagon, with sides of the given length and base parallel to
--   the x-axis.
--   
decagon :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A regular hendecagon, with sides of the given length and base parallel
--   to the x-axis.
--   
hendecagon :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A regular dodecagon, with sides of the given length and base parallel
--   to the x-axis.
--   
dodecagon :: (InSpace V2 n t, TrailLike t) => n -> t

-- | A square with its center at the origin and sides of length 1, oriented
--   parallel to the axes.
--   
unitSquare :: (InSpace V2 n t, TrailLike t) => t

-- | rect w h is an axis-aligned rectangle of width w and
--   height h, centered at the origin.
--   
rect :: (InSpace V2 n t, TrailLike t) => n -> n -> t

-- | roundedRect w h r generates a closed trail, or closed path
--   centered at the origin, of an axis-aligned rectangle with width
--   w, height h, and circular rounded corners of radius
--   r. If r is negative the corner will be cut out in a
--   reverse arc. If the size of r is larger than half the smaller
--   dimension of w and h, then it will be reduced to fit
--   in that range, to prevent the corners from overlapping. The trail or
--   path begins with the right edge and proceeds counterclockwise. If you
--   need to specify a different radius for each corner individually, use
--   roundedRect' instead.
--   
--   
--   
--   roundedRectEx = pad 1.1 . centerXY $ hcat' (with & sep .~ 0.2)
--     [ roundedRect  0.5 0.4 0.1
--     , roundedRect  0.5 0.4 (-0.1)
--     , roundedRect' 0.7 0.4 (with & radiusTL .~ 0.2
--                                  & radiusTR .~ -0.2
--                                  & radiusBR .~ 0.1)
--     ]
--   
roundedRect :: (InSpace V2 n t, TrailLike t, RealFloat n) => n -> n -> n -> t

-- | roundedRect' works like roundedRect but allows you
--   to set the radius of each corner indivually, using
--   RoundedRectOpts. The default corner radius is 0. Each radius
--   can also be negative, which results in the curves being reversed to be
--   inward instead of outward.
roundedRect' :: (InSpace V2 n t, TrailLike t, RealFloat n) => n -> n -> RoundedRectOpts n -> t
data RoundedRectOpts d
RoundedRectOpts :: d -> d -> d -> d -> RoundedRectOpts d
[_radiusTL] :: RoundedRectOpts d -> d
[_radiusTR] :: RoundedRectOpts d -> d
[_radiusBL] :: RoundedRectOpts d -> d
[_radiusBR] :: RoundedRectOpts d -> d
radiusTL :: forall d_a1Jt1. Lens' (RoundedRectOpts d_a1Jt1) d_a1Jt1
radiusTR :: forall d_a1Jt1. Lens' (RoundedRectOpts d_a1Jt1) d_a1Jt1
radiusBL :: forall d_a1Jt1. Lens' (RoundedRectOpts d_a1Jt1) d_a1Jt1
radiusBR :: forall d_a1Jt1. Lens' (RoundedRectOpts d_a1Jt1) d_a1Jt1

-- | arrowV v creates an arrow with the direction and norm of the
--   vector v (with its tail at the origin), using default
--   parameters.
arrowV :: (TypeableFloat n, Renderable (Path V2 n) b) => V2 n -> QDiagram b V2 n Any

-- | arrowV' v creates an arrow with the direction and norm of the
--   vector v (with its tail at the origin).
arrowV' :: (TypeableFloat n, Renderable (Path V2 n) b) => ArrowOpts n -> V2 n -> QDiagram b V2 n Any

-- | Create an arrow starting at s with length and direction determined by
--   the vector v.
arrowAt :: (TypeableFloat n, Renderable (Path V2 n) b) => Point V2 n -> V2 n -> QDiagram b V2 n Any
arrowAt' :: (TypeableFloat n, Renderable (Path V2 n) b) => ArrowOpts n -> Point V2 n -> V2 n -> QDiagram b V2 n Any

-- | arrowBetween s e creates an arrow pointing from s to
--   e with default parameters.
arrowBetween :: (TypeableFloat n, Renderable (Path V2 n) b) => Point V2 n -> Point V2 n -> QDiagram b V2 n Any

-- | arrowBetween' opts s e creates an arrow pointing from
--   s to e using the given options. In particular, it
--   scales and rotates arrowShaft to go between s and
--   e, taking head, tail, and gaps into account.
arrowBetween' :: (TypeableFloat n, Renderable (Path V2 n) b) => ArrowOpts n -> Point V2 n -> Point V2 n -> QDiagram b V2 n Any

-- | Connect two diagrams with a straight arrow.
connect :: (TypeableFloat n, Renderable (Path V2 n) b, IsName n1, IsName n2) => n1 -> n2 -> QDiagram b V2 n Any -> QDiagram b V2 n Any

-- | Connect two diagrams with an arbitrary arrow.
connect' :: (TypeableFloat n, Renderable (Path V2 n) b, IsName n1, IsName n2) => ArrowOpts n -> n1 -> n2 -> QDiagram b V2 n Any -> QDiagram b V2 n Any

-- | Connect two diagrams at point on the perimeter of the diagrams,
--   choosen by angle.
connectPerim :: (TypeableFloat n, Renderable (Path V2 n) b, IsName n1, IsName n2) => n1 -> n2 -> Angle n -> Angle n -> QDiagram b V2 n Any -> QDiagram b V2 n Any
connectPerim' :: (TypeableFloat n, Renderable (Path V2 n) b, IsName n1, IsName n2) => ArrowOpts n -> n1 -> n2 -> Angle n -> Angle n -> QDiagram b V2 n Any -> QDiagram b V2 n Any

-- | Draw an arrow from diagram named "n1" to diagram named "n2". The arrow
--   lies on the line between the centres of the diagrams, but is drawn so
--   that it stops at the boundaries of the diagrams, using traces to find
--   the intersection points.
connectOutside :: (TypeableFloat n, Renderable (Path V2 n) b, IsName n1, IsName n2) => n1 -> n2 -> QDiagram b V2 n Any -> QDiagram b V2 n Any
connectOutside' :: (TypeableFloat n, Renderable (Path V2 n) b, IsName n1, IsName n2) => ArrowOpts n -> n1 -> n2 -> QDiagram b V2 n Any -> QDiagram b V2 n Any

-- | arrow len creates an arrow of length len with
--   default parameters, starting at the origin and ending at the point
--   (len,0).
arrow :: (TypeableFloat n, Renderable (Path V2 n) b) => n -> QDiagram b V2 n Any

-- | arrow' opts len creates an arrow of length len using
--   the given options, starting at the origin and ending at the point
--   (len,0). In particular, it scales the given arrowShaft
--   so that the entire arrow has length len.
arrow' :: (TypeableFloat n, Renderable (Path V2 n) b) => ArrowOpts n -> n -> QDiagram b V2 n Any

-- | Straight line arrow shaft.
straightShaft :: OrderedField n => Trail V2 n
data ArrowOpts n
ArrowOpts :: ArrowHT n -> ArrowHT n -> Trail V2 n -> Measure n -> Measure n -> Style V2 n -> Measure n -> Style V2 n -> Measure n -> Style V2 n -> ArrowOpts n
[_arrowHead] :: ArrowOpts n -> ArrowHT n
[_arrowTail] :: ArrowOpts n -> ArrowHT n
[_arrowShaft] :: ArrowOpts n -> Trail V2 n
[_headGap] :: ArrowOpts n -> Measure n
[_tailGap] :: ArrowOpts n -> Measure n
[_headStyle] :: ArrowOpts n -> Style V2 n
[_headLength] :: ArrowOpts n -> Measure n
[_tailStyle] :: ArrowOpts n -> Style V2 n
[_tailLength] :: ArrowOpts n -> Measure n
[_shaftStyle] :: ArrowOpts n -> Style V2 n

-- | A shape to place at the head of the arrow.
arrowHead :: Lens' (ArrowOpts n) (ArrowHT n)

-- | A shape to place at the tail of the arrow.
arrowTail :: Lens' (ArrowOpts n) (ArrowHT n)

-- | The trail to use for the arrow shaft.
arrowShaft :: Lens' (ArrowOpts n) (Trail V2 n)

-- | Distance to leave between the head and the target point.
headGap :: Lens' (ArrowOpts n) (Measure n)

-- | Distance to leave between the starting point and the tail.
tailGap :: Lens' (ArrowOpts n) (Measure n)

-- | Set both the headGap and tailGap simultaneously.
gaps :: Traversal' (ArrowOpts n) (Measure n)

-- | Same as gaps, provided for backward compatiiblity.
gap :: Traversal' (ArrowOpts n) (Measure n)

-- | A lens for setting or modifying the texture of an arrowhead. For
--   example, one may write ... (with & headTexture .~ grad)
--   to get an arrow with a head filled with a gradient, assuming grad has
--   been defined. Or ... (with & headTexture .~ solid blue to
--   set the head color to blue. For more general control over the style of
--   arrowheads, see headStyle.
headTexture :: TypeableFloat n => Lens' (ArrowOpts n) (Texture n)

-- | Style to apply to the head. headStyle is modified by using
--   the lens combinator %~ to change the current style. For
--   example, to change an opaque black arrowhead to translucent orange:
--   (with & headStyle %~ fc orange . opacity 0.75).
headStyle :: Lens' (ArrowOpts n) (Style V2 n)

-- | A lens for setting or modifying the texture of an arrow tail. This is
--   *not* a valid lens (see committed).
tailTexture :: TypeableFloat n => Lens' (ArrowOpts n) (Texture n)

-- | Style to apply to the tail. See headStyle.
tailStyle :: Lens' (ArrowOpts n) (Style V2 n)

-- | A lens for setting or modifying the texture of an arrow shaft.
shaftTexture :: TypeableFloat n => Lens' (ArrowOpts n) (Texture n)

-- | Style to apply to the shaft. See headStyle.
shaftStyle :: Lens' (ArrowOpts n) (Style V2 n)

-- | The length from the start of the joint to the tip of the head.
headLength :: Lens' (ArrowOpts n) (Measure n)

-- | The length of the tail plus its joint.
tailLength :: Lens' (ArrowOpts n) (Measure n)

-- | Set both the headLength and tailLength
--   simultaneously.
lengths :: Traversal' (ArrowOpts n) (Measure n)

-- | Create a primitive text diagram from the given string, with center
--   alignment, equivalent to alignedText 0.5 0.5.
--   
--   Note that it takes up no space, as text size information is not
--   available.
text :: (TypeableFloat n, Renderable (Text n) b) => String -> QDiagram b V2 n Any

-- | Create a primitive text diagram from the given string, origin at the
--   top left corner of the text's bounding box, equivalent to
--   alignedText 0 1.
--   
--   Note that it takes up no space.
topLeftText :: (TypeableFloat n, Renderable (Text n) b) => String -> QDiagram b V2 n Any

-- | Create a primitive text diagram from the given string, with the origin
--   set to a point interpolated within the bounding box. The first
--   parameter varies from 0 (left) to 1 (right), and the second parameter
--   from 0 (bottom) to 1 (top). Some backends do not implement this and
--   instead snap to closest corner or the center.
--   
--   The height of this box is determined by the font's potential ascent
--   and descent, rather than the height of the particular string.
--   
--   Note that it takes up no space.
alignedText :: (TypeableFloat n, Renderable (Text n) b) => n -> n -> String -> QDiagram b V2 n Any

-- | Create a primitive text diagram from the given string, with the origin
--   set to be on the baseline, at the beginning (although not bounding).
--   This is the reference point of showText in the Cairo graphics library.
--   
--   Note that it takes up no space.
baselineText :: (TypeableFloat n, Renderable (Text n) b) => String -> QDiagram b V2 n Any

-- | Specify a font family to be used for all text within a diagram.
font :: HasStyle a => String -> a -> a

-- | Set all text in italics.
italic :: HasStyle a => a -> a

-- | Set all text using an oblique slant.
oblique :: HasStyle a => a -> a

-- | Set the font size, that is, the size of the font's em-square as
--   measured within the current local vector space. The default size is
--   local 1 (which is applied by recommendFontSize).
fontSize :: (N a ~ n, Typeable n, HasStyle a) => Measure n -> a -> a

-- | Set all text using a bold font weight.
bold :: HasStyle a => a -> a

-- | Set all text to be bolder than the inherited font weight.
bolder :: HasStyle a => a -> a

-- | Set all text to be lighter than the inherited font weight.
lighter :: HasStyle a => a -> a

-- | Set all text using a thin font weight.
thinWeight :: HasStyle a => a -> a

-- | Set all text using a extra light font weight.
ultraLight :: HasStyle a => a -> a

-- | Set all text using a light font weight.
light :: HasStyle a => a -> a

-- | Set all text using a medium font weight.
mediumWeight :: HasStyle a => a -> a

-- | Set all text using a heavy/black font weight.
heavy :: HasStyle a => a -> a

-- | Set all text using a semi-bold font weight.
semiBold :: HasStyle a => a -> a

-- | Set all text using an ultra-bold font weight.
ultraBold :: HasStyle a => a -> a

-- | Lens onto the font name of a style.
_font :: Lens' (Style v n) (Maybe String)
_fontSizeR :: (Typeable n, OrderedField n) => Lens' (Style v n) (Measured n (Recommend n))

-- | Lens to commit a font size. This is *not* a valid lens (see
--   commited.
_fontSize :: (Typeable n, OrderedField n) => Lens' (Style v n) (Measure n)

-- | A convenient synonym for 'fontSize (Output w)'.
fontSizeO :: (N a ~ n, Typeable n, HasStyle a) => n -> a -> a

-- | A convenient sysnonym for 'fontSize (Local w)'.
fontSizeL :: (N a ~ n, Typeable n, Num n, HasStyle a) => n -> a -> a

-- | A convenient synonym for 'fontSize (Normalized w)'.
fontSizeN :: (N a ~ n, Typeable n, Num n, HasStyle a) => n -> a -> a

-- | A convenient synonym for 'fontSize (Global w)'.
fontSizeG :: (N a ~ n, Typeable n, Num n, HasStyle a) => n -> a -> a

-- | An image primitive, the two ints are width followed by height. Will
--   typically be created by loadImageEmb or loadImageExt
--   which, will handle setting the width and height to the actual width
--   and height of the image.
data DImage :: Type -> Type -> Type
[DImage] :: ImageData t -> Int -> Int -> Transformation V2 n -> DImage n t

-- | ImageData is either a JuicyPixels DynamicImage tagged
--   as Embedded or a reference tagged as External.
--   Additionally Native is provided for external libraries to hook
--   into.
data ImageData :: Type -> Type
[ImageRaster] :: DynamicImage -> ImageData Embedded
[ImageRef] :: FilePath -> ImageData External
[ImageNative] :: t -> ImageData (Native t)
data Embedded
data External
data Native (t :: Type)

-- | Make a DImage into a Diagram.
image :: (TypeableFloat n, Typeable a, Renderable (DImage n a) b) => DImage n a -> QDiagram b V2 n Any

-- | Use JuicyPixels to read a file in any format and wrap it in a
--   DImage. The width and height of the image are set to their
--   actual values.
loadImageEmb :: Num n => FilePath -> IO (Either String (DImage n Embedded))

-- | Check that a file exists, and use JuicyPixels to figure out the right
--   size, but save a reference to the image instead of the raster data
loadImageExt :: Num n => FilePath -> IO (Either String (DImage n External))

-- | Make an "unchecked" image reference; have to specify a width and
--   height. Unless the aspect ratio of the external image is the w :: h,
--   then the image will be distorted.
uncheckedImageRef :: Num n => FilePath -> Int -> Int -> DImage n External

-- | Create an image "from scratch" by specifying the pixel data
raster :: Num n => (Int -> Int -> AlphaColour Double) -> Int -> Int -> DImage n Embedded

-- | Crate a diagram from raw raster data.
rasterDia :: (TypeableFloat n, Renderable (DImage n Embedded) b) => (Int -> Int -> AlphaColour Double) -> Int -> Int -> QDiagram b V2 n Any

-- | Create a transformation which performs a rotation about the local
--   origin by the given angle. See also rotate.
rotation :: Floating n => Angle n -> Transformation V2 n

-- | Rotate about the local origin by the given angle. Positive angles
--   correspond to counterclockwise rotation, negative to clockwise. The
--   angle can be expressed using any of the Isos on Angle.
--   For example, rotate (1/4 @@ turn), rotate (tau/4
--   @@ rad), and rotate (90 @@ deg) all represent the same
--   transformation, namely, a counterclockwise rotation by a right angle.
--   To rotate about some point other than the local origin, see
--   rotateAbout.
--   
--   Note that writing rotate (1/4), with no Angle
--   constructor, will yield an error since GHC cannot figure out which
--   sort of angle you want to use. In this common situation you can use
--   rotateBy, which interprets its argument as a number of turns.
rotate :: (InSpace V2 n t, Transformable t, Floating n) => Angle n -> t -> t

-- | A synonym for rotate, interpreting its argument in units of
--   turns; it can be more convenient to write rotateBy (1/4) than
--   rotate (1/4 @@ turn).
rotateBy :: (InSpace V2 n t, Transformable t, Floating n) => n -> t -> t

-- | Use an Angle to make an ReifiedIso between an object
--   rotated and unrotated. This us useful for performing actions
--   under a rotation:
--   
--   
--   under (rotated t) f = rotate (negated t) . f . rotate t
--   rotated t ## a      = rotate t a
--   a ^. rotated t      = rotate (-t) a
--   over (rotated t) f  = rotate t . f . rotate (negated t)
--   
rotated :: (InSpace V2 n a, Floating n, SameSpace a b, Transformable a, Transformable b) => Angle n -> Iso a b a b

-- | rotationAbout p is a rotation about the point p
--   (instead of around the local origin).
rotationAround :: Floating n => P2 n -> Angle n -> T2 n

-- | rotateAbout p is like rotate, except it rotates around
--   the point p instead of around the local origin.
rotateAround :: (InSpace V2 n t, Transformable t, Floating n) => P2 n -> Angle n -> t -> t

-- | The rotation that aligns the x-axis with the given direction.
rotationTo :: OrderedField n => Direction V2 n -> T2 n

-- | Rotate around the local origin such that the x axis aligns with the
--   given direction.
rotateTo :: (InSpace V2 n t, OrderedField n, Transformable t) => Direction V2 n -> t -> t

-- | Construct a transformation which scales by the given factor in the x
--   (horizontal) direction.
scalingX :: (Additive v, R1 v, Fractional n) => n -> Transformation v n

-- | Scale a diagram by the given factor in the x (horizontal) direction.
--   To scale uniformly, use scale.
scaleX :: (InSpace v n t, R2 v, Fractional n, Transformable t) => n -> t -> t

-- | Construct a transformation which scales by the given factor in the y
--   (vertical) direction.
scalingY :: (Additive v, R2 v, Fractional n) => n -> Transformation v n

-- | Scale a diagram by the given factor in the y (vertical) direction. To
--   scale uniformly, use scale.
scaleY :: (InSpace v n t, R2 v, Fractional n, Transformable t) => n -> t -> t

-- | Create a uniform scaling transformation.
scaling :: forall (v :: Type -> Type) n. (Additive v, Fractional n) => n -> Transformation v n

-- | Scale uniformly in every dimension by the given scalar.
scale :: forall (v :: Type -> Type) n a. (InSpace v n a, Eq n, Fractional n, Transformable a) => n -> a -> a

-- | scaleToX w scales a diagram in the x (horizontal) direction
--   by whatever factor required to make its width w.
--   scaleToX should not be applied to diagrams with a width of 0,
--   such as vrule.
scaleToX :: (InSpace v n t, R2 v, Enveloped t, Transformable t) => n -> t -> t

-- | scaleToY h scales a diagram in the y (vertical) direction by
--   whatever factor required to make its height h.
--   scaleToY should not be applied to diagrams with a height of
--   0, such as hrule.
scaleToY :: (InSpace v n t, R2 v, Enveloped t, Transformable t) => n -> t -> t

-- | scaleUToX w scales a diagram uniformly by whatever
--   factor required to make its width w. scaleUToX
--   should not be applied to diagrams with a width of 0, such as
--   vrule.
scaleUToX :: (InSpace v n t, R1 v, Enveloped t, Transformable t) => n -> t -> t

-- | scaleUToY h scales a diagram uniformly by whatever
--   factor required to make its height h. scaleUToY
--   should not be applied to diagrams with a height of 0, such as
--   hrule.
scaleUToY :: (InSpace v n t, R2 v, Enveloped t, Transformable t) => n -> t -> t

-- | Construct a transformation which translates by the given distance in
--   the x (horizontal) direction.
translationX :: (Additive v, R1 v, Num n) => n -> Transformation v n

-- | Translate a diagram by the given distance in the x (horizontal)
--   direction.
translateX :: (InSpace v n t, R1 v, Transformable t) => n -> t -> t

-- | Construct a transformation which translates by the given distance in
--   the y (vertical) direction.
translationY :: (Additive v, R2 v, Num n) => n -> Transformation v n

-- | Translate a diagram by the given distance in the y (vertical)
--   direction.
translateY :: (InSpace v n t, R2 v, Transformable t) => n -> t -> t

-- | Create a translation.
translation :: v n -> Transformation v n

-- | Translate by a vector.
translate :: Transformable t => Vn t -> t -> t

-- | The angle-preserving linear map that aligns the x-axis unit vector
--   with the given vector. See also scaleRotateTo.
scalingRotationTo :: Floating n => V2 n -> T2 n

-- | Rotate and uniformly scale around the local origin such that the
--   x-axis aligns with the given vector. This satisfies the equation
--   
--   
--   scaleRotateTo v = rotateTo (dir v) . scale (norm v)
--   
--   
--   up to floating point rounding errors, but is more accurate and
--   performant since it avoids cancellable uses of trigonometric
--   functions.
scaleRotateTo :: (InSpace V2 n t, Transformable t, Floating n) => V2 n -> t -> t

-- | Construct a transformation which flips a diagram from left to right,
--   i.e. sends the point (x,y) to (-x,y).
reflectionX :: (Additive v, R1 v, Num n) => Transformation v n

-- | Flip a diagram from left to right, i.e. send the point (x,y) to
--   (-x,y).
reflectX :: (InSpace v n t, R1 v, Transformable t) => t -> t

-- | Construct a transformation which flips a diagram from top to bottom,
--   i.e. sends the point (x,y) to (x,-y).
reflectionY :: (Additive v, R2 v, Num n) => Transformation v n

-- | Flip a diagram from top to bottom, i.e. send the point (x,y) to
--   (x,-y).
reflectY :: (InSpace v n t, R2 v, Transformable t) => t -> t

-- | Construct a transformation which flips the diagram about x=y, i.e.
--   sends the point (x,y) to (y,x).
reflectionXY :: (Additive v, R2 v, Num n) => Transformation v n

-- | Flips the diagram about x=y, i.e. send the point (x,y) to (y,x).
reflectXY :: (InSpace v n t, R2 v, Transformable t) => t -> t

-- | reflectionAbout p d is a reflection in the line determined by
--   the point p and direction d.
reflectionAbout :: OrderedField n => P2 n -> Direction V2 n -> T2 n

-- | reflectAbout p d reflects a diagram in the line determined by
--   the point p and direction d.
reflectAbout :: (InSpace V2 n t, OrderedField n, Transformable t) => P2 n -> Direction V2 n -> t -> t

-- | shearingX d is the linear transformation which is the
--   identity on y coordinates and sends (0,1) to (d,1).
shearingX :: Num n => n -> T2 n

-- | shearX d performs a shear in the x-direction which sends
--   (0,1) to (d,1).
shearX :: (InSpace V2 n t, Transformable t) => n -> t -> t

-- | shearingY d is the linear transformation which is the
--   identity on x coordinates and sends (1,0) to (1,d).
shearingY :: Num n => n -> T2 n

-- | shearY d performs a shear in the y-direction which sends
--   (1,0) to (1,d).
shearY :: (InSpace V2 n t, Transformable t) => n -> t -> t

-- | The parallel projection onto the plane x=0
parallelX0 :: (R1 v, Num n) => Deformation v v n

-- | The perspective division onto the plane x=1 along lines going through
--   the origin.
perspectiveX1 :: (R1 v, Functor v, Fractional n) => Deformation v v n

-- | The parallel projection onto the plane y=0
parallelY0 :: (R2 v, Num n) => Deformation v v n

-- | The perspective division onto the plane y=1 along lines going through
--   the origin.
perspectiveY1 :: (R2 v, Functor v, Floating n) => Deformation v v n

-- | The viewing transform for a viewer facing along the positive X axis. X
--   coördinates stay fixed, while Y coördinates are compressed with
--   increasing distance. asDeformation (translation unitX) <>
--   parallelX0 <> frustrumX = perspectiveX1
facingX :: (R1 v, Functor v, Fractional n) => Deformation v v n
facingY :: (R2 v, Functor v, Fractional n) => Deformation v v n

-- | Place two diagrams (or other objects) vertically adjacent to one
--   another, with the first diagram above the second. Since Haskell
--   ignores whitespace in expressions, one can thus write
--   
--   
--    c
--   ===
--    d
--   
--   
--   
--   to place c above d. The local origin of the
--   resulting combined diagram is the same as the local origin of the
--   first. (===) is associative and has mempty as an
--   identity. See the documentation of beside for more information.
(===) :: (InSpace V2 n a, Juxtaposable a, Semigroup a) => a -> a -> a
infixl 6 ===

-- | Place two diagrams (or other juxtaposable objects) horizontally
--   adjacent to one another, with the first diagram to the left of the
--   second. The local origin of the resulting combined diagram is the same
--   as the local origin of the first. (|||) is associative and
--   has mempty as an identity. See the documentation of
--   beside for more information.
(|||) :: (InSpace V2 n a, Juxtaposable a, Semigroup a) => a -> a -> a
infixl 6 |||

-- | Lay out a list of juxtaposable objects in a row from left to right, so
--   that their local origins lie along a single horizontal line, with
--   successive envelopes tangent to one another.
--   
--   
--   
- For more control over the spacing, see hcat'.
--   
- To align the diagrams vertically (or otherwise), use alignment
--   combinators (such as alignT or alignB) from
--   Diagrams.TwoD.Align before applying hcat.
--   
- For non-axis-aligned layout, see cat.
--   
hcat :: (InSpace V2 n a, Floating n, Juxtaposable a, HasOrigin a, Monoid' a) => [a] -> a

-- | A variant of hcat taking an extra CatOpts record to
--   control the spacing. See the cat' documentation for a
--   description of the possibilities. For the common case of setting just
--   a separation amount, see hsep.
hcat' :: (InSpace V2 n a, Floating n, Juxtaposable a, HasOrigin a, Monoid' a) => CatOpts n -> [a] -> a

-- | A convenient synonym for horizontal concatenation with separation:
--   hsep s === hcat' (with & sep .~ s).
hsep :: (InSpace V2 n a, Floating n, Juxtaposable a, HasOrigin a, Monoid' a) => n -> [a] -> a

-- | Lay out a list of juxtaposable objects in a column from top to bottom,
--   so that their local origins lie along a single vertical line, with
--   successive envelopes tangent to one another.
--   
--   
--   
- For more control over the spacing, see vcat'.
--   
- To align the diagrams horizontally (or otherwise), use alignment
--   combinators (such as alignL or alignR) from
--   Diagrams.TwoD.Align before applying vcat.
--   
- For non-axis-aligned layout, see cat.
--   
vcat :: (InSpace V2 n a, Floating n, Juxtaposable a, HasOrigin a, Monoid' a) => [a] -> a

-- | A variant of vcat taking an extra CatOpts record to
--   control the spacing. See the cat' documentation for a
--   description of the possibilities. For the common case of setting just
--   a separation amount, see vsep.
vcat' :: (InSpace V2 n a, Floating n, Juxtaposable a, HasOrigin a, Monoid' a) => CatOpts n -> [a] -> a

-- | A convenient synonym for vertical concatenation with separation:
--   vsep s === vcat' (with & sep .~ s).
vsep :: (InSpace V2 n a, Floating n, Juxtaposable a, HasOrigin a, Monoid' a) => n -> [a] -> a

-- | strutX w is an empty diagram with width w, height 0,
--   and a centered local origin. Note that strutX (-w) behaves
--   the same as strutX w.
strutX :: (Metric v, R1 v, OrderedField n) => n -> QDiagram b v n m

-- | strutY h is an empty diagram with height h, width 0,
--   and a centered local origin. Note that strutY (-h) behaves
--   the same as strutY h.
strutY :: (Metric v, R2 v, OrderedField n) => n -> QDiagram b v n m

-- | padX s "pads" a diagram in the x-direction, expanding its
--   envelope horizontally by a factor of s (factors between 0 and
--   1 can be used to shrink the envelope). Note that the envelope will
--   expand with respect to the local origin, so if the origin is not
--   centered horizontally the padding may appear "uneven". If this is not
--   desired, the origin can be centered (using centerX) before
--   applying padX.
padX :: (Metric v, R2 v, OrderedField n, Monoid' m) => n -> QDiagram b v n m -> QDiagram b v n m

-- | padY s "pads" a diagram in the y-direction, expanding its
--   envelope vertically by a factor of s (factors between 0 and 1
--   can be used to shrink the envelope). Note that the envelope will
--   expand with respect to the local origin, so if the origin is not
--   centered vertically the padding may appear "uneven". If this is not
--   desired, the origin can be centered (using centerY) before
--   applying padY.
padY :: (Metric v, R2 v, Monoid' m, OrderedField n) => n -> QDiagram b v n m -> QDiagram b v n m

-- | extrudeLeft s "extrudes" a diagram in the negative
--   x-direction, offsetting its envelope by the provided distance. When
--    s < 0 , the envelope is inset instead.
--   
--   See the documentation for extrudeEnvelope for more information.
extrudeLeft :: (OrderedField n, Monoid' m) => n -> QDiagram b V2 n m -> QDiagram b V2 n m

-- | extrudeRight s "extrudes" a diagram in the positive
--   x-direction, offsetting its envelope by the provided distance. When
--    s < 0 , the envelope is inset instead.
--   
--   See the documentation for extrudeEnvelope for more information.
extrudeRight :: (OrderedField n, Monoid' m) => n -> QDiagram b V2 n m -> QDiagram b V2 n m

-- | extrudeBottom s "extrudes" a diagram in the negative
--   y-direction, offsetting its envelope by the provided distance. When
--    s < 0 , the envelope is inset instead.
--   
--   See the documentation for extrudeEnvelope for more information.
extrudeBottom :: (OrderedField n, Monoid' m) => n -> QDiagram b V2 n m -> QDiagram b V2 n m

-- | extrudeTop s "extrudes" a diagram in the positive
--   y-direction, offsetting its envelope by the provided distance. When
--    s < 0 , the envelope is inset instead.
--   
--   See the documentation for extrudeEnvelope for more information.
extrudeTop :: (OrderedField n, Monoid' m) => n -> QDiagram b V2 n m -> QDiagram b V2 n m

-- | rectEnvelope p v sets the envelope of a diagram to a
--   rectangle whose lower-left corner is at p and whose
--   upper-right corner is at p .+^ v. Useful for selecting the
--   rectangular portion of a diagram which should actually be "viewed" in
--   the final render, if you don't want to see the entire diagram.
rectEnvelope :: forall b n m. (OrderedField n, Monoid' m) => Point V2 n -> V2 n -> QDiagram b V2 n m -> QDiagram b V2 n m

-- | A synonym for rectEnvelope.
crop :: forall b n m. (OrderedField n, Monoid' m) => Point V2 n -> V2 n -> QDiagram b V2 n m -> QDiagram b V2 n m

-- | Construct a bounding rectangle for an enveloped object, that is, the
--   smallest axis-aligned rectangle which encloses the object.
boundingRect :: (InSpace V2 n a, SameSpace a t, Enveloped t, Transformable t, TrailLike t, Monoid t, Enveloped a) => a -> t

-- | "Set the background color" of a diagram. That is, place a diagram atop
--   a bounding rectangle of the given color. The background does not
--   change the result of queries.
bg :: (TypeableFloat n, Renderable (Path V2 n) b, Monoid' q) => Colour Double -> QDiagram b V2 n q -> QDiagram b V2 n q

-- | Similar to bg but makes the colored background rectangle larger
--   than the diagram. The first parameter is used to set how far the
--   background extends beyond the diagram. The background does not change
--   the result of queries.
bgFrame :: (TypeableFloat n, Renderable (Path V2 n) b, Monoid' q) => n -> Colour Double -> QDiagram b V2 n q -> QDiagram b V2 n q

-- | Align along the left edge, i.e. translate the diagram in a horizontal
--   direction so that the local origin is on the left edge of the
--   envelope.
alignL :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Align along the right edge.
alignR :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Align along the top edge.
alignT :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Align along the bottom edge.
alignB :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a
alignTL :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a
alignTR :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a
alignBL :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a
alignBR :: (InSpace V2 n a, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | alignX and snugX move the local origin horizontally
--   as follows:
--   
--   
--   
- alignX (-1) moves the local origin to the left edge of
--   the boundary;
--   
- align 1 moves the local origin to the right edge;
--   
- any other argument interpolates linearly between these. For
--   example, alignX 0 centers, alignX 2 moves the origin
--   one "radius" to the right of the right edge, and so on.
--   
- snugX works the same way.
--   
alignX :: (InSpace v n a, R1 v, Fractional n, Alignable a, HasOrigin a) => n -> a -> a

-- | Like alignX, but moving the local origin vertically, with an
--   argument of 1 corresponding to the top edge and (-1)
--   corresponding to the bottom edge.
alignY :: (InSpace v n a, R2 v, Fractional n, Alignable a, HasOrigin a) => n -> a -> a

-- | Center the local origin along the X-axis.
centerX :: (InSpace v n a, R1 v, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Center the local origin along the Y-axis.
centerY :: (InSpace v n a, R2 v, Fractional n, Alignable a, HasOrigin a) => a -> a

-- | Center along both the X- and Y-axes.
centerXY :: (InSpace v n a, R2 v, Fractional n, Alignable a, HasOrigin a) => a -> a
snugL :: (InSpace V2 n a, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
snugR :: (InSpace V2 n a, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
snugT :: (InSpace V2 n a, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
snugB :: (InSpace V2 n a, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a

-- | See the documentation for alignX.
snugX :: (InSpace v n a, R1 v, Fractional n, Alignable a, Traced a, HasOrigin a) => n -> a -> a

-- | See the documentation for alignY.
snugY :: (InSpace v n a, R2 v, Fractional n, Alignable a, Traced a, HasOrigin a) => n -> a -> a
snugCenterX :: (InSpace v n a, R1 v, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
snugCenterY :: (InSpace v n a, R2 v, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a
snugCenterXY :: (InSpace v n a, R2 v, Fractional n, Alignable a, Traced a, HasOrigin a) => a -> a

-- | Compute the width of an enveloped object.
--   
--   Note this is just diameter unitX.
width :: (InSpace V2 n a, Enveloped a) => a -> n

-- | Compute the height of an enveloped object.
height :: (InSpace V2 n a, Enveloped a) => a -> n

-- | Compute the absolute x-coordinate range of an enveloped object in the
--   form (lo,hi). Return Nothing for objects with an
--   empty envelope.
--   
--   Note this is just extent unitX.
extentX :: (InSpace v n a, R1 v, Enveloped a) => a -> Maybe (n, n)

-- | Compute the absolute y-coordinate range of an enveloped object in the
--   form (lo,hi). Return Nothing for objects with an
--   empty envelope.
extentY :: (InSpace v n a, R2 v, Enveloped a) => a -> Maybe (n, n)

-- | Make a SizeSpec from possibly-specified width and height.
mkSizeSpec2D :: Num n => Maybe n -> Maybe n -> SizeSpec V2 n

-- | Make a SizeSpec with only width defined.
mkWidth :: Num n => n -> SizeSpec V2 n

-- | Make a SizeSpec with only height defined.
mkHeight :: Num n => n -> SizeSpec V2 n

-- | Make a SizeSpec from a width and height.
dims2D :: n -> n -> SizeSpec V2 n

-- | A Texture is either a color SC, linear gradient LG, or
--   radial gradient RG. An object can have only one texture which
--   is determined by the Last semigroup structure.
data Texture n
SC :: SomeColor -> Texture n
LG :: LGradient n -> Texture n
RG :: RGradient n -> Texture n

-- | Convert a solid colour into a texture.
solid :: Color a => a -> Texture n

-- | The SpreadMethod determines what happens before
--   lGradStart and after lGradEnd. GradPad fills the
--   space before the start of the gradient with the color of the first
--   stop and the color after end of the gradient with the color of the
--   last stop. GradRepeat restarts the gradient and
--   GradReflect restarts the gradient with the stops in reverse
--   order.
data SpreadMethod
GradPad :: SpreadMethod
GradReflect :: SpreadMethod
GradRepeat :: SpreadMethod

-- | A gradient stop contains a color and fraction (usually between 0 and
--   1)
data GradientStop d
GradientStop :: SomeColor -> d -> GradientStop d
[_stopColor] :: GradientStop d -> SomeColor
[_stopFraction] :: GradientStop d -> d
_FillTexture :: Iso' (FillTexture n) (Recommend (Texture n))
fillTexture :: (InSpace V2 n a, Typeable n, Floating n, HasStyle a) => Texture n -> a -> a

-- | Commit a fill texture in a style. This is not a valid setter
--   because it doesn't abide the functor law (see committed).
_fillTexture :: (Typeable n, Floating n) => Lens' (Style V2 n) (Texture n)
getFillTexture :: FillTexture n -> Texture n
_LineTexture :: Iso (LineTexture n) (LineTexture n') (Texture n) (Texture n')
lineTexture :: (InSpace V2 n a, Typeable n, Floating n, HasStyle a) => Texture n -> a -> a
_lineTexture :: (Floating n, Typeable n) => Lens' (Style V2 n) (Texture n)
lineTextureA :: (InSpace V2 n a, Typeable n, Floating n, HasStyle a) => LineTexture n -> a -> a
getLineTexture :: LineTexture n -> Texture n

-- | The fraction for stop.
stopFraction :: Lens' (GradientStop n) n

-- | A color for the stop.
stopColor :: Lens' (GradientStop n) SomeColor

-- | A convenient function for making gradient stops from a list of
--   triples. (An opaque color, a stop fraction, an opacity).
mkStops :: [(Colour Double, d, Double)] -> [GradientStop d]

-- | Linear Gradient
data LGradient n
LGradient :: [GradientStop n] -> Point V2 n -> Point V2 n -> Transformation V2 n -> SpreadMethod -> LGradient n
[_lGradStops] :: LGradient n -> [GradientStop n]
[_lGradStart] :: LGradient n -> Point V2 n
[_lGradEnd] :: LGradient n -> Point V2 n
[_lGradTrans] :: LGradient n -> Transformation V2 n
[_lGradSpreadMethod] :: LGradient n -> SpreadMethod
_LG :: forall n_a1Wn9. Prism' (Texture n_a1Wn9) (LGradient n_a1Wn9)

-- | A list of stops (colors and fractions).
lGradStops :: Lens' (LGradient n) [GradientStop n]

-- | A transformation to be applied to the gradient. Usually this field
--   will start as the identity transform and capture the transforms that
--   are applied to the gradient.
lGradTrans :: Lens' (LGradient n) (Transformation V2 n)

-- | The starting point for the first gradient stop. The coordinates are in
--   local units and the default is (-0.5, 0).
lGradStart :: Lens' (LGradient n) (Point V2 n)

-- | The ending point for the last gradient stop.The coordinates are in
--   local units and the default is (0.5, 0).
lGradEnd :: Lens' (LGradient n) (Point V2 n)

-- | For setting the spread method.
lGradSpreadMethod :: Lens' (LGradient n) SpreadMethod

-- | A default is provided so that linear gradients can easily be created
--   using lenses. For example, lg = defaultLG & lGradStart .~
--   (0.25 ^& 0.33). Note that no default value is provided for
--   lGradStops, this must be set before the gradient value is
--   used, otherwise the object will appear transparent.
defaultLG :: Fractional n => Texture n

-- | Make a linear gradient texture from a stop list, start point, end
--   point, and SpreadMethod. The lGradTrans field is set to
--   the identity transfrom, to change it use the lGradTrans lens.
mkLinearGradient :: Num n => [GradientStop n] -> Point V2 n -> Point V2 n -> SpreadMethod -> Texture n

-- | Radial Gradient
data RGradient n
RGradient :: [GradientStop n] -> Point V2 n -> n -> Point V2 n -> n -> Transformation V2 n -> SpreadMethod -> RGradient n
[_rGradStops] :: RGradient n -> [GradientStop n]
[_rGradCenter0] :: RGradient n -> Point V2 n
[_rGradRadius0] :: RGradient n -> n
[_rGradCenter1] :: RGradient n -> Point V2 n
[_rGradRadius1] :: RGradient n -> n
[_rGradTrans] :: RGradient n -> Transformation V2 n
[_rGradSpreadMethod] :: RGradient n -> SpreadMethod

-- | A list of stops (colors and fractions).
rGradStops :: Lens' (RGradient n) [GradientStop n]

-- | The center point of the inner circle.
rGradCenter0 :: Lens' (RGradient n) (Point V2 n)

-- | The radius of the inner cirlce in local coordinates.
rGradRadius0 :: Lens' (RGradient n) n

-- | The center of the outer circle.
rGradCenter1 :: Lens' (RGradient n) (Point V2 n)

-- | The radius of the outer circle in local coordinates.
rGradRadius1 :: Lens' (RGradient n) n

-- | A transformation to be applied to the gradient. Usually this field
--   will start as the identity transform and capture the transforms that
--   are applied to the gradient.
rGradTrans :: Lens' (RGradient n) (Transformation V2 n)

-- | For setting the spread method.
rGradSpreadMethod :: Lens' (RGradient n) SpreadMethod

-- | A default is provided so that radial gradients can easily be created
--   using lenses. For example, rg = defaultRG & rGradRadius1 .~
--   0.25. Note that no default value is provided for
--   rGradStops, this must be set before the gradient value is
--   used, otherwise the object will appear transparent.
defaultRG :: Fractional n => Texture n
_RG :: forall n_a1Wn9. Prism' (Texture n_a1Wn9) (RGradient n_a1Wn9)

-- | Make a radial gradient texture from a stop list, radius, start point,
--   end point, and SpreadMethod. The rGradTrans field is set
--   to the identity transfrom, to change it use the rGradTrans
--   lens.
mkRadialGradient :: Num n => [GradientStop n] -> Point V2 n -> n -> Point V2 n -> n -> SpreadMethod -> Texture n

-- | Set the fill color. This function is polymorphic in the color type (so
--   it can be used with either Colour or AlphaColour), but
--   this can sometimes create problems for type inference, so the
--   fc and fcA variants are provided with more concrete
--   types.
fillColor :: (InSpace V2 n a, Color c, Typeable n, Floating n, HasStyle a) => c -> a -> a
_SC :: forall n_a1Wn9. Prism' (Texture n_a1Wn9) SomeColor

-- | Prism onto an AlphaColour Double of a SC texture.
_AC :: Prism' (Texture n) (AlphaColour Double)

-- | A synonym for fillColor, specialized to Colour
--   Double (i.e. opaque colors). See comment after fillColor
--   about backends.
fc :: (InSpace V2 n a, Floating n, Typeable n, HasStyle a) => Colour Double -> a -> a

-- | A synonym for fillColor, specialized to AlphaColour
--   Double (i.e. colors with transparency). See comment after
--   fillColor about backends.
fcA :: (InSpace V2 n a, Floating n, Typeable n, HasStyle a) => AlphaColour Double -> a -> a

-- | Set a "recommended" fill color, to be used only if no explicit calls
--   to fillColor (or fc, or fcA) are used. See
--   comment after fillColor about backends.
recommendFillColor :: (InSpace V2 n a, Color c, Typeable n, Floating n, HasStyle a) => c -> a -> a

-- | Set the line (stroke) color. This function is polymorphic in the color
--   type (so it can be used with either Colour or
--   AlphaColour), but this can sometimes create problems for type
--   inference, so the lc and lcA variants are provided with
--   more concrete types.
lineColor :: (InSpace V2 n a, Color c, Typeable n, Floating n, HasStyle a) => c -> a -> a

-- | A synonym for lineColor, specialized to Colour
--   Double (i.e. opaque colors). See comment in lineColor
--   about backends.
lc :: (InSpace V2 n a, Typeable n, Floating n, HasStyle a) => Colour Double -> a -> a

-- | A synonym for lineColor, specialized to AlphaColour
--   Double (i.e. colors with transparency). See comment in
--   lineColor about backends.
lcA :: (InSpace V2 n a, Typeable n, Floating n, HasStyle a) => AlphaColour Double -> a -> a

-- | Mark the origin of a diagram by placing a red dot 1/50th its size.
showOrigin :: (TypeableFloat n, Renderable (Path V2 n) b, Monoid' m) => QDiagram b V2 n m -> QDiagram b V2 n m

-- | Mark the origin of a diagram, with control over colour and scale of
--   marker dot.
showOrigin' :: (TypeableFloat n, Renderable (Path V2 n) b, Monoid' m) => OriginOpts n -> QDiagram b V2 n m -> QDiagram b V2 n m
data OriginOpts n
OriginOpts :: Colour Double -> n -> n -> OriginOpts n
[_oColor] :: OriginOpts n -> Colour Double
[_oScale] :: OriginOpts n -> n
[_oMinSize] :: OriginOpts n -> n
oColor :: forall n_a2f1w. Lens' (OriginOpts n_a2f1w) (Colour Double)
oScale :: forall n_a2f1w. Lens' (OriginOpts n_a2f1w) n_a2f1w
oMinSize :: forall n_a2f1w. Lens' (OriginOpts n_a2f1w) n_a2f1w

-- | Mark the envelope with an approximating cubic spline using 32 points,
--   medium line width and red line color.
showEnvelope :: (Enum n, TypeableFloat n, Renderable (Path V2 n) b) => QDiagram b V2 n Any -> QDiagram b V2 n Any

-- | Mark the envelope with an approximating cubic spline with control over
--   the color, line width and number of points.
showEnvelope' :: (Enum n, TypeableFloat n, Renderable (Path V2 n) b) => EnvelopeOpts n -> QDiagram b V2 n Any -> QDiagram b V2 n Any
data EnvelopeOpts n
EnvelopeOpts :: Colour Double -> Measure n -> Int -> EnvelopeOpts n
[_eColor] :: EnvelopeOpts n -> Colour Double
[_eLineWidth] :: EnvelopeOpts n -> Measure n
[_ePoints] :: EnvelopeOpts n -> Int
eColor :: forall n_a2f2B. Lens' (EnvelopeOpts n_a2f2B) (Colour Double)
eLineWidth :: forall n_a2f2B n_a2f5A. Lens (EnvelopeOpts n_a2f2B) (EnvelopeOpts n_a2f5A) (Measure n_a2f2B) (Measure n_a2f5A)
ePoints :: forall n_a2f2B. Lens' (EnvelopeOpts n_a2f2B) Int

-- | Mark the trace of a diagram by placing 64 red dots 1/100th its size
--   along the trace.
showTrace :: (Enum n, TypeableFloat n, Renderable (Path V2 n) b) => QDiagram b V2 n Any -> QDiagram b V2 n Any

-- | Mark the trace of a diagram, with control over colour and scale of
--   marker dot and the number of points on the trace.
showTrace' :: (Enum n, TypeableFloat n, Renderable (Path V2 n) b) => TraceOpts n -> QDiagram b V2 n Any -> QDiagram b V2 n Any
data TraceOpts n
TraceOpts :: Colour Double -> n -> n -> Int -> TraceOpts n
[_tColor] :: TraceOpts n -> Colour Double
[_tScale] :: TraceOpts n -> n
[_tMinSize] :: TraceOpts n -> n
[_tPoints] :: TraceOpts n -> Int
tColor :: forall n_a2f5Z. Lens' (TraceOpts n_a2f5Z) (Colour Double)
tScale :: forall n_a2f5Z. Lens' (TraceOpts n_a2f5Z) n_a2f5Z
tMinSize :: forall n_a2f5Z. Lens' (TraceOpts n_a2f5Z) n_a2f5Z
tPoints :: forall n_a2f5Z. Lens' (TraceOpts n_a2f5Z) Int
showLabels :: (TypeableFloat n, Renderable (Text n) b, Semigroup m) => QDiagram b V2 n m -> QDiagram b V2 n Any

-- | A default diagram-adjustment implementation for two-dimensional
--   diagrams, useful for backend implementors.
module Diagrams.TwoD.Adjust

-- | Set default attributes of a 2D diagram (in case they have not been
--   set):
--   
--   
--   
- LineWidth: 0.01
--   
- LineTexture: solid black
--   
- LineCap: LineCapButt
--   
- LineJoin: miter
--   
- MiterLimit: 10
--   
setDefault2DAttributes :: (TypeableFloat n, Semigroup m) => QDiagram b V2 n m -> QDiagram b V2 n m

-- | Adjust the size and position of a 2D diagram to fit within the
--   requested size. The first argument is a lens into the output size
--   contained in the rendering options. Returns an updated options record,
--   any transformation applied to the diagram (the inverse of which can be
--   used, say, to translate output/device coordinates back into local
--   diagram coordinates), and the modified diagram itself.
adjustSize2D :: (TypeableFloat n, Monoid' m) => Lens' (Options b V2 n) (SizeSpec V2 n) -> b -> Options b V2 n -> QDiagram b V2 n m -> (Options b V2 n, Transformation V2 n, QDiagram b V2 n m)

-- | adjustDia2D provides a useful default implementation of the
--   adjustDia method from the Backend type class.
--   
--   As its first argument it requires a lens into the output size
--   contained in the rendering options.
--   
--   It then performs the following adjustments:
--   
--   
--   
- Set default attributes (see setDefault2DAttributes)
--   
- Scale and translate the diagram to fit within the requested size
--   (see adjustDiaSize2D)
--   
--   
--   It returns an updated options record, any transformation applied to
--   the diagram (the inverse of which can be used, say, to translate
--   output/device coordinates back into local diagram coordinates), and
--   the modified diagram itself.
adjustDia2D :: (TypeableFloat n, Monoid' m) => Lens' (Options b V2 n) (SizeSpec V2 n) -> b -> Options b V2 n -> QDiagram b V2 n m -> (Options b V2 n, Transformation V2 n, QDiagram b V2 n m)

-- | Utilities for working with sizes of three-dimensional objects.
module Diagrams.ThreeD.Size

-- | Compute the absolute x-coordinate range of an enveloped object in the
--   form (lo,hi). Return Nothing for objects with an
--   empty envelope.
--   
--   Note this is just extent unitX.
extentX :: (InSpace v n a, R1 v, Enveloped a) => a -> Maybe (n, n)

-- | Compute the absolute y-coordinate range of an enveloped object in the
--   form (lo,hi). Return Nothing for objects with an
--   empty envelope.
extentY :: (InSpace v n a, R2 v, Enveloped a) => a -> Maybe (n, n)

-- | Compute the absolute z-coordinate range of an enveloped object in the
--   form (lo,hi). Return Nothing for objects with an
--   empty envelope.
extentZ :: (InSpace v n a, R3 v, Enveloped a) => a -> Maybe (n, n)

-- | Make a SizeSpec from possibly-specified width and height.
mkSizeSpec3D :: Num n => Maybe n -> Maybe n -> Maybe n -> SizeSpec V3 n

-- | Make a SizeSpec from a width and height.
dims3D :: n -> n -> n -> SizeSpec V3 n

-- | An animation is a time-varying diagram, together with start and end
--   times. Most of the tools for working with animations can actually be
--   found in the active package, which defines the Active
--   type.
--   
--   XXX more documentation and examples should go here
module Diagrams.Animation

-- | A value of type QAnimation b v m is an animation (a
--   time-varying diagram with start and end times) that can be rendered by
--   backend b, with vector space v and monoidal
--   annotations of type m.
type QAnimation b v n m = Active (QDiagram b v n m)

-- | A value of type Animation b v is an animation (a time-varying
--   diagram with start and end times) in vector space v that can
--   be rendered by backspace b.
--   
--   Note that Animation is actually a synonym for
--   QAnimation where the type of the monoidal annotations has
--   been fixed to Any (the default).
type Animation b v n = QAnimation b v n Any

-- | Automatically assign fixed a envelope to the entirety of an animation
--   by sampling the envelope at a number of points in time and taking the
--   union of all the sampled envelopes to form the "hull". This hull is
--   then used uniformly throughout the animation.
--   
--   This is useful when you have an animation that grows and shrinks in
--   size or shape over time, but you want it to take up a fixed amount of
--   space, e.g. so that the final rendered movie does not zoom in
--   and out, or so that it occupies a fixed location with respect to
--   another animation, when combining animations with something like
--   |||.
--   
--   By default, 30 samples per time unit are used; to adjust this number
--   see animEnvelope'.
--   
--   See also animRect for help constructing a background to go
--   behind an animation.
animEnvelope :: (OrderedField n, Metric v, Monoid' m) => QAnimation b v n m -> QAnimation b v n m

-- | Like animEnvelope, but with an adjustible sample rate. The
--   first parameter is the number of samples per time unit to use. Lower
--   rates will be faster but less accurate; higher rates are more accurate
--   but slower.
animEnvelope' :: (OrderedField n, Metric v, Monoid' m) => Rational -> QAnimation b v n m -> QAnimation b v n m

-- | animRect works similarly to animEnvelope for 2D
--   diagrams, but instead of adjusting the envelope, simply returns the
--   smallest bounding rectangle which encloses the entire animation.
--   Useful for e.g. creating a background to go behind an
--   animation.
--   
--   Uses 30 samples per time unit by default; to adjust this number see
--   animRect'.
animRect :: (InSpace V2 n t, Monoid' m, TrailLike t, Enveloped t, Transformable t, Monoid t) => QAnimation b V2 n m -> t

-- | Like animRect, but with an adjustible sample rate. The first
--   parameter is the number of samples per time unit to use. Lower rates
--   will be faster but less accurate; higher rates are more accurate but
--   slower.
animRect' :: (InSpace V2 n t, Monoid' m, TrailLike t, Enveloped t, Transformable t, Monoid t) => Rational -> QAnimation b V2 n m -> t

-- | Convenient creation of command-line-driven executables for rendering
--   diagrams. This module provides a general framework and default
--   behaviors for parsing command-line arguments, records for diagram
--   creation options in various forms, and classes and instances for a
--   unified entry point to command-line-driven diagram creation
--   executables.
--   
--   For a tutorial on command-line diagram creation see
--   https://diagrams.github.io/doc/cmdline.html.
module Diagrams.Backend.CmdLine

-- | Standard options most diagrams are likely to have.
data DiagramOpts
DiagramOpts :: Maybe Int -> Maybe Int -> FilePath -> DiagramOpts

-- | Final output width of diagram.
[_width] :: DiagramOpts -> Maybe Int

-- | Final output height of diagram.
[_height] :: DiagramOpts -> Maybe Int

-- | Output file path, format is typically chosen by extension.
[_output] :: DiagramOpts -> FilePath

-- | Command line parser for DiagramOpts. Width is option
--   --width or -w. Height is option --height or
--   -h (note we change help to be -? due to this).
--   Output is option --output or -o.
diagramOpts :: Parser DiagramOpts
width :: Lens' DiagramOpts (Maybe Int)
height :: Lens' DiagramOpts (Maybe Int)
output :: Lens' DiagramOpts FilePath

-- | Extra options for a program that can offer a choice between multiple
--   diagrams.
data DiagramMultiOpts
DiagramMultiOpts :: Maybe String -> Bool -> DiagramMultiOpts

-- | Selected diagram to render.
[_selection] :: DiagramMultiOpts -> Maybe String

-- | Flag to indicate that a list of available diagrams should be printed
--   to standard out.
[_list] :: DiagramMultiOpts -> Bool

-- | Command line parser for DiagramMultiOpts. Selection is option
--   --selection or -S. List is --list or
--   -L.
diagramMultiOpts :: Parser DiagramMultiOpts
selection :: Lens' DiagramMultiOpts (Maybe String)
list :: Lens' DiagramMultiOpts Bool

-- | Extra options for animations.
data DiagramAnimOpts
DiagramAnimOpts :: Double -> DiagramAnimOpts

-- | Number of frames per unit time to generate for the animation.
[_fpu] :: DiagramAnimOpts -> Double

-- | Command line parser for DiagramAnimOpts Frames per unit is
--   --fpu or -f.
diagramAnimOpts :: Parser DiagramAnimOpts
fpu :: Iso' DiagramAnimOpts Double

-- | Extra options for command-line looping.
data DiagramLoopOpts
DiagramLoopOpts :: Bool -> Maybe FilePath -> DiagramLoopOpts

-- | Flag to indicate that the program should loop creation.
[_loop] :: DiagramLoopOpts -> Bool

-- | File path for the source file to recompile.
[_src] :: DiagramLoopOpts -> Maybe FilePath

-- | CommandLine parser for DiagramLoopOpts Loop is --loop
--   or -l. Source is --src or -s.
diagramLoopOpts :: Parser DiagramLoopOpts
loop :: Lens' DiagramLoopOpts Bool
src :: Lens' DiagramLoopOpts (Maybe FilePath)

-- | Parseable instances give a command line parser for a type. If a custom
--   parser for a common type is wanted a newtype wrapper could be used to
--   make a new Parseable instance. Notice that we do not
--   want as many instances as Read because we want to limit
--   ourselves to things that make sense to parse from the command line.
class Parseable a
parser :: Parseable a => Parser a

-- | Parses a hexadecimal color. The string can start with "0x" or
--   "#" or just be a string of hexadecimal values. If four or
--   three digits are given each digit is repeated to form a full 24 or 32
--   bit color. For example, "0xfc4" is the same as
--   "0xffcc44". When eight or six digits are given each pair of
--   digits is a color or alpha channel with the order being red, green,
--   blue, alpha.
readHexColor :: (Applicative m, MonadFail m) => String -> m (AlphaColour Double)

-- | This class represents the various ways we want to support diagram
--   creation from the command line. It has the right instances to select
--   between creating single static diagrams, multiple static diagrams,
--   static animations, and functions that produce diagrams as long as the
--   arguments are Parseable.
--   
--   Backends are expected to create Mainable instances for the
--   types that are suitable for generating output in the backend's format.
--   For instance, Postscript can handle single diagrams, pages of
--   diagrams, animations as separate files, and association lists. This
--   implies instances for Diagram Postscript R2, [Diagram
--   Postscript R2], Animation Postscript R2, and
--   [(String,Diagram Postscript R2)]. We can consider these as
--   the base cases for the function instance.
--   
--   The associated type MainOpts describes the options which need
--   to be parsed from the command-line and passed to mainRender.
class Mainable d where {
    
    -- | Associated type that describes the options which need to be parsed
    --   from the command-line and passed to <tt>mainRender</tt>.
    type MainOpts d :: Type;
}

-- | This method invokes the command-line parser resulting in an options
--   value or ending the program with an error or help message. Typically
--   the default instance will work. If a different help message or parsing
--   behavior is desired a new implementation is appropriate.
mainArgs :: (Mainable d, Parseable (MainOpts d)) => proxy d -> IO (MainOpts d)

-- | Backend specific work of rendering with the given options and mainable
--   value is done here. All backend instances should implement this
--   method.
mainRender :: Mainable d => MainOpts d -> d -> IO ()

-- | Main entry point for command-line diagram creation. This is the method
--   that users will call from their program main. For instance an
--   expected user program would take the following form.
--   
--   
--   import Diagrams.Prelude
--   import Diagrams.Backend.TheBestBackend.CmdLine
--   
--   d :: Diagram B R2
--   d = ...
--   
--   main = mainWith d
--   
--   
--   Most backends should be able to use the default implementation. A
--   different implementation should be used to handle more complex
--   interactions with the user.
mainWith :: (Mainable d, Parseable (MainOpts d)) => d -> IO ()

-- | This class allows us to abstract over functions that take some
--   arguments and produce a final value. When some d is an
--   instance of ToResult we get a type Args d that
--   is a type of all the arguments at once, and a type
--   ResultOf d that is the type of the final result from
--   some base case instance.
class ToResult d where {
    type Args d :: Type;
    type ResultOf d :: Type;
}
toResult :: ToResult d => d -> Args d -> ResultOf d

-- | defaultAnimMainRender is an implementation of
--   mainRender which renders an animation as numbered frames, named
--   by extending the given output file name by consecutive integers. For
--   example if the given output file name is foo/blah.ext, the
--   frames will be saved in foo/blah001.ext,
--   foo/blah002.ext, and so on (the number of padding digits used
--   depends on the total number of frames). It is up to the user to take
--   these images and stitch them together into an actual animation format
--   (using, e.g. ffmpeg).
--   
--   Of course, this is a rather crude method of rendering animations; more
--   sophisticated methods will likely be added in the future.
--   
--   The fpu option from DiagramAnimOpts can be used to
--   control how many frames will be output for each second (unit time) of
--   animation.
--   
--   This function requires a lens into the structure that the particular
--   backend uses for it's diagram base case. If MainOpts (QDiagram b v
--   n Any) ~ DiagramOpts then this lens will simply be output.
--   For a backend supporting looping it will most likely be _1 .
--   output. This lens is required because the implementation works by
--   modifying the output field and running the base mainRender.
--   Typically a backend can write its Animation B V instance as
--   
--   
--   instance Mainable (Animation B V) where
--       type MainOpts (Animation B V) = (DiagramOpts, DiagramAnimOpts)
--       mainRender = defaultAnimMainRender output
--   
--   
--   
--   We do not provide this instance in general so that backends can choose
--   to opt-in to this form or provide a different instance that makes more
--   sense.
defaultAnimMainRender :: (opts -> QDiagram b v n Any -> IO ()) -> Lens' opts FilePath -> (opts, DiagramAnimOpts) -> Animation b v n -> IO ()

-- | defaultMultiMainRender is an implementation of
--   mainRender where instead of a single diagram it takes a list of
--   diagrams paired with names as input. The generated executable then
--   takes a --selection option specifying the name of the diagram
--   that should be rendered. The list of available diagrams may also be
--   printed by passing the option --list.
--   
--   Typically a backend can write its [(String,QDiagram b v n
--   Any)] instance as
--   
--   
--   instance Mainable [(String,QDiagram b v n Any)] where
--       type MainOpts [(String,QDiagram b v n Any)] = (DiagramOpts, DiagramMultiOpts)
--       mainRender = defaultMultiMainRender
--   
--   
--   
--   We do not provide this instance in general so that backends can choose
--   to opt-in to this form or provide a different instance that makes more
--   sense.
defaultMultiMainRender :: Mainable d => (MainOpts d, DiagramMultiOpts) -> [(String, d)] -> IO ()
defaultLoopRender :: DiagramLoopOpts -> IO ()
instance (Diagrams.Backend.CmdLine.ToResult d, Diagrams.Backend.CmdLine.Mainable (Diagrams.Backend.CmdLine.ResultOf d)) => Diagrams.Backend.CmdLine.Mainable (a -> d)
instance Diagrams.Backend.CmdLine.Mainable d => Diagrams.Backend.CmdLine.Mainable (GHC.Types.IO d)
instance Diagrams.Backend.CmdLine.ToResult (Diagrams.Core.Types.QDiagram b v n Data.Semigroup.Internal.Any)
instance Diagrams.Backend.CmdLine.ToResult [Diagrams.Core.Types.QDiagram b v n Data.Semigroup.Internal.Any]
instance Diagrams.Backend.CmdLine.ToResult [(GHC.Base.String, Diagrams.Core.Types.QDiagram b v n Data.Semigroup.Internal.Any)]
instance Diagrams.Backend.CmdLine.ToResult (Diagrams.Animation.Animation b v n)
instance Diagrams.Backend.CmdLine.ToResult d => Diagrams.Backend.CmdLine.ToResult (GHC.Types.IO d)
instance Diagrams.Backend.CmdLine.ToResult d => Diagrams.Backend.CmdLine.ToResult (a -> d)
instance Diagrams.Backend.CmdLine.Parseable GHC.Types.Int
instance Diagrams.Backend.CmdLine.Parseable GHC.Types.Double
instance Diagrams.Backend.CmdLine.Parseable GHC.Base.String
instance Diagrams.Backend.CmdLine.Parseable Diagrams.Backend.CmdLine.DiagramOpts
instance Diagrams.Backend.CmdLine.Parseable Diagrams.Backend.CmdLine.DiagramMultiOpts
instance Diagrams.Backend.CmdLine.Parseable Diagrams.Backend.CmdLine.DiagramAnimOpts
instance Diagrams.Backend.CmdLine.Parseable Diagrams.Backend.CmdLine.DiagramLoopOpts
instance Diagrams.Backend.CmdLine.Parseable (Data.Colour.Internal.Colour GHC.Types.Double)
instance Diagrams.Backend.CmdLine.Parseable (Data.Colour.Internal.AlphaColour GHC.Types.Double)
instance Diagrams.Backend.CmdLine.Parseable ()
instance (Diagrams.Backend.CmdLine.Parseable a, Diagrams.Backend.CmdLine.Parseable b) => Diagrams.Backend.CmdLine.Parseable (a, b)
instance (Diagrams.Backend.CmdLine.Parseable a, Diagrams.Backend.CmdLine.Parseable b, Diagrams.Backend.CmdLine.Parseable c) => Diagrams.Backend.CmdLine.Parseable (a, b, c)
instance (Diagrams.Backend.CmdLine.Parseable a, Diagrams.Backend.CmdLine.Parseable b, Diagrams.Backend.CmdLine.Parseable c, Diagrams.Backend.CmdLine.Parseable d) => Diagrams.Backend.CmdLine.Parseable (a, b, c, d)
instance Data.Data.Data Diagrams.Backend.CmdLine.DiagramAnimOpts
instance GHC.Show.Show Diagrams.Backend.CmdLine.DiagramAnimOpts
instance Data.Data.Data Diagrams.Backend.CmdLine.DiagramMultiOpts
instance GHC.Show.Show Diagrams.Backend.CmdLine.DiagramMultiOpts
instance Data.Data.Data Diagrams.Backend.CmdLine.DiagramOpts
instance GHC.Show.Show Diagrams.Backend.CmdLine.DiagramOpts

-- | This module only contains exports defined in diagrams-lib or
--   diagrams-core. This module can be used if you want to avoid
--   some potential conflicts with other modules, but importing
--   Diagrams.Prelude (which includes re-exports from other
--   packages) is often more convenient.
module Diagrams

-- | A bounding box is an axis-aligned region determined by two points
--   indicating its "lower" and "upper" corners. It can also represent an
--   empty bounding box - the points are wrapped in Maybe.
data BoundingBox v n

-- | An empty bounding box. This is the same thing as mempty, but
--   it doesn't require the same type constraints that the Monoid
--   instance does.
emptyBox :: BoundingBox v n

-- | Create a bounding box from a point that is component-wise
--   (<=) than the other. If this is not the case, then
--   mempty is returned.
fromCorners :: (Additive v, Foldable v, Ord n) => Point v n -> Point v n -> BoundingBox v n

-- | Create a degenerate bounding "box" containing only a single point.
fromPoint :: Point v n -> BoundingBox v n

-- | Create the smallest bounding box containing all the given points.
fromPoints :: (Additive v, Ord n) => [Point v n] -> BoundingBox v n

-- | Create a bounding box for any enveloped object (such as a diagram or
--   path).
boundingBox :: (InSpace v n a, HasBasis v, Enveloped a) => a -> BoundingBox v n

-- | Queries whether the BoundingBox is empty.
isEmptyBox :: BoundingBox v n -> Bool

-- | Gets the lower and upper corners that define the bounding box.
getCorners :: BoundingBox v n -> Maybe (Point v n, Point v n)

-- | Computes all of the corners of the bounding box.
getAllCorners :: (Additive v, Traversable v) => BoundingBox v n -> [Point v n]

-- | Get the size of the bounding box - the vector from the
--   (component-wise) lesser point to the greater point.
boxExtents :: (Additive v, Num n) => BoundingBox v n -> v n

-- | Get the center point in a bounding box.
boxCenter :: (Additive v, Fractional n) => BoundingBox v n -> Maybe (Point v n)

-- | Get the center of a the bounding box of an enveloped object, return
--   Nothing for object with empty envelope.
mCenterPoint :: (InSpace v n a, HasBasis v, Enveloped a) => a -> Maybe (Point v n)

-- | Get the center of a the bounding box of an enveloped object, return
--   the origin for object with empty envelope.
centerPoint :: (InSpace v n a, HasBasis v, Enveloped a) => a -> Point v n

-- | Create a transformation mapping points from one bounding box to the
--   other. Returns Nothing if either of the boxes are empty.
boxTransform :: (Additive v, Fractional n) => BoundingBox v n -> BoundingBox v n -> Maybe (Transformation v n)

-- | Transforms an enveloped thing to fit within a BoundingBox. If
--   the bounding box is empty, then the result is also mempty.
boxFit :: (InSpace v n a, HasBasis v, Enveloped a, Transformable a, Monoid a) => BoundingBox v n -> a -> a

-- | Check whether a point is strictly contained in a bounding box.
contains' :: (Additive v, Foldable v, Ord n) => BoundingBox v n -> Point v n -> Bool

-- | Test whether the first bounding box is strictly contained
--   inside the second.
inside' :: (Additive v, Foldable v, Ord n) => BoundingBox v n -> BoundingBox v n -> Bool

-- | Test whether the first bounding box lies strictly outside the
--   second (they do not intersect at all).
outside' :: (Additive v, Foldable v, Ord n) => BoundingBox v n -> BoundingBox v n -> Bool

-- | boxGrid f box returns a grid of regularly spaced points
--   inside the box, such that there are (1/f) points along each
--   dimension. For example, for a 3D box with corners at (0,0,0) and
--   (2,2,2), boxGrid 0.1 would yield a grid of approximately 1000
--   points (it might actually be 11^3 instead of 10^3)
--   spaced 0.2 units apart.
boxGrid :: (Traversable v, Additive v, Num n, Enum n) => n -> BoundingBox v n -> [Point v n]

-- | Type tag for trails with distinct endpoints.
data Line

-- | Trail is a wrapper around Trail', hiding whether the
--   underlying Trail' is a line or loop (though which it is can
--   be recovered; see e.g. withTrail).
data Trail v n
[Trail] :: Trail' l v n -> Trail v n

-- | Intuitively, a trail is a single, continuous path through space.
--   However, a trail has no fixed starting point; it merely specifies
--   how to move through space, not where. For example, "take
--   three steps forward, then turn right twenty degrees and take two more
--   steps" is an intuitive analog of a trail; these instructions specify a
--   path through space from any given starting location. To be precise,
--   trails are translation-invariant; applying a translation to a
--   trail has no effect.
--   
--   A Located Trail, on the other hand, is a trail paired
--   with some concrete starting location ("start at the big tree on the
--   corner, then take three steps forward, ..."). See the
--   Diagrams.Located module for help working with Located
--   values.
--   
--   Formally, the semantics of a trail is a continuous (though not
--   necessarily differentiable) function from the real interval [0,1] to
--   vectors in some vector space. (In contrast, a Located trail is
--   a continuous function from [0,1] to points in some
--   affine space.)
--   
--   There are two types of trails:
--   
--   
--   
- A "line" (think of the "train", "subway", or "bus" variety, rather
--   than the "straight" variety...) is a trail with two distinct
--   endpoints. Actually, a line can have the same start and end points,
--   but it is still drawn as if it had distinct endpoints: the two
--   endpoints will have the appropriate end caps, and the trail will not
--   be filled. Lines have a Monoid instance where
--   mappend corresponds to concatenation, i.e. chaining
--   one line after the other.
--   
- A "loop" is required to end in the same place it starts (that is,
--   t(0) = t(1)). Loops are filled and are drawn as one continuous loop,
--   with the appropriate join at the start/endpoint rather than end caps.
--   Loops do not have a Monoid instance.
--   
--   
--   To convert between lines and loops, see glueLine,
--   closeLine, and cutLoop.
--   
--   To construct trails, see emptyTrail, trailFromSegments,
--   trailFromVertices, trailFromOffsets, and friends. You
--   can also get any type of trail from any function which returns a
--   TrailLike (e.g. functions in
--   Diagrams.TwoD.Shapes, and many others; see
--   Diagrams.TrailLike).
--   
--   To extract information from trails, see withLine,
--   isLoop, trailSegments, trailOffsets,
--   trailVertices, and friends.
data Trail' l v n
[Line] :: SegTree v n -> Trail' Line v n
[Loop] :: SegTree v n -> Segment Open v n -> Trail' Loop v n

-- | Type tag for "loopy" trails which return to their starting point.
data Loop

-- | A SegTree represents a sequence of closed segments, stored in
--   a fingertree so we can easily recover various monoidal measures of the
--   segments (number of segments, arc length, envelope...) and also easily
--   slice and dice them according to the measures (e.g., split off
--   the smallest number of segments from the beginning which have a
--   combined arc length of at least 5).
newtype SegTree v n
SegTree :: FingerTree (SegMeasure v n) (Segment Closed v n) -> SegTree v n

-- | A newtype wrapper around trails which exists solely for its
--   Parametric, DomainBounds and EndValues instances.
--   The idea is that if tr is a trail, you can write, e.g.
--   
--   
--   getSegment tr atParam 0.6
--   
--   
--   
--   or
--   
--   
--   atStart (getSegment tr)
--   
--   
--   
--   to get the segment at parameter 0.6 or the first segment in the trail,
--   respectively.
--   
--   The codomain for GetSegment, i.e. the result you get
--   from calling atParam, atStart, or atEnd, is
--   GetSegmentCodomain, which is a newtype wrapper around Maybe
--   (v, Segment Closed v, AnIso' n n). Nothing results if
--   the trail is empty; otherwise, you get:
--   
--   
--   
- the offset from the start of the trail to the beginning of the
--   segment,
--   
- the segment itself, and
--   
- a reparameterization isomorphism: in the forward direction, it
--   translates from parameters on the whole trail to a parameters on the
--   segment. Note that for technical reasons you have to call
--   cloneIso on the AnIso' value to get a real isomorphism
--   you can use.
--   
newtype GetSegment t
GetSegment :: t -> GetSegment t
newtype GetSegmentCodomain v n
GetSegmentCodomain :: Maybe (v n, Segment Closed v n, AnIso' n n) -> GetSegmentCodomain v n

-- | Determine whether a trail is a line.
isLine :: Trail v n -> Bool

-- | Compute the total offset of anything measured by SegMeasure.
offset :: (OrderedField n, Metric v, Measured (SegMeasure v n) t) => t -> v n

-- | Make a line into a loop by "gluing" the endpoint to the starting
--   point. In particular, the offset of the final segment is modified so
--   that it ends at the starting point of the entire trail. Typically, you
--   would first construct a line which you know happens to end where it
--   starts, and then call glueLine to turn it into a loop.
--   
--   
--   
--   glueLineEx = pad 1.1 . hsep 1
--     $ [almostClosed # strokeLine, almostClosed # glueLine # strokeLoop]
--   
--   almostClosed :: Trail' Line V2 Double
--   almostClosed = fromOffsets $ map r2 [(2, -1), (-3, -0.5), (-2, 1), (1, 0.5)]
--   
--   
--   glueLine is left inverse to cutLoop, that is,
--   
--   
--   glueLine . cutLoop === id
--   
--   
glueLine :: (Metric v, OrderedField n) => Trail' Line v n -> Trail' Loop v n

-- | Make a line into a loop by adding a new linear segment from the line's
--   end to its start.
--   
--   closeLine does not have any particularly nice theoretical
--   properties, but can be useful e.g. when you want to make a
--   closed polygon out of a list of points where the initial point is not
--   repeated at the end. To use glueLine, one would first have to
--   duplicate the initial vertex, like
--   
--   
--   glueLine . lineFromVertices $ ps ++ [head ps]
--   
--   
--   Using closeLine, however, one can simply
--   
--   
--   closeLine . lineFromVertices $ ps
--   
--   
--   
--   
--   closeLineEx = pad 1.1 . centerXY . hcat' (with & sep .~ 1)
--     $ [almostClosed # strokeLine, almostClosed # closeLine # strokeLoop]
--   
closeLine :: Trail' Line v n -> Trail' Loop v n

-- | Turn a loop into a line by "cutting" it at the common start/end point,
--   resulting in a line which just happens to start and end at the same
--   place.
--   
--   cutLoop is right inverse to glueLine, that is,
--   
--   
--   glueLine . cutLoop === id
--   
--   
cutLoop :: forall v n. (Metric v, OrderedField n) => Trail' Loop v n -> Trail' Line v n

-- | Prism onto a Line.
_Line :: Prism' (Trail v n) (Trail' Line v n)

-- | Prism onto a Loop.
_Loop :: Prism' (Trail v n) (Trail' Loop v n)

-- | Prism onto a Located Line.
_LocLine :: Prism' (Located (Trail v n)) (Located (Trail' Line v n))

-- | Prism onto a Located Loop.
_LocLoop :: Prism' (Located (Trail v n)) (Located (Trail' Loop v n))

-- | Convert a Trail' into a Trail, hiding the type-level
--   distinction between lines and loops.
wrapTrail :: Trail' l v n -> Trail v n

-- | Convert a line into a Trail. This is the same as
--   wrapTrail, but with a more specific type, which can
--   occasionally be convenient for fixing the type of a polymorphic
--   expression.
wrapLine :: Trail' Line v n -> Trail v n

-- | Convert a loop into a Trail. This is the same as
--   wrapTrail, but with a more specific type, which can
--   occasionally be convenient for fixing the type of a polymorphic
--   expression.
wrapLoop :: Trail' Loop v n -> Trail v n

-- | Modify a Trail, specifying two separate transformations for
--   the cases of a line or a loop.
onTrail :: (Trail' Line v n -> Trail' l1 v n) -> (Trail' Loop v n -> Trail' l2 v n) -> Trail v n -> Trail v n

-- | Modify a Trail by specifying a transformation on lines. If
--   the trail is a line, the transformation will be applied directly. If
--   it is a loop, it will first be cut using cutLoop, the
--   transformation applied, and then glued back into a loop with
--   glueLine. That is,
--   
--   
--   onLine f === onTrail f (glueLine . f . cutLoop)
--   
--   
--   
--   Note that there is no corresponding onLoop function, because
--   there is no nice way in general to convert a line into a loop, operate
--   on it, and then convert back.
onLine :: (Metric v, OrderedField n) => (Trail' Line v n -> Trail' Line v n) -> Trail v n -> Trail v n

-- | glueTrail is a variant of glueLine which works on
--   Trails. It performs glueLine on lines and is the
--   identity on loops.
glueTrail :: (Metric v, OrderedField n) => Trail v n -> Trail v n

-- | closeTrail is a variant of closeLine for Trail,
--   which performs closeLine on lines and is the identity on loops.
closeTrail :: Trail v n -> Trail v n

-- | cutTrail is a variant of cutLoop for Trail; it
--   is the is the identity on lines and performs cutLoop on loops.
cutTrail :: (Metric v, OrderedField n) => Trail v n -> Trail v n

-- | The empty line, which is the identity for concatenation of lines.
emptyLine :: (Metric v, OrderedField n) => Trail' Line v n

-- | A wrapped variant of emptyLine.
emptyTrail :: (Metric v, OrderedField n) => Trail v n

-- | Construct a line containing only linear segments from a list of
--   vertices. Note that only the relative offsets between the vertices
--   matters; the information about their absolute position will be
--   discarded. That is, for all vectors v,
--   
--   
--   lineFromVertices === lineFromVertices . translate v
--   
--   
--   If you want to retain the position information, you should instead use
--   the more general fromVertices function to construct, say, a
--   Located (Trail' Line v) or a
--   Located (Trail v).
--   
--   
--   
--   import Diagrams.Coordinates
--   lineFromVerticesEx = pad 1.1 . centerXY . strokeLine
--     $ lineFromVertices [origin, 0 ^& 1, 1 ^& 2, 5 ^& 1]
--   
lineFromVertices :: (Metric v, OrderedField n) => [Point v n] -> Trail' Line v n

-- | trailFromVertices === wrapTrail .
--   lineFromVertices, for conveniently constructing a
--   Trail instead of a Trail' Line.
trailFromVertices :: (Metric v, OrderedField n) => [Point v n] -> Trail v n

-- | Construct a line containing only linear segments from a list of
--   vectors, where each vector represents the offset from one vertex to
--   the next. See also fromOffsets.
--   
--   
--   
--   import Diagrams.Coordinates
--   lineFromOffsetsEx = strokeLine $ lineFromOffsets [ 2 ^& 1, 2 ^& (-1), 2 ^& 0.5 ]
--   
lineFromOffsets :: (Metric v, OrderedField n) => [v n] -> Trail' Line v n

-- | trailFromOffsets === wrapTrail .
--   lineFromOffsets, for conveniently constructing a
--   Trail instead of a Trail' Line.
trailFromOffsets :: (Metric v, OrderedField n) => [v n] -> Trail v n

-- | Construct a line from a list of closed segments.
lineFromSegments :: (Metric v, OrderedField n) => [Segment Closed v n] -> Trail' Line v n

-- | trailFromSegments === wrapTrail .
--   lineFromSegments, for conveniently constructing a
--   Trail instead of a Trail'.
trailFromSegments :: (Metric v, OrderedField n) => [Segment Closed v n] -> Trail v n

-- | Construct a loop from a list of closed segments and an open segment
--   that completes the loop.
loopFromSegments :: (Metric v, OrderedField n) => [Segment Closed v n] -> Segment Open v n -> Trail' Loop v n

-- | A generic eliminator for Trail', taking functions specifying
--   what to do in the case of a line or a loop.
withTrail' :: (Trail' Line v n -> r) -> (Trail' Loop v n -> r) -> Trail' l v n -> r

-- | A generic eliminator for Trail, taking functions specifying
--   what to do in the case of a line or a loop.
withTrail :: (Trail' Line v n -> r) -> (Trail' Loop v n -> r) -> Trail v n -> r

-- | An eliminator for Trail based on eliminating lines: if the
--   trail is a line, the given function is applied; if it is a loop, it is
--   first converted to a line with cutLoop. That is,
--   
--   
--   withLine f === withTrail f (f . cutLoop)
--   
withLine :: (Metric v, OrderedField n) => (Trail' Line v n -> r) -> Trail v n -> r

-- | Test whether a line is empty.
isLineEmpty :: (Metric v, OrderedField n) => Trail' Line v n -> Bool

-- | Test whether a trail is empty. Note that loops are never empty.
isTrailEmpty :: (Metric v, OrderedField n) => Trail v n -> Bool

-- | Determine whether a trail is a loop.
isLoop :: Trail v n -> Bool

-- | Extract the segments of a trail. If the trail is a loop it will first
--   have cutLoop applied.
trailSegments :: (Metric v, OrderedField n) => Trail v n -> [Segment Closed v n]

-- | Extract the segments comprising a line.
lineSegments :: Trail' Line v n -> [Segment Closed v n]

-- | Extract the segments comprising a loop: a list of closed segments, and
--   one final open segment.
loopSegments :: Trail' Loop v n -> ([Segment Closed v n], Segment Open v n)

-- | Modify a line by applying a function to its list of segments.
onLineSegments :: (Metric v, OrderedField n) => ([Segment Closed v n] -> [Segment Closed v n]) -> Trail' Line v n -> Trail' Line v n

-- | Extract the offsets of the segments of a trail.
trailOffsets :: (Metric v, OrderedField n) => Trail v n -> [v n]

-- | Compute the offset from the start of a trail to the end. Satisfies
--   
--   
--   trailOffset === sumV . trailOffsets
--   
--   
--   
--   but is more efficient.
--   
--   
--   
--   trailOffsetEx = (strokeLine almostClosed <> showOffset) # centerXY # pad 1.1
--     where showOffset = fromOffsets [trailOffset (wrapLine almostClosed)]
--                      # strokeP # lc red
--   
trailOffset :: (Metric v, OrderedField n) => Trail v n -> v n

-- | Extract the offsets of the segments of a line.
lineOffsets :: Trail' Line v n -> [v n]

-- | Compute the offset from the start of a line to the end. (Note, there
--   is no corresponding loopOffset function because by definition
--   it would be constantly zero.)
lineOffset :: (Metric v, OrderedField n) => Trail' Line v n -> v n

-- | Extract the offsets of the segments of a loop.
loopOffsets :: (Metric v, OrderedField n) => Trail' Loop v n -> [v n]

-- | Extract the vertices of a concretely located trail. Here a
--   vertex is defined as a non-differentiable point on the trail,
--   i.e. a sharp corner. (Vertices are thus a subset of the places
--   where segments join; if you want all joins between segments, see
--   trailPoints.) The tolerance determines how close the tangents
--   of two segments must be at their endpoints to consider the transition
--   point to be differentiable.
--   
--   Note that for loops, the starting vertex will not be repeated
--   at the end. If you want this behavior, you can use cutTrail to
--   make the loop into a line first, which happens to repeat the same
--   vertex at the start and end, e.g. with trailVertices .
--   mapLoc cutTrail.
--   
--   It does not make sense to ask for the vertices of a Trail by
--   itself; if you want the vertices of a trail with the first vertex at,
--   say, the origin, you can use trailVertices . (`at` origin).
trailVertices' :: (Metric v, OrderedField n) => n -> Located (Trail v n) -> [Point v n]

-- | Extract the vertices of a concretely located line. See
--   trailVertices for more information.
lineVertices' :: (Metric v, OrderedField n) => n -> Located (Trail' Line v n) -> [Point v n]

-- | Extract the vertices of a concretely located loop. Note that the
--   initial vertex is not repeated at the end. See trailVertices
--   for more information.
loopVertices' :: (Metric v, OrderedField n) => n -> Located (Trail' Loop v n) -> [Point v n]

-- | Like trailVertices', with a default tolerance.
trailVertices :: (Metric v, OrderedField n) => Located (Trail v n) -> [Point v n]

-- | Like lineVertices', with a default tolerance.
lineVertices :: (Metric v, OrderedField n) => Located (Trail' Line v n) -> [Point v n]

-- | Same as loopVertices', with a default tolerance.
loopVertices :: (Metric v, OrderedField n) => Located (Trail' Loop v n) -> [Point v n]

-- | Convert a concretely located trail into a list of located segments.
trailLocSegments :: (Metric v, OrderedField n) => Located (Trail v n) -> [Located (Segment Closed v n)]

-- | Convert a concretely located trail into a list of fixed segments.
--   unfixTrail is almost its left inverse.
fixTrail :: (Metric v, OrderedField n) => Located (Trail v n) -> [FixedSegment v n]

-- | Convert a list of fixed segments into a located trail. Note that this
--   may lose information: it throws away the locations of all but the
--   first FixedSegment. This does not matter precisely when each
--   FixedSegment begins where the previous one ends.
--   
--   This is almost left inverse to fixTrail, that is,
--   unfixTrail . fixTrail == id, except for the fact that
--   unfixTrail will never yield a Loop. In the case of a
--   loop, we instead have glueTrail . unfixTrail . fixTrail ==
--   id. On the other hand, it is not the case that fixTrail .
--   unfixTrail == id since unfixTrail may lose information.
unfixTrail :: (Metric v, Ord n, Floating n) => [FixedSegment v n] -> Located (Trail v n)

-- | Reverse a trail. Semantically, if a trail given by a function t from
--   [0,1] to vectors, then the reverse of t is given by t'(s) = t(1-s).
--   reverseTrail is an involution, that is,
--   
--   
--   reverseTrail . reverseTrail === id
--   
--   
reverseTrail :: (Metric v, OrderedField n) => Trail v n -> Trail v n

-- | Reverse a concretely located trail. The endpoint of the original trail
--   becomes the starting point of the reversed trail, so the original and
--   reversed trails comprise exactly the same set of points.
--   reverseLocTrail is an involution, i.e.
--   
--   
--   reverseLocTrail . reverseLocTrail === id
--   
--   
reverseLocTrail :: (Metric v, OrderedField n) => Located (Trail v n) -> Located (Trail v n)

-- | Reverse a line. See reverseTrail.
reverseLine :: (Metric v, OrderedField n) => Trail' Line v n -> Trail' Line v n

-- | Reverse a concretely located line. See reverseLocTrail.
reverseLocLine :: (Metric v, OrderedField n) => Located (Trail' Line v n) -> Located (Trail' Line v n)

-- | Reverse a loop. See reverseTrail.
reverseLoop :: (Metric v, OrderedField n) => Trail' Loop v n -> Trail' Loop v n

-- | Reverse a concretely located loop. See reverseLocTrail. Note
--   that this is guaranteed to preserve the location.
reverseLocLoop :: (Metric v, OrderedField n) => Located (Trail' Loop v n) -> Located (Trail' Loop v n)

-- | Given a default result (to be used in the case of an empty trail), and
--   a function to map a single measure to a result, extract the given
--   measure for a trail and use it to compute a result. Put another way,
--   lift a function on a single measure (along with a default value) to a
--   function on an entire trail.
trailMeasure :: (SegMeasure v n :>: m, Measured (SegMeasure v n) t) => a -> (m -> a) -> t -> a

-- | Compute the number of segments of anything measured by
--   SegMeasure (e.g. SegMeasure itself,
--   Segment, SegTree, Trails...)
numSegs :: (Num c, Measured (SegMeasure v n) a) => a -> c

-- | Create a GetSegment wrapper around a trail, after which you can
--   call atParam, atStart, or atEnd to extract a
--   segment.
getSegment :: t -> GetSegment t

-- | A path is a (possibly empty) list of Located
--   Trails. Hence, unlike trails, paths are not translationally
--   invariant, and they form a monoid under superposition (placing
--   one path on top of another) rather than concatenation.
newtype Path v n
Path :: [Located (Trail v n)] -> Path v n

-- | Type class for things that can be converted to a Path.
--   
--   Note that this class is very different from TrailLike.
--   TrailLike is usually the result of a library function to give
--   you a convenient, polymorphic result (Path, Diagram
--   etc.).
class ToPath t

-- | toPath takes something that can be converted to Path and
--   returns the Path.
toPath :: (ToPath t, Metric (V t), OrderedField (N t)) => t -> Path (V t) (N t)

-- | Extract the located trails making up a Path.
pathTrails :: Path v n -> [Located (Trail v n)]

-- | Convert a trail to a path beginning at the origin.
pathFromTrail :: (Metric v, OrderedField n) => Trail v n -> Path v n

-- | Convert a trail to a path with a particular starting point.
pathFromTrailAt :: (Metric v, OrderedField n) => Trail v n -> Point v n -> Path v n

-- | Convert a located trail to a singleton path. This is equivalent to
--   trailLike, but provided with a more specific name and type for
--   convenience.
pathFromLocTrail :: (Metric v, OrderedField n) => Located (Trail v n) -> Path v n

-- | Extract the vertices of a path, resulting in a separate list of
--   vertices for each component trail. Here a vertex is defined as
--   a non-differentiable point on the trail, i.e. a sharp corner.
--   (Vertices are thus a subset of the places where segments join; if you
--   want all joins between segments, see pathPoints.) The tolerance
--   determines how close the tangents of two segments must be at their
--   endpoints to consider the transition point to be differentiable. See
--   trailVertices for more information.
pathVertices' :: (Metric v, OrderedField n) => n -> Path v n -> [[Point v n]]

-- | Like pathVertices', with a default tolerance.
pathVertices :: (Metric v, OrderedField n) => Path v n -> [[Point v n]]

-- | Compute the total offset of each trail comprising a path (see
--   trailOffset).
pathOffsets :: (Metric v, OrderedField n) => Path v n -> [v n]

-- | Compute the centroid of a path (i.e. the average
--   location of its vertices; see pathVertices).
pathCentroid :: (Metric v, OrderedField n) => Path v n -> Point v n

-- | Convert a path into a list of lists of located segments.
pathLocSegments :: (Metric v, OrderedField n) => Path v n -> [[Located (Segment Closed v n)]]

-- | Convert a path into a list of lists of FixedSegments.
fixPath :: (Metric v, OrderedField n) => Path v n -> [[FixedSegment v n]]

-- | Scale a path using its centroid (see pathCentroid) as the base
--   point for the scale.
scalePath :: (HasLinearMap v, Metric v, OrderedField n) => n -> Path v n -> Path v n

-- | Reverse all the component trails of a path.
reversePath :: (Metric v, OrderedField n) => Path v n -> Path v n

-- | "Explode" a path by exploding every component trail (see
--   explodeTrail).
explodePath :: (V t ~ v, N t ~ n, TrailLike t) => Path v n -> [[t]]

-- | Partition a path into two paths based on a predicate on trails: the
--   first containing all the trails for which the predicate returns
--   True, and the second containing the remaining trails.
partitionPath :: (Located (Trail v n) -> Bool) -> Path v n -> (Path v n, Path v n)

-- | A vector is described by a Direction and a magnitude. So we
--   can think of a Direction as a vector that has forgotten its
--   magnitude. Directions can be used with fromDirection
--   and the lenses provided by its instances.
data Direction v n

-- | _Dir is provided to allow efficient implementations of functions in
--   particular vector-spaces, but should be used with care as it exposes
--   too much information.
_Dir :: Iso' (Direction v n) (v n)

-- | direction v is the direction in which v points.
--   Returns an unspecified value when given the zero vector as input.
direction :: v n -> Direction v n

-- | fromDirection d is the unit vector in the direction
--   d.
fromDirection :: (Metric v, Floating n) => Direction v n -> v n

-- | Synonym for fromDirection.
fromDir :: (Metric v, Floating n) => Direction v n -> v n

-- | compute the positive angle between the two directions in their common
--   plane
angleBetweenDirs :: (Metric v, Floating n, Ord n) => Direction v n -> Direction v n -> Angle n

-- | dirBetween p q returns the direction from p to
--   q.
dirBetween :: (Additive v, Num n) => Point v n -> Point v n -> Direction v n

-- | A module to re-export most of the functionality of the diagrams core
--   and standard library.
module Diagrams.Prelude
class () => ColourOps (f :: Type -> Type)

-- | darken s c blends a colour with black without changing it's
--   opacity.
--   
--   For Colour, darken s c = blend s c mempty
darken :: (ColourOps f, Num a) => a -> f a -> f a

-- | This type represents a Colour that may be semi-transparent.
--   
--   The Monoid instance allows you to composite colours.
--   
--   
--   x `mappend` y == x `over` y
--   
--   
--   To get the (pre-multiplied) colour channel of an AlphaColour
--   c, simply composite c over black.
--   
--   
--   c `over` black
--   
data () => AlphaColour a

-- | This type represents the human preception of colour. The a
--   parameter is a numeric type used internally for the representation.
--   
--   The Monoid instance allows one to add colours, but beware that
--   adding colours can take you out of gamut. Consider using blend
--   whenever possible.
data () => Colour a

-- | Change the type used to represent the colour coordinates.
colourConvert :: (Fractional b, Real a) => Colour a -> Colour b
black :: Num a => Colour a

-- | This AlphaColour is entirely transparent and has no associated
--   colour channel.
transparent :: Num a => AlphaColour a

-- | Change the type used to represent the colour coordinates.
alphaColourConvert :: (Fractional b, Real a) => AlphaColour a -> AlphaColour b

-- | Creates an opaque AlphaColour from a Colour.
opaque :: Num a => Colour a -> AlphaColour a

-- | Returns an AlphaColour more transparent by a factor of
--   o.
dissolve :: Num a => a -> AlphaColour a -> AlphaColour a

-- | Creates an AlphaColour from a Colour with a given
--   opacity.
--   
--   
--   c `withOpacity` o == dissolve o (opaque c)
--   
withOpacity :: Num a => Colour a -> a -> AlphaColour a

-- | Compute the weighted average of two points. e.g.
--   
--   
--   blend 0.4 a b = 0.4*a + 0.6*b
--   
--   
--   The weight can be negative, or greater than 1.0; however, be aware
--   that non-convex combinations may lead to out of gamut colours.
blend :: (Num a, AffineSpace f) => a -> f a -> f a -> f a

-- | Returns the opacity of an AlphaColour.
alphaChannel :: AlphaColour a -> a
black :: Num a => Colour a
readColourName :: (MonadFail m, Monad m, Ord a, Floating a) => String -> m (Colour a)
aliceblue :: (Ord a, Floating a) => Colour a
antiquewhite :: (Ord a, Floating a) => Colour a
aqua :: (Ord a, Floating a) => Colour a
aquamarine :: (Ord a, Floating a) => Colour a
azure :: (Ord a, Floating a) => Colour a
beige :: (Ord a, Floating a) => Colour a
bisque :: (Ord a, Floating a) => Colour a
blanchedalmond :: (Ord a, Floating a) => Colour a
blue :: (Ord a, Floating a) => Colour a
blueviolet :: (Ord a, Floating a) => Colour a
brown :: (Ord a, Floating a) => Colour a
burlywood :: (Ord a, Floating a) => Colour a
cadetblue :: (Ord a, Floating a) => Colour a
chartreuse :: (Ord a, Floating a) => Colour a
chocolate :: (Ord a, Floating a) => Colour a
coral :: (Ord a, Floating a) => Colour a
cornflowerblue :: (Ord a, Floating a) => Colour a
cornsilk :: (Ord a, Floating a) => Colour a
crimson :: (Ord a, Floating a) => Colour a
cyan :: (Ord a, Floating a) => Colour a
darkblue :: (Ord a, Floating a) => Colour a
darkcyan :: (Ord a, Floating a) => Colour a
darkgoldenrod :: (Ord a, Floating a) => Colour a
darkgray :: (Ord a, Floating a) => Colour a
darkgreen :: (Ord a, Floating a) => Colour a
darkgrey :: (Ord a, Floating a) => Colour a
darkkhaki :: (Ord a, Floating a) => Colour a
darkmagenta :: (Ord a, Floating a) => Colour a
darkolivegreen :: (Ord a, Floating a) => Colour a
darkorange :: (Ord a, Floating a) => Colour a
darkorchid :: (Ord a, Floating a) => Colour a
darkred :: (Ord a, Floating a) => Colour a
darksalmon :: (Ord a, Floating a) => Colour a
darkseagreen :: (Ord a, Floating a) => Colour a
darkslateblue :: (Ord a, Floating a) => Colour a
darkslategray :: (Ord a, Floating a) => Colour a
darkslategrey :: (Ord a, Floating a) => Colour a
darkturquoise :: (Ord a, Floating a) => Colour a
darkviolet :: (Ord a, Floating a) => Colour a
deeppink :: (Ord a, Floating a) => Colour a
deepskyblue :: (Ord a, Floating a) => Colour a
dimgray :: (Ord a, Floating a) => Colour a
dimgrey :: (Ord a, Floating a) => Colour a
dodgerblue :: (Ord a, Floating a) => Colour a
firebrick :: (Ord a, Floating a) => Colour a
floralwhite :: (Ord a, Floating a) => Colour a
forestgreen :: (Ord a, Floating a) => Colour a
fuchsia :: (Ord a, Floating a) => Colour a
gainsboro :: (Ord a, Floating a) => Colour a
ghostwhite :: (Ord a, Floating a) => Colour a
gold :: (Ord a, Floating a) => Colour a
goldenrod :: (Ord a, Floating a) => Colour a
gray :: (Ord a, Floating a) => Colour a
grey :: (Ord a, Floating a) => Colour a
green :: (Ord a, Floating a) => Colour a
greenyellow :: (Ord a, Floating a) => Colour a
honeydew :: (Ord a, Floating a) => Colour a
hotpink :: (Ord a, Floating a) => Colour a
indianred :: (Ord a, Floating a) => Colour a
indigo :: (Ord a, Floating a) => Colour a
ivory :: (Ord a, Floating a) => Colour a
khaki :: (Ord a, Floating a) => Colour a
lavender :: (Ord a, Floating a) => Colour a
lavenderblush :: (Ord a, Floating a) => Colour a
lawngreen :: (Ord a, Floating a) => Colour a
lemonchiffon :: (Ord a, Floating a) => Colour a
lightblue :: (Ord a, Floating a) => Colour a
lightcoral :: (Ord a, Floating a) => Colour a
lightcyan :: (Ord a, Floating a) => Colour a
lightgoldenrodyellow :: (Ord a, Floating a) => Colour a
lightgray :: (Ord a, Floating a) => Colour a
lightgreen :: (Ord a, Floating a) => Colour a
lightgrey :: (Ord a, Floating a) => Colour a
lightpink :: (Ord a, Floating a) => Colour a
lightsalmon :: (Ord a, Floating a) => Colour a
lightseagreen :: (Ord a, Floating a) => Colour a
lightskyblue :: (Ord a, Floating a) => Colour a
lightslategray :: (Ord a, Floating a) => Colour a
lightslategrey :: (Ord a, Floating a) => Colour a
lightsteelblue :: (Ord a, Floating a) => Colour a
lightyellow :: (Ord a, Floating a) => Colour a
lime :: (Ord a, Floating a) => Colour a
limegreen :: (Ord a, Floating a) => Colour a
linen :: (Ord a, Floating a) => Colour a
magenta :: (Ord a, Floating a) => Colour a
maroon :: (Ord a, Floating a) => Colour a
mediumaquamarine :: (Ord a, Floating a) => Colour a
mediumblue :: (Ord a, Floating a) => Colour a
mediumorchid :: (Ord a, Floating a) => Colour a
mediumpurple :: (Ord a, Floating a) => Colour a
mediumseagreen :: (Ord a, Floating a) => Colour a
mediumslateblue :: (Ord a, Floating a) => Colour a
mediumspringgreen :: (Ord a, Floating a) => Colour a
mediumturquoise :: (Ord a, Floating a) => Colour a
mediumvioletred :: (Ord a, Floating a) => Colour a
midnightblue :: (Ord a, Floating a) => Colour a
mintcream :: (Ord a, Floating a) => Colour a
mistyrose :: (Ord a, Floating a) => Colour a
moccasin :: (Ord a, Floating a) => Colour a
navajowhite :: (Ord a, Floating a) => Colour a
navy :: (Ord a, Floating a) => Colour a
oldlace :: (Ord a, Floating a) => Colour a
olive :: (Ord a, Floating a) => Colour a
olivedrab :: (Ord a, Floating a) => Colour a
orange :: (Ord a, Floating a) => Colour a
orangered :: (Ord a, Floating a) => Colour a
orchid :: (Ord a, Floating a) => Colour a
palegoldenrod :: (Ord a, Floating a) => Colour a
palegreen :: (Ord a, Floating a) => Colour a
paleturquoise :: (Ord a, Floating a) => Colour a
palevioletred :: (Ord a, Floating a) => Colour a
papayawhip :: (Ord a, Floating a) => Colour a
peachpuff :: (Ord a, Floating a) => Colour a
peru :: (Ord a, Floating a) => Colour a
pink :: (Ord a, Floating a) => Colour a
plum :: (Ord a, Floating a) => Colour a
powderblue :: (Ord a, Floating a) => Colour a
purple :: (Ord a, Floating a) => Colour a
red :: (Ord a, Floating a) => Colour a
rosybrown :: (Ord a, Floating a) => Colour a
royalblue :: (Ord a, Floating a) => Colour a
saddlebrown :: (Ord a, Floating a) => Colour a
salmon :: (Ord a, Floating a) => Colour a
sandybrown :: (Ord a, Floating a) => Colour a
seagreen :: (Ord a, Floating a) => Colour a
seashell :: (Ord a, Floating a) => Colour a
sienna :: (Ord a, Floating a) => Colour a
silver :: (Ord a, Floating a) => Colour a
skyblue :: (Ord a, Floating a) => Colour a
slateblue :: (Ord a, Floating a) => Colour a
slategray :: (Ord a, Floating a) => Colour a
slategrey :: (Ord a, Floating a) => Colour a
snow :: (Ord a, Floating a) => Colour a
springgreen :: (Ord a, Floating a) => Colour a
steelblue :: (Ord a, Floating a) => Colour a
teal :: (Ord a, Floating a) => Colour a
thistle :: (Ord a, Floating a) => Colour a
tomato :: (Ord a, Floating a) => Colour a
turquoise :: (Ord a, Floating a) => Colour a
violet :: (Ord a, Floating a) => Colour a
wheat :: (Ord a, Floating a) => Colour a
white :: (Ord a, Floating a) => Colour a
whitesmoke :: (Ord a, Floating a) => Colour a
yellow :: (Ord a, Floating a) => Colour a
yellowgreen :: (Ord a, Floating a) => Colour a

-- | A Traversal can be used directly as a Setter or a
--   Fold (but not as a Lens) and provides the ability to
--   both read and update multiple fields, subject to some relatively weak
--   Traversal laws.
--   
--   These have also been known as multilenses, but they have the signature
--   and spirit of
--   
--   
--   traverse :: Traversable f => Traversal (f a) (f b) a b
--   
--   
--   and the more evocative name suggests their application.
--   
--   Most of the time the Traversal you will want to use is just
--   traverse, but you can also pass any Lens or Iso
--   as a Traversal, and composition of a Traversal (or
--   Lens or Iso) with a Traversal (or Lens or
--   Iso) using (.) forms a valid Traversal.
--   
--   The laws for a Traversal t follow from the laws for
--   Traversable as stated in "The Essence of the Iterator Pattern".
--   
--   
--   t pure ≡ pure
--   fmap (t f) . t g ≡ getCompose . t (Compose . fmap f . g)
--   
--   
--   One consequence of this requirement is that a Traversal needs
--   to leave the same number of elements as a candidate for subsequent
--   Traversal 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 Traversable
--   instances that traverse 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 :: Type -> Type). Applicative f => a -> f b -> s -> f t

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

-- | The class of contravariant functors.
--   
--   Whereas in Haskell, one can think of a Functor as containing or
--   producing values, a contravariant functor is a functor that can be
--   thought of as consuming values.
--   
--   As an example, consider the type of predicate functions a ->
--   Bool. One such predicate might be negative x = x < 0,
--   which classifies integers as to whether they are negative. However,
--   given this predicate, we can re-use it in other situations, providing
--   we have a way to map values to integers. For instance, we can
--   use the negative predicate on a person's bank balance to work
--   out if they are currently overdrawn:
--   
--   
--   newtype Predicate a = Predicate { getPredicate :: a -> Bool }
--   
--   instance Contravariant Predicate where
--     contramap :: (a' -> a) -> (Predicate a -> Predicate a')
--     contramap f (Predicate p) = Predicate (p . f)
--                                            |   `- First, map the input...
--                                            `----- then apply the predicate.
--   
--   overdrawn :: Predicate Person
--   overdrawn = contramap personBankBalance negative
--   
--   
--   Any instance should be subject to the following laws:
--   
--   
--   
- Identity contramap id =
--   id
--   
- Composition contramap (g . f) = contramap
--   f . contramap g
--   
--   
--   Note, that the second law follows from the free theorem of the type of
--   contramap and the first law, so you need only check that the
--   former condition holds.
class () => Contravariant (f :: Type -> Type)
contramap :: Contravariant f => (a' -> a) -> f a -> f a'

-- | Replace all locations in the output with the same value. The default
--   definition is contramap . const, but this may
--   be overridden with a more efficient version.
(>$) :: Contravariant f => b -> f b -> f a
infixl 4 >$

-- | A bifunctor is a type constructor that takes two type arguments and is
--   a functor in both arguments. That is, unlike with
--   Functor, a type constructor such as Either does not need
--   to be partially applied for a Bifunctor instance, and the
--   methods in this class permit mapping functions over the Left
--   value or the Right value, or both at the same time.
--   
--   Formally, the class Bifunctor represents a bifunctor from
--   Hask -> Hask.
--   
--   Intuitively it is a bifunctor where both the first and second
--   arguments are covariant.
--   
--   You can define a Bifunctor by either defining bimap or
--   by defining both first and second. A partially applied
--   Bifunctor must be a Functor and the second method
--   must agree with fmap. From this it follows that:
--   
--   
--   second id = id
--   
--   
--   If you supply bimap, you should ensure that:
--   
--   
--   bimap id id ≡ id
--   
--   
--   If you supply first and second, ensure:
--   
--   
--   first id ≡ id
--   second id ≡ id
--   
--   
--   If you supply both, you should also ensure:
--   
--   
--   bimap f g ≡ first f . second g
--   
--   
--   These ensure by parametricity:
--   
--   
--   bimap  (f . g) (h . i) ≡ bimap f h . bimap g i
--   first  (f . g) ≡ first  f . first  g
--   second (f . g) ≡ second f . second g
--   
--   
--   Since 4.18.0.0 Functor is a superclass of 'Bifunctor.
class forall a. () => Functor p a => Bifunctor (p :: Type -> Type -> Type)

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

-- | Functors representing data structures that can be transformed to
--   structures of the same shape by performing an
--   Applicative (or, therefore, Monad) action on each
--   element from left to right.
--   
--   A more detailed description of what same shape means, the
--   various methods, how traversals are constructed, and example advanced
--   use-cases can be found in the Overview section of
--   Data.Traversable#overview.
--   
--   For the class laws see the Laws section of
--   Data.Traversable#laws.
class (Functor t, Foldable t) => Traversable (t :: Type -> Type)

-- | 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 traverse_.
--   
--   
Examples
--   
--   Basic usage:
--   
--   In the first two examples we show each evaluated action mapping to the
--   output structure.
--   
--   
--   >>> traverse Just [1,2,3,4]
--   Just [1,2,3,4]
--   
--   
--   
--   >>> traverse id [Right 1, Right 2, Right 3, Right 4]
--   Right [1,2,3,4]
--   
--   
--   In the next examples, we show that Nothing and Left
--   values short circuit the created structure.
--   
--   
--   >>> traverse (const Nothing) [1,2,3,4]
--   Nothing
--   
--   
--   
--   >>> traverse (\x -> if odd x then Just x else Nothing)  [1,2,3,4]
--   Nothing
--   
--   
--   
--   >>> traverse id [Right 1, Right 2, Right 3, Right 4, Left 0]
--   Left 0
--   
traverse :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)

-- | Propositional equality. If a :~: b is inhabited by some
--   terminating value, then the type a is the same as the type
--   b. To use this equality in practice, pattern-match on the
--   a :~: b to get out the Refl constructor; in the body
--   of the pattern-match, the compiler knows that a ~ b.
data () => (a :: k) :~: (b :: k)
[Refl] :: forall {k} (a :: k). a :~: a
infix 4 :~:

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

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

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

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

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

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

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

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

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

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

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

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

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

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

-- | Run a monadic action in a larger State than it was defined in,
--   using a Lens' or Traversal'.
--   
--   This is commonly used to lift actions in a simpler State
--   Monad into a State Monad with a larger
--   State type.
--   
--   When applied to a Traversal' 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 Monad transformer
--   stack with a State in it!
--   
--   
--   >>> flip State.evalState (a,b) $ zoom _1 $ use id
--   a
--   
--   
--   
--   >>> flip State.execState (a,b) $ zoom _1 $ id .= c
--   (c,b)
--   
--   
--   
--   >>> flip State.execState [(a,b),(c,d)] $ zoom traverse $ _2 %= f
--   [(a,f b),(c,f d)]
--   
--   
--   
--   >>> flip State.runState [(a,b),(c,d)] $ zoom traverse $ _2 <%= f
--   (f b <> f d <> mempty,[(a,f b),(c,f d)])
--   
--   
--   
--   >>> flip State.evalState (a,b) $ zoom both (use id)
--   a <> b
--   
--   
--   
--   zoom :: Monad m             => Lens' s t      -> StateT t m a -> StateT s m a
--   zoom :: (Monad m, Monoid c) => Traversal' s t -> StateT t m c -> StateT s m c
--   zoom :: (Monad m, Monoid w)             => Lens' s t      -> RWST r w t m c -> RWST r w s m c
--   zoom :: (Monad m, Monoid w, Monoid c) => Traversal' s t -> RWST r w t m c -> RWST r w s m c
--   zoom :: (Monad m, Monoid w, Error e)  => Lens' s t      -> ErrorT e (RWST r w t m) c -> ErrorT e (RWST r w s m) c
--   zoom :: (Monad m, Monoid w, Monoid c, Error e) => Traversal' s t -> ErrorT e (RWST r w t m) c -> ErrorT e (RWST r w s m) c
--   ...
--   
zoom :: Zoom m n s t => LensLike' (Zoomed m c) t s -> m c -> n c
infixr 2 `zoom`

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

-- | 
--   type Traversal' = Simple Traversal
--   
type Traversal' s a = Traversal s s a a

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

-- | 
--   type Iso' = Simple Iso
--   
type Iso' s a = Iso s s a a
class () => AsEmpty a

-- | 
--   >>> isn't _Empty [1,2,3]
--   True
--   
_Empty :: AsEmpty a => Prism' a ()

-- | A form of Traversal 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

-- | A Simple Prism.
type Prism' s a = Prism s s a a

-- | 
--   type Lens' = Simple Lens
--   
type Lens' s a = Lens s s a a

-- | A function with access to a index. This constructor may be useful when
--   you need to store an Indexable in a container to avoid
--   ImpredicativeTypes.
--   
--   
--   index :: Indexed i a b -> i -> a -> b
--   
newtype () => Indexed i a b
Indexed :: (i -> a -> b) -> Indexed i a b
[runIndexed] :: Indexed i a b -> i -> a -> b

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

-- | Wrapped provides isomorphisms to wrap and unwrap newtypes or
--   data types with one constructor.
class () => Wrapped s where {
    type family Unwrapped s;
    type Unwrapped s = GUnwrapped Rep s;
}

-- | An isomorphism between s and a.
--   
--   If your type has a Generic instance, _Wrapped' will
--   default to _GWrapped', and you can choose to not override it
--   with your own definition.
_Wrapped' :: Wrapped s => Iso' s (Unwrapped s)
class (FunctorWithIndex i t, FoldableWithIndex i t, Traversable t) => TraversableWithIndex i (t :: Type -> Type) | t -> i
itraverse :: (TraversableWithIndex i t, Applicative f) => (i -> a -> f b) -> t a -> f (t b)
class Foldable f => FoldableWithIndex i (f :: Type -> Type) | f -> i
ifoldMap :: (FoldableWithIndex i f, Monoid m) => (i -> a -> m) -> f a -> m
ifoldMap' :: (FoldableWithIndex i f, Monoid m) => (i -> a -> m) -> f a -> m
ifoldr :: FoldableWithIndex i f => (i -> a -> b -> b) -> b -> f a -> b
ifoldl :: FoldableWithIndex i f => (i -> b -> a -> b) -> b -> f a -> b
ifoldr' :: FoldableWithIndex i f => (i -> a -> b -> b) -> b -> f a -> b
ifoldl' :: FoldableWithIndex i f => (i -> b -> a -> b) -> b -> f a -> b
class Functor f => FunctorWithIndex i (f :: Type -> Type) | f -> i
imap :: FunctorWithIndex i f => (i -> a -> b) -> f a -> f b

-- | Formally, the class Profunctor represents a profunctor from
--   Hask -> Hask.
--   
--   Intuitively it is a bifunctor where the first argument is
--   contravariant and the second argument is covariant.
--   
--   You can define a Profunctor by either defining dimap or
--   by defining both lmap and rmap.
--   
--   If you supply dimap, you should ensure that:
--   
--   
--   dimap id id ≡ id
--   
--   
--   If you supply lmap and rmap, ensure:
--   
--   
--   lmap id ≡ id
--   rmap id ≡ id
--   
--   
--   If you supply both, you should also ensure:
--   
--   
--   dimap f g ≡ lmap f . rmap g
--   
--   
--   These ensure by parametricity:
--   
--   
--   dimap (f . g) (h . i) ≡ dimap g h . dimap f i
--   lmap (f . g) ≡ lmap g . lmap f
--   rmap (f . g) ≡ rmap f . rmap g
--   
class () => Profunctor (p :: Type -> Type -> Type)

-- | Map over both arguments at the same time.
--   
--   
--   dimap f g ≡ lmap f . rmap g
--   
dimap :: Profunctor p => (a -> b) -> (c -> d) -> p b c -> p a d

-- | Map the first argument contravariantly.
--   
--   
--   lmap f ≡ dimap f id
--   
lmap :: Profunctor p => (a -> b) -> p b c -> p a c

-- | Map the second argument covariantly.
--   
--   
--   rmap ≡ dimap id
--   
rmap :: Profunctor p => (b -> c) -> p a b -> p a c

-- | The generalization of Costar of Functor that is strong
--   with respect to Either.
--   
--   Note: This is also a notion of strength, except with regards to
--   another monoidal structure that we can choose to equip Hask with: the
--   cocartesian coproduct.
class Profunctor p => Choice (p :: Type -> Type -> Type)

-- | Laws:
--   
--   
--   left' ≡ dimap swapE swapE . right' where
--     swapE :: Either a b -> Either b a
--     swapE = either Right Left
--   rmap Left ≡ lmap Left . left'
--   lmap (right f) . left' ≡ rmap (right f) . left'
--   left' . left' ≡ dimap assocE unassocE . left' where
--     assocE :: Either (Either a b) c -> Either a (Either b c)
--     assocE (Left (Left a)) = Left a
--     assocE (Left (Right b)) = Right (Left b)
--     assocE (Right c) = Right (Right c)
--     unassocE :: Either a (Either b c) -> Either (Either a b) c
--     unassocE (Left a) = Left (Left a)
--     unassocE (Right (Left b)) = Left (Right b)
--     unassocE (Right (Right c)) = Right c
--   
left' :: Choice p => p a b -> p (Either a c) (Either b c)

-- | Laws:
--   
--   
--   right' ≡ dimap swapE swapE . left' where
--     swapE :: Either a b -> Either b a
--     swapE = either Right Left
--   rmap Right ≡ lmap Right . right'
--   lmap (left f) . right' ≡ rmap (left f) . right'
--   right' . right' ≡ dimap unassocE assocE . right' where
--     assocE :: Either (Either a b) c -> Either a (Either b c)
--     assocE (Left (Left a)) = Left a
--     assocE (Left (Right b)) = Right (Left b)
--     assocE (Right c) = Right (Right c)
--     unassocE :: Either a (Either b c) -> Either (Either a b) c
--     unassocE (Left a) = Left (Left a)
--     unassocE (Right (Left b)) = Left (Right b)
--     unassocE (Right (Right c)) = Right c
--   
right' :: Choice p => p a b -> p (Either c a) (Either c b)
class (Foldable1 t, Traversable t) => Traversable1 (t :: Type -> Type)
traverse1 :: (Traversable1 t, Apply f) => (a -> f b) -> t a -> f (t b)

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

-- | 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 Level as a PATRICIA
--   trie of the paths into the structure to leaves at a given depth,
--   similar in many ways to a IntMap, 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 Two node
--   you will not find any Zero nodes, so Zero can only occur
--   at the root.
data () => Level i a

-- | 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 :: Type -> Type -> Type)

-- | This is a Profunctor that is both Corepresentable by
--   f and Representable by g such that f
--   is left adjoint to g. 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 :: Type -> Type -> Type)

-- | Conjoined is strong enough to let us distribute every
--   Conjoined Profunctor over every Haskell Functor.
--   This is effectively a generalization of fmap.
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

-- | Used for lastOf.
data () => Rightmost a

-- | Used for firstOf.
data () => Leftmost a

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

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

-- | 
--   type Context' a s = Context a a s
--   
type Context' a = Context a a

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

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

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

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

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

-- | 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 :: Type -> Type -> Type)

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

-- | 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 f = Simple (Over p f)
--   
type Over' (p :: Type -> Type -> Type) (f :: Type -> Type) s a = Over p f s s a a

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

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

-- | 
--   type LensLike' f = Simple (LensLike f)
--   
type LensLike' (f :: Type -> Type) s a = LensLike f s s a a

-- | 
--   type Optical' p q f s a = Simple (Optical p q f) s a
--   
type Optical' (p :: k -> k1 -> Type) (q :: k -> k1 -> Type) (f :: k -> k1) (s :: k) (a :: k) = Optical p q f s s a a

-- | 
--   type LensLike f s t a b = Optical (->) (->) f s t a b
--   
--   
--   
--   type Over p f s t a b = Optical p (->) f s t a b
--   
--   
--   
--   type Optic p f s t a b = Optical p p f s t a b
--   
type Optical (p :: k -> k1 -> Type) (q :: k2 -> k1 -> Type) (f :: k3 -> k1) (s :: k2) (t :: k3) (a :: k) (b :: k3) = p a f b -> q s f t

-- | 
--   type Optic' p f s a = Simple (Optic p f) s a
--   
type Optic' (p :: k -> k1 -> Type) (f :: k -> k1) (s :: k) (a :: k) = Optic p f s s a a

-- | A valid Optic l should satisfy the laws:
--   
--   
--   l pure ≡ pure
--   l (Procompose f g) = Procompose (l f) (l g)
--   
--   
--   This gives rise to the laws for Equality, Iso,
--   Prism, Lens, Traversal, Traversal1,
--   Setter, Fold, Fold1, and Getter as well
--   along with their index-preserving variants.
--   
--   
--   type LensLike f s t a b = Optic (->) f s t a b
--   
type Optic (p :: k -> k1 -> Type) (f :: k2 -> k1) (s :: k) (t :: k2) (a :: k) (b :: k2) = p a f b -> p s f t
type IndexPreservingFold1 s a = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Conjoined p, Contravariant f, Apply f) => p a f a -> p s f s
type IndexedFold1 i s a = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Indexable i p, Contravariant f, Apply f) => p a f a -> s -> f s

-- | A relevant Fold (aka Fold1) has one or more targets.
type Fold1 s a = forall (f :: Type -> Type). (Contravariant f, Apply f) => a -> f a -> s -> f s

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

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

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

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

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

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

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

-- | 
--   type IndexedPreservingSetter' i = Simple IndexedPreservingSetter
--   
type IndexPreservingSetter' s a = IndexPreservingSetter s s a a

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

-- | 
--   type IndexedSetter' i = Simple (IndexedSetter i)
--   
type IndexedSetter' i s a = IndexedSetter i s s a a

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

-- | 
--   type IndexPreservingTraversal' = Simple IndexPreservingTraversal
--   
type IndexPreservingTraversal' s a = IndexPreservingTraversal s s a a

-- | An IndexPreservingTraversal leaves any index it is composed
--   with alone.
type IndexPreservingTraversal s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Conjoined p, Applicative f) => p a f b -> p s f t
type IndexedTraversal1' i s a = IndexedTraversal1 i s s a a
type IndexedTraversal1 i s t a b = forall (p :: Type -> Type -> Type) (f :: Type -> Type). (Indexable i p, Apply f) => p a f b -> s -> f t

-- | 
--   type IndexedTraversal' i = Simple (IndexedTraversal i)
--   
type IndexedTraversal' i s a = IndexedTraversal i s s a a
type Traversal1' s a = Traversal1 s s a a

-- | A Traversal which targets at least one element.
--   
--   Note that since Apply is not a superclass of
--   Applicative, a Traversal1 cannot always be used in place
--   of a Traversal. In such circumstances cloneTraversal
--   will convert a Traversal1 into a Traversal.
type Traversal1 s t a b = forall (f :: Type -> Type). Apply f => a -> f b -> s -> f t

-- | 
--   type IndexPreservingLens' = Simple IndexPreservingLens
--   
type IndexPreservingLens' s a = IndexPreservingLens s s a a

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

-- | 
--   type IndexedLens' i = Simple (IndexedLens i)
--   
type IndexedLens' i s a = IndexedLens i s s a a

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

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

-- | 
--   type AnIndexedSetter' i = Simple (AnIndexedSetter i)
--   
type AnIndexedSetter' i s a = AnIndexedSetter i s s a a

-- | Running an IndexedSetter 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

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

-- | Running a Setter 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

-- | 
--   type AnIndexedLens' = Simple (AnIndexedLens i)
--   
type AnIndexedLens' i s a = AnIndexedLens i s s a a

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

-- | 
--   type ALens' = Simple ALens
--   
type ALens' s a = ALens s s a a

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

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

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

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

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

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

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

-- | 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.
--   
--   
--   >>> _2 .~ "hello" $ (1,(),3,4)
--   (1,"hello",3,4)
--   
--   
--   
--   >>> (1,2,3,4) & _2 *~ 3
--   (1,6,3,4)
--   
--   
--   
--   >>> _2 print (1,2)
--   2
--   (1,())
--   
--   
--   
--   anyOf _2 :: (s -> Bool) -> (a, s) -> Bool
--   traverse . _2 :: (Applicative f, Traversable t) => (a -> f b) -> t (s, a) -> f (t (s, b))
--   foldMapOf (traverse . _2) :: (Traversable t, Monoid m) => (s -> m) -> t (b, s) -> m
--   
_2 :: Field2 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).
--   
--   
--   >>> (1,2)^._1
--   1
--   
--   
--   
--   >>> _1 .~ "hello" $ (1,2)
--   ("hello",2)
--   
--   
--   
--   >>> (1,2) & _1 .~ "hello"
--   ("hello",2)
--   
--   
--   
--   >>> _1 putStrLn ("hello","world")
--   hello
--   ((),"world")
--   
--   
--   This can also be used on larger tuples as well:
--   
--   
--   >>> (1,2,3,4,5) & _1 +~ 41
--   (42,2,3,4,5)
--   
--   
--   
--   _1 :: Lens (a,b) (a',b) a a'
--   _1 :: Lens (a,b,c) (a',b,c) a a'
--   _1 :: Lens (a,b,c,d) (a',b,c,d) a a'
--   ...
--   _1 :: Lens (a,b,c,d,e,f,g,h,i) (a',b,c,d,e,f,g,h,i) a a'
--   
_1 :: Field1 s t a b => Lens s t a b

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

-- | Used to consume an IndexedFold.
type IndexedGetting i m s a = Indexed i a Const m a -> s -> Const m s
class () => Suffixed t

-- | A Prism stripping a suffix from a sequence when used as a
--   Traversal, or appending that suffix when run backwards:
--   
--   
--   >>> "review" ^? suffixed "view"
--   Just "re"
--   
--   
--   
--   >>> "review" ^? suffixed "tire"
--   Nothing
--   
--   
--   
--   >>> suffixed ".o" # "hello"
--   "hello.o"
--   
suffixed :: Suffixed t => t -> Prism' t t
class () => Prefixed t

-- | A Prism stripping a prefix from a sequence when used as a
--   Traversal, or prepending that prefix when run backwards:
--   
--   
--   >>> "preview" ^? prefixed "pre"
--   Just "view"
--   
--   
--   
--   >>> "review" ^? prefixed "pre"
--   Nothing
--   
--   
--   
--   >>> prefixed "pre" # "amble"
--   "preamble"
--   
prefixed :: Prefixed t => t -> Prism' t t

-- | 
--   type APrism' = Simple APrism
--   
type APrism' s a = APrism s s a a

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

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

-- | IndexedTraversal of the element at the largest index.
traverseMax :: TraverseMax k m => IndexedTraversal' k (m v) v

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

-- | IndexedTraversal of the element with the smallest index.
traverseMin :: TraverseMin k m => IndexedTraversal' k (m v) v
type Traversing1' (p :: Type -> Type -> Type) (f :: Type -> Type) s a = Traversing1 p f s s a a

-- | 
--   type Traversing' f = Simple (Traversing f)
--   
type Traversing' (p :: Type -> Type -> Type) (f :: Type -> Type) s a = Traversing p f s s a a
type Traversing1 (p :: Type -> Type -> Type) (f :: Type -> Type) s t a b = Over p BazaarT1 p f a b s t a b

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

-- | 
--   type AnIndexedTraversal1' = Simple (AnIndexedTraversal1 i)
--   
type AnIndexedTraversal1' i s a = AnIndexedTraversal1 i s s a a

-- | 
--   type AnIndexedTraversal' = Simple (AnIndexedTraversal i)
--   
type AnIndexedTraversal' i s a = AnIndexedTraversal i s s a a

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

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

-- | 
--   type ATraversal1' = Simple ATraversal1
--   
type ATraversal1' s a = ATraversal1 s s a a

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

-- | 
--   type ATraversal' = Simple ATraversal
--   
type ATraversal' s a = ATraversal s s a a

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

-- | 
--   type ReifiedPrism' = Simple ReifiedPrism
--   
type ReifiedPrism' s a = ReifiedPrism s s a a

-- | Reify a Prism 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

-- | 
--   type ReifiedIso' = Simple ReifiedIso
--   
type ReifiedIso' s a = ReifiedIso s s a a

-- | Reify an Iso 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

-- | 
--   type ReifiedIndexedSetter' i = Simple (ReifiedIndexedSetter i)
--   
type ReifiedIndexedSetter' i s a = ReifiedIndexedSetter i s s a a

-- | Reify an IndexedSetter 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

-- | 
--   type ReifiedSetter' = Simple ReifiedSetter
--   
type ReifiedSetter' s a = ReifiedSetter s s a a

-- | Reify a Setter 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
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 Fold so it can be stored safely in a container.
--   
--   This can also be useful for creatively combining folds as
--   ReifiedFold s is isomorphic to ReaderT s []
--   and provides similar instances.
--   
--   
--   >>> ("hello","world")^..runFold ((,) <$> Fold _2 <*> Fold both)
--   [("world","hello"),("world","world")]
--   
newtype () => ReifiedFold s a
Fold :: Fold s a -> ReifiedFold s a
[runFold] :: ReifiedFold s a -> Fold s a

-- | Reify an IndexedGetter 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 Getter so it can be stored safely in a container.
--   
--   This can also be useful when combining getters in novel ways, as
--   ReifiedGetter is isomorphic to (->) and provides
--   similar instances.
--   
--   
--   >>> ("hello","world","!!!")^.runGetter ((,) <$> Getter _2 <*> Getter (_1.to length))
--   ("world",5)
--   
newtype () => ReifiedGetter s a
Getter :: Getter s a -> ReifiedGetter s a
[runGetter] :: ReifiedGetter s a -> Getter s a

-- | 
--   type ReifiedTraversal' = Simple ReifiedTraversal
--   
type ReifiedTraversal' s a = ReifiedTraversal s s a a

-- | 
--   type ReifiedIndexedTraversal' i = Simple (ReifiedIndexedTraversal i)
--   
type ReifiedIndexedTraversal' i s a = ReifiedIndexedTraversal i s s a a

-- | Reify an IndexedTraversal 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

-- | 
--   type ReifiedIndexedLens' i = Simple (ReifiedIndexedLens i)
--   
type ReifiedIndexedLens' i s a = ReifiedIndexedLens i s s a a

-- | Reify an IndexedLens 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

-- | 
--   type ReifiedLens' = Simple ReifiedLens
--   
type ReifiedLens' s a = ReifiedLens s s a a

-- | Reify a Lens 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

-- | A Simple AnEquality.
type AnEquality' (s :: k) (a :: k) = AnEquality s s a a

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

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

-- | A Simple AnIso.
type AnIso' s a = AnIso s s a a

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

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

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

-- | 
--   _Cons :: Prism [a] [b] (a, [a]) (b, [b])
--   _Cons :: Prism (Seq a) (Seq b) (a, Seq a) (b, Seq b)
--   _Cons :: Prism (Vector a) (Vector b) (a, Vector a) (b, Vector b)
--   _Cons :: Prism' String (Char, String)
--   _Cons :: Prism' Text (Char, Text)
--   _Cons :: Prism' ByteString (Word8, ByteString)
--   
_Cons :: Cons s t a b => Prism s t (a, s) (b, t)
class (Rewrapped s t, Rewrapped t s) => Rewrapping s t
class Wrapped s => Rewrapped s t
type family Unwrapped s

-- | This class allows us to use magnify part of the environment,
--   changing the environment supplied by many different Monad
--   transformers. Unlike zoom this can change the environment of a
--   deeply nested Monad transformer.
--   
--   Also, unlike zoom, this can be used with any valid
--   Getter, but cannot be used with a Traversal or
--   Fold.
class (Magnified m ~ Magnified n, MonadReader b m, MonadReader a n) => Magnify (m :: Type -> Type) (n :: Type -> Type) 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 Getter.
--   
--   This acts like local, but can in many cases change the type of
--   the environment as well.
--   
--   This is commonly used to lift actions in a simpler Reader
--   Monad into a Monad with a larger environment type.
--   
--   This can be used to edit pretty much any Monad transformer
--   stack with an environment in it:
--   
--   
--   >>> (1,2) & magnify _2 (+1)
--   3
--   
--   
--   
--   >>> flip Reader.runReader (1,2) $ magnify _1 Reader.ask
--   1
--   
--   
--   
--   >>> flip Reader.runReader (1,2,[10..20]) $ magnify (_3._tail) Reader.ask
--   [11,12,13,14,15,16,17,18,19,20]
--   
--   
--   The type can be read as
--   
--   
--   magnify :: LensLike' (Magnified m c) a b -> m c -> n c
--   
--   
--   but the higher-rank constraints make it easier to apply
--   magnify to a Getter in highly-polymorphic code.
--   
--   
--   magnify :: Getter s a -> (a -> r) -> s -> r
--   magnify :: Monoid r => Fold s a   -> (a -> r) -> s -> r
--   
--   
--   
--   magnify :: Monoid w                 => Getter s t -> RWS t w st c -> RWS s w st c
--   magnify :: (Monoid w, Monoid c) => Fold s a   -> RWS a w st c -> RWS s w st c
--   ...
--   
magnify :: Magnify m n b a => ((Functor (Magnified m c), Contravariant (Magnified m c)) => LensLike' (Magnified m c) a b) -> m c -> n c
infixr 2 `magnify`

-- | This type family is used by Magnify to describe the common
--   effect type.
type family Magnified (m :: Type -> Type) :: Type -> Type -> Type

-- | This type family is used by Zoom to describe the common effect
--   type.
type family Zoomed (m :: Type -> Type) :: Type -> Type -> Type
class () => GPlated1 (f :: k -> Type) (g :: k -> Type)
class () => GPlated a (g :: k -> Type)

-- | A Plated type is one where we know how to extract its immediate
--   self-similar children.
--   
--   Example 1:
--   
--   
--   import Control.Applicative
--   import Control.Lens
--   import Control.Lens.Plated
--   import Data.Data
--   import Data.Data.Lens (uniplate)
--   
--   
--   
--   data Expr
--     = Val Int
--     | Neg Expr
--     | Add Expr Expr
--     deriving (Eq,Ord,Show,Read,Data)
--   
--   
--   
--   instance Plated Expr where
--     plate f (Neg e) = Neg <$> f e
--     plate f (Add a b) = Add <$> f a <*> f b
--     plate _ a = pure a
--   
--   
--   or
--   
--   
--   instance Plated Expr where
--     plate = uniplate
--   
--   
--   Example 2:
--   
--   
--   import Control.Applicative
--   import Control.Lens
--   import Control.Lens.Plated
--   import Data.Data
--   import Data.Data.Lens (uniplate)
--   
--   
--   
--   data Tree a
--     = Bin (Tree a) (Tree a)
--     | Tip a
--     deriving (Eq,Ord,Show,Read,Data)
--   
--   
--   
--   instance Plated (Tree a) where
--     plate f (Bin l r) = Bin <$> f l <*> f r
--     plate _ t = pure t
--   
--   
--   or
--   
--   
--   instance Data a => Plated (Tree a) where
--     plate = uniplate
--   
--   
--   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 Traversal and just use the various
--   ...Of combinators rather than pollute Plated with
--   orphan instances!
--   
--   If you want to find something unplated and non-recursive with
--   biplate use the ...OnOf variant with ignored,
--   though those usecases are much better served in most cases by using
--   the existing Lens combinators! e.g.
--   
--   
--   toListOf biplate ≡ universeOnOf biplate ignored
--   
--   
--   This same ability to explicitly pass the Traversal in question
--   is why there is no analogue to uniplate's Biplate.
--   
--   Moreover, since we can allow custom traversals, we implement
--   reasonable defaults for polymorphic data types, that only
--   traverse into themselves, and not their polymorphic
--   arguments.
class () => Plated a

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

-- | Extract each element of a (potentially monomorphic) container.
--   
--   Notably, when applied to a tuple, this generalizes both to
--   arbitrary homogeneous tuples.
--   
--   
--   >>> (1,2,3) & each *~ 10
--   (10,20,30)
--   
--   
--   It can also be used on monomorphic containers like Text or
--   ByteString.
--   
--   
--   >>> over each Char.toUpper ("hello"^.Text.packed)
--   "HELLO"
--   
--   
--   
--   >>> ("hello","world") & each.each %~ Char.toUpper
--   ("HELLO","WORLD")
--   
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

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

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

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

-- | This provides a common notion of a value at an index that is shared by
--   both Ixed and At.
type family IxValue m

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

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

-- | Name to give to generated field optics.
data () => DefName

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

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

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

-- | Rules to construct lenses for data fields.
data () => LensRules
pattern Empty :: AsEmpty s => s
pattern List :: IsList l => [Item l] -> l
pattern (:>) :: Snoc a a b b => a -> b -> a
infixl 5 :>
pattern (:<) :: Cons b b a a => a -> b -> b
infixr 5 :<
pattern Strict :: Strict s t => t -> s
pattern Lazy :: Strict t s => t -> s
pattern Wrapped :: Rewrapped s s => Unwrapped s -> s
pattern Reversed :: Reversing t => t -> t
pattern Swapped :: Swap p => p b a -> p a b
pattern Unwrapped :: Rewrapped t t => t -> Unwrapped t

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

-- | An Iso between the lazy variant of a structure and its strict
--   counterpart.
--   
--   
--   strict = from lazy
--   
strict :: Strict lazy strict => Iso' lazy strict

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

-- | An Iso between the strict variant of a structure and its lazy
--   counterpart.
--   
--   
--   lazy = from strict
--   
lazy :: Strict lazy strict => Iso' strict lazy

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

-- | Flipped version of <$>.
--   
--   
--   (<&>) = flip fmap
--   
--   
--   
Examples
--   
--   Apply (+1) to a list, a Just and a Right:
--   
--   
--   >>> Just 2 <&> (+1)
--   Just 3
--   
--   
--   
--   >>> [1,2,3] <&> (+1)
--   [2,3,4]
--   
--   
--   
--   >>> Right 3 <&> (+1)
--   Right 4
--   
(<&>) :: Functor f => f a -> (a -> b) -> f b
infixl 1 <&>

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

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

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

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

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

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

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

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

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

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

-- | Retrieve the First entry of a Fold or Traversal
--   or retrieve Just the result from a Getter or
--   Lens.
--   
--   The answer is computed in a manner that leaks space less than
--   preview or ^?' and gives you back access to
--   the outermost Just constructor more quickly, but does so in a
--   way that builds an intermediate structure, and thus may have worse
--   constant factors. This also means that it can not be used in any
--   MonadReader, but must instead have s passed as its
--   last argument, unlike preview.
--   
--   Note: this could been named headOf.
--   
--   
--   >>> firstOf traverse [1..10]
--   Just 1
--   
--   
--   
--   >>> firstOf both (1,2)
--   Just 1
--   
--   
--   
--   >>> firstOf ignored ()
--   Nothing
--   
--   
--   
--   firstOf :: Getter s a     -> s -> Maybe a
--   firstOf :: Fold s a       -> s -> Maybe a
--   firstOf :: Lens' s a      -> s -> Maybe a
--   firstOf :: Iso' s a       -> s -> Maybe a
--   firstOf :: Traversal' s a -> s -> Maybe a
--   
firstOf :: Getting (Leftmost a) s a -> s -> Maybe a

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

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

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

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

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

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

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

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

-- | Retrieve the first value targeted by a Fold or Traversal
--   (or Just the result from a Getter or Lens). See
--   also firstOf and ^?, which are similar with some subtle
--   differences (explained below).
--   
--   
--   listToMaybe . toList ≡ preview folded
--   
--   
--   
--   preview = view . pre
--   
--   
--   Unlike ^?, this function uses a MonadReader to read the
--   value to be focused in on. This allows one to pass the value as the
--   last argument by using the MonadReader instance for (->)
--   s However, it may also be used as part of some deeply nested
--   transformer stack.
--   
--   preview uses a monoidal value to obtain the result. This means
--   that it generally has good performance, but can occasionally cause
--   space leaks or even stack overflows on some data types. There is
--   another function, firstOf, which avoids these issues at the
--   cost of a slight constant performance cost and a little less
--   flexibility.
--   
--   It may be helpful to think of preview as having one of the
--   following more specialized types:
--   
--   
--   preview :: Getter s a     -> s -> Maybe a
--   preview :: Fold s a       -> s -> Maybe a
--   preview :: Lens' s a      -> s -> Maybe a
--   preview :: Iso' s a       -> s -> Maybe a
--   preview :: Traversal' s a -> s -> Maybe a
--   
--   
--   
--   preview :: MonadReader s m => Getter s a     -> m (Maybe a)
--   preview :: MonadReader s m => Fold s a       -> m (Maybe a)
--   preview :: MonadReader s m => Lens' s a      -> m (Maybe a)
--   preview :: MonadReader s m => Iso' s a       -> m (Maybe a)
--   preview :: MonadReader s m => Traversal' s a -> m (Maybe a)
--   
preview :: MonadReader s m => Getting (First a) s a -> m (Maybe a)

-- | Perform a safe head of a Fold or Traversal or
--   retrieve Just the result from a Getter or Lens.
--   
--   When using a Traversal as a partial Lens, or a
--   Fold as a partial Getter 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
--   firstOf instead, which can deal more gracefully with heavily
--   left-biased trees. This is because ^? works by using the
--   First monoid, which can occasionally cause space leaks.
--   
--   
--   >>> Left 4 ^?_Left
--   Just 4
--   
--   
--   
--   >>> Right 4 ^?_Left
--   Nothing
--   
--   
--   
--   >>> "world" ^? ix 3
--   Just 'l'
--   
--   
--   
--   >>> "world" ^? ix 20
--   Nothing
--   
--   
--   This operator works as an infix version of preview.
--   
--   
--   (^?) ≡ flip preview
--   
--   
--   It may be helpful to think of ^? as having one of the following
--   more specialized types:
--   
--   
--   (^?) :: s -> Getter s a     -> Maybe a
--   (^?) :: s -> Fold s a       -> Maybe a
--   (^?) :: s -> Lens' s a      -> Maybe a
--   (^?) :: s -> Iso' s a       -> Maybe a
--   (^?) :: s -> Traversal' s a -> Maybe a
--   
(^?) :: s -> Getting (First a) s a -> Maybe a
infixl 8 ^?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

-- | Set the target of a Lens, Traversal or Setter to
--   Just a value.
--   
--   
--   l ?~ t ≡ set l (Just t)
--   
--   
--   
--   >>> Nothing & id ?~ a
--   Just a
--   
--   
--   
--   >>> Map.empty & at 3 ?~ x
--   fromList [(3,x)]
--   
--   
--   ?~ can be used type-changily:
--   
--   
--   >>> ('a', ('b', 'c')) & _2.both ?~ 'x'
--   ('a',(Just 'x',Just 'x'))
--   
--   
--   
--   (?~) :: Setter s t a (Maybe b)    -> b -> s -> t
--   (?~) :: Iso s t a (Maybe b)       -> b -> s -> t
--   (?~) :: Lens s t a (Maybe b)      -> b -> s -> t
--   (?~) :: Traversal s t a (Maybe b) -> b -> s -> t
--   
(?~) :: ASetter s t a (Maybe b) -> b -> s -> t
infixr 4 ?~

-- | Modify the target of a Semigroup value by using
--   (<>).
--   
--   
--   >>> (Sum a,b) & _1 <>~ Sum c
--   (Sum {getSum = a + c},b)
--   
--   
--   
--   >>> (Sum a,Sum b) & both <>~ Sum c
--   (Sum {getSum = a + c},Sum {getSum = b + c})
--   
--   
--   
--   >>> both <>~ "!!!" $ ("hello","world")
--   ("hello!!!","world!!!")
--   
--   
--   
--   (<>~) :: Semigroup a => Setter s t a a    -> a -> s -> t
--   (<>~) :: Semigroup a => Iso s t a a       -> a -> s -> t
--   (<>~) :: Semigroup a => Lens s t a a      -> a -> s -> t
--   (<>~) :: Semigroup a => Traversal s t a a -> a -> s -> t
--   
(<>~) :: Semigroup a => ASetter s t a a -> a -> s -> t
infixr 4 <>~

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

-- | 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 l
--   .~ t directly is a good idea.
--   
--   
--   >>> (a,b) & _1 <.~ c
--   (c,(c,b))
--   
--   
--   
--   >>> ("good","morning","vietnam") & _3 <.~ "world"
--   ("world",("good","morning","world"))
--   
--   
--   
--   >>> (42,Map.fromList [("goodnight","gracie")]) & _2.at "hello" <.~ Just "world"
--   (Just "world",(42,fromList [("goodnight","gracie"),("hello","world")]))
--   
--   
--   
--   (<.~) :: Setter s t a b    -> b -> s -> (b, t)
--   (<.~) :: Iso s t a b       -> b -> s -> (b, t)
--   (<.~) :: Lens s t a b      -> b -> s -> (b, t)
--   (<.~) :: Traversal s t a b -> b -> s -> (b, t)
--   
(<.~) :: ASetter s t a b -> b -> s -> (b, t)
infixr 4 <.~

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

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

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

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

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

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

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

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

-- | Map each element of a structure targeted by a Lens 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 mapMOf is more liberal
--   in what it can accept.
--   
--   
--   mapMOf l ≡ imapMOf l . const
--   
--   
--   
--   imapMOf :: Monad m => IndexedLens       i s t a b -> (i -> a -> m b) -> s -> m t
--   imapMOf :: Monad m => IndexedTraversal  i s t a b -> (i -> a -> m b) -> s -> m t
--   imapMOf :: Bind  m => IndexedTraversal1 i s t a b -> (i -> a -> m b) -> s -> m t
--   
imapMOf :: Over (Indexed i) (WrappedMonad m) s t a b -> (i -> a -> m b) -> s -> m t

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

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

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

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

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

-- | alongside makes a Lens from two other lenses or a
--   Getter from two other getters by executing them on their
--   respective halves of a product.
--   
--   
--   >>> (Left a, Right b)^.alongside chosen chosen
--   (a,b)
--   
--   
--   
--   >>> (Left a, Right b) & alongside chosen chosen .~ (c,d)
--   (Left c,Right d)
--   
--   
--   
--   alongside :: Lens   s t a b -> Lens   s' t' a' b' -> Lens   (s,s') (t,t') (a,a') (b,b')
--   alongside :: Getter s   a   -> Getter s'    a'    -> Getter (s,s')        (a,a')
--   
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')

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

-- | Try the first Traversal (or Fold), falling back on the
--   second Traversal (or Fold) if it returns no entries.
--   
--   This is only a valid Traversal if the second Traversal
--   is disjoint from the result of the first or returns exactly the same
--   results. These conditions are trivially met when given a Lens,
--   Iso, Getter, Prism or "affine" Traversal -- one
--   that has 0 or 1 target.
--   
--   Mutatis mutandis for Fold.
--   
--   
--   >>> [0,1,2,3] ^? failing (ix 1) (ix 2)
--   Just 1
--   
--   
--   
--   >>> [0,1,2,3] ^? failing (ix 42) (ix 2)
--   Just 2
--   
--   
--   
--   failing :: Traversal s t a b -> Traversal s t a b -> Traversal s t a b
--   failing :: Prism s t a b     -> Prism s t a b     -> Traversal s t a b
--   failing :: Fold s a          -> Fold s a          -> Fold s a
--   
--   
--   These cases are also supported, trivially, but are boring, because the
--   left hand side always succeeds.
--   
--   
--   failing :: Lens s t a b      -> Traversal s t a b -> Traversal s t a b
--   failing :: Iso s t a b       -> Traversal s t a b -> Traversal s t a b
--   failing :: Equality s t a b  -> Traversal s t a b -> Traversal s t a b
--   failing :: Getter s a        -> Fold s a          -> Fold s a
--   
--   
--   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.
--   
--   
--   failing :: IndexedTraversal i s t a b -> IndexedTraversal i s t a b -> IndexedTraversal i s t a b
--   failing :: IndexedFold i s a          -> IndexedFold i s a          -> IndexedFold i s a
--   
--   
--   These cases are also supported, trivially, but are boring, because the
--   left hand side always succeeds.
--   
--   
--   failing :: IndexedLens i s t a b      -> IndexedTraversal i s t a b -> IndexedTraversal i s t a b
--   failing :: IndexedGetter i s a        -> IndexedGetter i s a        -> IndexedFold i s a
--   
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`
imapM :: (TraversableWithIndex i t, Monad m) => (i -> a -> m b) -> t a -> m (t b)
iforM :: (TraversableWithIndex i t, Monad m) => t a -> (i -> a -> m b) -> m (t b)
imapAccumR :: TraversableWithIndex i t => (i -> s -> a -> (s, b)) -> s -> t a -> (s, t b)
imapAccumL :: TraversableWithIndex i t => (i -> s -> a -> (s, b)) -> s -> t a -> (s, t b)
iany :: FoldableWithIndex i f => (i -> a -> Bool) -> f a -> Bool
iall :: FoldableWithIndex i f => (i -> a -> Bool) -> f a -> Bool
inone :: FoldableWithIndex i f => (i -> a -> Bool) -> f a -> Bool
itraverse_ :: (FoldableWithIndex i t, Applicative f) => (i -> a -> f b) -> t a -> f ()
ifor_ :: (FoldableWithIndex i t, Applicative f) => t a -> (i -> a -> f b) -> f ()
imapM_ :: (FoldableWithIndex i t, Monad m) => (i -> a -> m b) -> t a -> m ()
iforM_ :: (FoldableWithIndex i t, Monad m) => t a -> (i -> a -> m b) -> m ()
iconcatMap :: FoldableWithIndex i f => (i -> a -> [b]) -> f a -> [b]
ifind :: FoldableWithIndex i f => (i -> a -> Bool) -> f a -> Maybe (i, a)
ifoldrM :: (FoldableWithIndex i f, Monad m) => (i -> a -> b -> m b) -> b -> f a -> m b
ifoldlM :: (FoldableWithIndex i f, Monad m) => (i -> b -> a -> m b) -> b -> f a -> m b
itoList :: FoldableWithIndex i f => f a -> [(i, a)]
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)

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

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

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

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

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

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

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

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

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

-- | Restore ASetter to a full Setter.
cloneSetter :: ASetter s t a b -> Setter s t a b

-- | Build an IndexPreservingSetter from any Setter.
cloneIndexPreservingSetter :: ASetter s t a b -> IndexPreservingSetter s t a b

-- | Clone an IndexedSetter.
cloneIndexedSetter :: AnIndexedSetter i s t a b -> IndexedSetter i s t a b

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

-- | Set to Just 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 l
--   ?~ d directly is a good idea.
--   
--   
--   >>> import qualified Data.Map as Map
--   
--   >>> _2.at "hello" <?~ "world" $ (42,Map.fromList [("goodnight","gracie")])
--   ("world",(42,fromList [("goodnight","gracie"),("hello","world")]))
--   
--   
--   
--   (<?~) :: Setter s t a (Maybe b)    -> b -> s -> (b, t)
--   (<?~) :: Iso s t a (Maybe b)       -> b -> s -> (b, t)
--   (<?~) :: Lens s t a (Maybe b)      -> b -> s -> (b, t)
--   (<?~) :: Traversal s t a (Maybe b) -> b -> s -> (b, t)
--   
(<?~) :: ASetter s t a (Maybe b) -> b -> s -> (b, t)
infixr 4 <?~

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

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

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

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

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

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

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

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

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

-- | Modify the value of the Reader environment associated with
--   the target of a Setter, Lens, or Traversal.
--   
--   
--   locally l id a ≡ a
--   locally l f . locally l g ≡ locally l (f . g)
--   
--   
--   
--   >>> (1,1) & locally _1 (+1) (uncurry (+))
--   3
--   
--   
--   
--   >>> "," & locally ($) ("Hello" <>) (<> " world!")
--   "Hello, world!"
--   
--   
--   
--   locally :: MonadReader s m => Iso s s a b       -> (a -> b) -> m r -> m r
--   locally :: MonadReader s m => Lens s s a b      -> (a -> b) -> m r -> m r
--   locally :: MonadReader s m => Traversal s s a b -> (a -> b) -> m r -> m r
--   locally :: MonadReader s m => Setter s s a b    -> (a -> b) -> m r -> m r
--   
locally :: MonadReader s m => ASetter s s a b -> (a -> b) -> m r -> m r

-- | This is a generalization of locally that allows one to make
--   indexed local changes to a Reader environment
--   associated with the target of a Setter, Lens, or
--   Traversal.
--   
--   
--   locally l f ≡ ilocally l f . const
--   ilocally l f ≡ locally l f . Indexed
--   
--   
--   
--   ilocally :: MonadReader s m => IndexedLens s s a b      -> (i -> a -> b) -> m r -> m r
--   ilocally :: MonadReader s m => IndexedTraversal s s a b -> (i -> a -> b) -> m r -> m r
--   ilocally :: MonadReader s m => IndexedSetter s s a b    -> (i -> a -> b) -> m r -> m r
--   
ilocally :: MonadReader s m => AnIndexedSetter i s s a b -> (i -> a -> b) -> m r -> m r

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

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

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

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

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

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

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

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

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

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

-- | Obtain a getter and a setter from a lens, reversing lens.
withLens :: forall s t a b (rep :: RuntimeRep) (r :: TYPE rep). ALens s t a b -> ((s -> a) -> (s -> b -> t) -> r) -> r

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

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

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

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

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

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

-- | Merge two lenses, getters, setters, folds or traversals.
--   
--   
--   chosen ≡ choosing id id
--   
--   
--   
--   choosing :: Getter s a     -> Getter s' a     -> Getter (Either s s') a
--   choosing :: Fold s a       -> Fold s' a       -> Fold (Either s s') a
--   choosing :: Lens' s a      -> Lens' s' a      -> Lens' (Either s s') a
--   choosing :: Traversal' s a -> Traversal' s' a -> Traversal' (Either s s') a
--   choosing :: Setter' s a    -> Setter' s' a    -> Setter' (Either s s') a
--   
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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

-- | Modify the target of a Lens into your Monad's state by
--   using (<>) and return the old value that was
--   replaced.
--   
--   When you do not need the result of the operation, (<>=)
--   is more flexible.
--   
--   
--   (<<<>=) :: (MonadState s m, Semigroup r) => Lens' s r -> r -> m r
--   (<<<>=) :: (MonadState s m, Semigroup r) => Iso' s r -> r -> m r
--   
(<<<>=) :: (MonadState s m, Semigroup r) => LensLike' ((,) r) s r -> r -> m r
infix 4 <<<>=

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

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

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

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

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

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

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

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

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

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

-- | A version of (^.) that works on ALens.
--   
--   
--   >>> ("hello","world")^#_2
--   "world"
--   
(^#) :: s -> ALens s t a b -> a
infixl 8 ^#

-- | A version of set that works on ALens.
--   
--   
--   >>> storing _2 "world" ("hello","there")
--   ("hello","world")
--   
storing :: ALens s t a b -> b -> s -> t

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

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

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

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

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

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

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

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

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

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

-- | There is a field for every type in the Void. Very zen.
--   
--   
--   >>> [] & mapped.devoid +~ 1
--   []
--   
--   
--   
--   >>> Nothing & mapped.devoid %~ abs
--   Nothing
--   
--   
--   
--   devoid :: Lens' Void a
--   
devoid :: forall {k} p f (a :: k) b. Over p f Void Void a b

-- | We can always retrieve a () from any type.
--   
--   
--   >>> "hello"^.united
--   ()
--   
--   
--   
--   >>> "hello" & united .~ ()
--   "hello"
--   
united :: forall a f. Functor f => (() -> f ()) -> a -> f a

-- | A Lens focusing on the first element of a Traversable1
--   container.
--   
--   
--   >>> 2 :| [3, 4] & head1 +~ 10
--   12 :| [3,4]
--   
--   
--   
--   >>> Identity True ^. head1
--   True
--   
head1 :: forall (t :: Type -> Type) a. Traversable1 t => Lens' (t a) a

-- | A Lens focusing on the last element of a Traversable1
--   container.
--   
--   
--   >>> 2 :| [3, 4] & last1 +~ 10
--   2 :| [3,14]
--   
--   
--   
--   >>> Node 'a' [Node 'b' [], Node 'c' []] ^. last1
--   'c'
--   
last1 :: forall (t :: Type -> Type) a. Traversable1 t => Lens' (t a) a

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

-- | 
--   ito :: (s -> (i, a)) -> IndexedGetter i s a
--   
ito :: (Indexable i p, Contravariant f) => (s -> (i, a)) -> Over' p f s a

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

-- | 
--   ilike :: i -> a -> IndexedGetter i s a
--   
ilike :: (Indexable i p, Contravariant f, Functor f) => i -> a -> Over' p f s a

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

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

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

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

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

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

-- | View the index and value of an IndexedGetter into the current
--   environment as a pair.
--   
--   When applied to an IndexedFold 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)

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

-- | Use the index and value of an IndexedGetter into the current
--   state as a pair.
--   
--   When applied to an IndexedFold 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)

-- | Use a function of the index and value of an IndexedGetter into
--   the current state.
--   
--   When applied to an IndexedFold 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

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

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

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

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

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

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

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

-- | Coerce a polymorphic Prism to a Review.
--   
--   
--   reviewing :: Iso s t a b -> Review t b
--   reviewing :: Prism s t a b -> Review t b
--   
reviewing :: (Bifunctor p, Functor f) => Optic (Tagged :: Type -> Type -> Type) Identity s t a b -> Optic' p f t b

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

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

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

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

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

-- | Check to see if this Prism doesn't match.
--   
--   
--   >>> isn't _Left (Right 12)
--   True
--   
--   
--   
--   >>> isn't _Left (Left 12)
--   False
--   
--   
--   
--   >>> isn't _Empty []
--   False
--   
--   
--   
--   isn't = not . is
--   isn't = hasn't
--   
isn't :: APrism s t a b -> s -> Bool

-- | Like matching, but also works for combinations of Lens
--   and Prisms, and also Traversals.
--   
--   
--   >>> matching' (_2 . _Just) ('x', Just True)
--   Right True
--   
--   
--   
--   >>> matching' (_2 . _Just) ('x', Nothing :: Maybe Int) :: Either (Char, Maybe Bool) Int
--   Left ('x',Nothing)
--   
--   
--   
--   >>> matching' traverse "" :: Either [Int] Char
--   Left []
--   
--   
--   
--   >>> matching' traverse "xyz" :: Either [Int] Char
--   Right 'x'
--   
matching' :: LensLike (Either a) s t a b -> s -> Either t a

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

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

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

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

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

-- | This Prism 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
--   _Empty with the AsEmpty list instance):
--   
--   
--   >>> nearly [] null # ()
--   []
--   
--   >>> [1,2,3,4] ^? nearly [] null
--   Nothing
--   
--   
--   
--   nearly [] null :: Prism' [a] ()
--   
--   
--   To comply with the Prism laws the arguments you supply to
--   nearly a p are somewhat constrained.
--   
--   We assume p x holds iff x ≡ a. Under that assumption
--   then this is a valid Prism.
--   
--   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 is an improper prism for text formatting based on Read and
--   Show.
--   
--   This Prism is "improper" in the sense that it normalizes the
--   text formatting, but round tripping is idempotent given sane
--   Read/Show instances.
--   
--   
--   >>> _Show # 2
--   "2"
--   
--   
--   
--   >>> "EQ" ^? _Show :: Maybe Ordering
--   Just EQ
--   
--   
--   
--   _Show ≡ prism' show readMaybe
--   
_Show :: (Read a, Show a) => Prism' String a

-- | Obtain a Fold by lifting an operation that returns a
--   Foldable result.
--   
--   This can be useful to lift operations from Data.List and
--   elsewhere into a Fold.
--   
--   
--   >>> [1,2,3,4]^..folding reverse
--   [4,3,2,1]
--   
folding :: Foldable f => (s -> f a) -> Fold s a
ifolding :: (Foldable f, Indexable i p, Contravariant g, Applicative g) => (s -> f (i, a)) -> Over p g s t a b

-- | Obtain a Fold by lifting foldr like function.
--   
--   
--   >>> [1,2,3,4]^..foldring foldr
--   [1,2,3,4]
--   
foldring :: (Contravariant f, Applicative f) => ((a -> f a -> f a) -> f a -> s -> f a) -> LensLike f s t a b

-- | Obtain FoldWithIndex by lifting ifoldr 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 Fold from any Foldable indexed by ordinal
--   position.
folded64 :: forall (f :: Type -> Type) a. Foldable f => IndexedFold Int64 (f a) a

-- | Form a Fold1 by repeating the input forever.
--   
--   
--   repeat ≡ toListOf repeated
--   
--   
--   
--   >>> 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]
--   
--   
--   
--   repeated :: Fold1 a a
--   
repeated :: Apply f => LensLike' f a a

-- | A Fold that replicates its input n times.
--   
--   
--   replicate n ≡ toListOf (replicated n)
--   
--   
--   
--   >>> 5^..replicated 20
--   [5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5]
--   
replicated :: Int -> Fold a a

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

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

-- | x ^. iterated f returns an infinite
--   Fold1 of repeated applications of f to x.
--   
--   
--   toListOf (iterated f) a ≡ iterate f a
--   
--   
--   
--   iterated :: (a -> a) -> Fold1 a a
--   
iterated :: Apply f => (a -> a) -> LensLike' f a a

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

-- | Obtain a potentially empty IndexedTraversal by taking the first
--   element from another, potentially empty Fold and using it as an
--   index.
--   
--   The resulting optic can be composed with to filter another
--   Lens, Iso, Getter, Fold (or
--   Traversal).
--   
--   
--   >>> [(Just 2, 3), (Nothing, 4)] & mapped . filteredBy (_1 . _Just) <. _2 %@~ (*) :: [(Maybe Int, Int)]
--   [(Just 2,6),(Nothing,4)]
--   
--   
--   
--   filteredBy :: Fold a i -> IndexedTraversal' i a a
--   
--   
--   Note: As with filtered, this is not a legal
--   IndexedTraversal, unless you are very careful not to invalidate
--   the predicate on the target!
filteredBy :: (Indexable i p, Applicative f) => Getting (First i) a i -> p a (f a) -> a -> f a

-- | Obtain a Fold by taking elements from another Fold,
--   Lens, Iso, Getter or Traversal while a
--   predicate holds.
--   
--   
--   takeWhile p ≡ toListOf (takingWhile p folded)
--   
--   
--   
--   >>> timingOut $ toListOf (takingWhile (<=3) folded) [1..]
--   [1,2,3]
--   
--   
--   
--   takingWhile :: (a -> Bool) -> Fold s a                         -> Fold s a
--   takingWhile :: (a -> Bool) -> Getter s a                       -> Fold s a
--   takingWhile :: (a -> Bool) -> Traversal' s a                   -> Fold s a -- * See note below
--   takingWhile :: (a -> Bool) -> Lens' s a                        -> Fold s a -- * See note below
--   takingWhile :: (a -> Bool) -> Prism' s a                       -> Fold s a -- * See note below
--   takingWhile :: (a -> Bool) -> Iso' s a                         -> Fold s a -- * See note below
--   takingWhile :: (a -> Bool) -> IndexedTraversal' i s a          -> IndexedFold i s a -- * See note below
--   takingWhile :: (a -> Bool) -> IndexedLens' i s a               -> IndexedFold i s a -- * See note below
--   takingWhile :: (a -> Bool) -> IndexedFold i s a                -> IndexedFold i s a
--   takingWhile :: (a -> Bool) -> IndexedGetter i s a              -> IndexedFold i s a
--   
--   
--   Note: When applied to a Traversal, takingWhile
--   yields something that can be used as if it were a Traversal,
--   but which is not a Traversal 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 a Fold by dropping elements from another Fold,
--   Lens, Iso, Getter or Traversal while a
--   predicate holds.
--   
--   
--   dropWhile p ≡ toListOf (droppingWhile p folded)
--   
--   
--   
--   >>> toListOf (droppingWhile (<=3) folded) [1..6]
--   [4,5,6]
--   
--   
--   
--   >>> toListOf (droppingWhile (<=3) folded) [1,6,1]
--   [6,1]
--   
--   
--   
--   droppingWhile :: (a -> Bool) -> Fold s a                         -> Fold s a
--   droppingWhile :: (a -> Bool) -> Getter s a                       -> Fold s a
--   droppingWhile :: (a -> Bool) -> Traversal' s a                   -> Fold s a                -- see notes
--   droppingWhile :: (a -> Bool) -> Lens' s a                        -> Fold s a                -- see notes
--   droppingWhile :: (a -> Bool) -> Prism' s a                       -> Fold s a                -- see notes
--   droppingWhile :: (a -> Bool) -> Iso' s a                         -> Fold s a                -- see notes
--   
--   
--   
--   droppingWhile :: (a -> Bool) -> IndexPreservingTraversal' s a    -> IndexPreservingFold s a -- see notes
--   droppingWhile :: (a -> Bool) -> IndexPreservingLens' s a         -> IndexPreservingFold s a -- see notes
--   droppingWhile :: (a -> Bool) -> IndexPreservingGetter s a        -> IndexPreservingFold s a
--   droppingWhile :: (a -> Bool) -> IndexPreservingFold s a          -> IndexPreservingFold s a
--   
--   
--   
--   droppingWhile :: (a -> Bool) -> IndexedTraversal' i s a          -> IndexedFold i s a       -- see notes
--   droppingWhile :: (a -> Bool) -> IndexedLens' i s a               -> IndexedFold i s a       -- see notes
--   droppingWhile :: (a -> Bool) -> IndexedGetter i s a              -> IndexedFold i s a
--   droppingWhile :: (a -> Bool) -> IndexedFold i s a                -> IndexedFold i s a
--   
--   
--   Note: Many uses of this combinator will yield something that meets the
--   types, but not the laws of a valid Traversal or
--   IndexedTraversal. The Traversal and
--   IndexedTraversal 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 Traversal
--   fusion is not sound.
--   
--   So for any traversal t and predicate p,
--   droppingWhile p t may not be lawful, but
--   (dropping 1 . droppingWhile p) t is. For
--   example:
--   
--   
--   >>> let l  :: Traversal' [Int] Int; l  = droppingWhile (<= 1) traverse
--   
--   >>> let l' :: Traversal' [Int] Int; l' = dropping 1 l
--   
--   
--   l is not a lawful setter because over l f .
--   over l g ≢ over l (f . g):
--   
--   
--   >>> [1,2,3] & l .~ 0 & l .~ 4
--   [1,0,0]
--   
--   >>> [1,2,3] & l .~ 4
--   [1,4,4]
--   
--   
--   l' on the other hand behaves lawfully:
--   
--   
--   >>> [1,2,3] & l' .~ 0 & l' .~ 4
--   [1,2,4]
--   
--   >>> [1,2,3] & l' .~ 4
--   [1,2,4]
--   
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

-- | A Fold over the individual words of a String.
--   
--   
--   worded :: Fold String String
--   worded :: Traversal' String String
--   
--   
--   
--   worded :: IndexedFold Int String String
--   worded :: IndexedTraversal' Int String String
--   
--   
--   Note: This function type-checks as a Traversal 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
--   String contains only isolated space characters (and no other
--   characters that count as space, such as non-breaking spaces).
worded :: forall (f :: Type -> Type). Applicative f => IndexedLensLike' Int f String String

-- | A Fold over the individual lines of a String.
--   
--   
--   lined :: Fold String String
--   lined :: Traversal' String String
--   
--   
--   
--   lined :: IndexedFold Int String String
--   lined :: IndexedTraversal' Int String String
--   
--   
--   Note: This function type-checks as a Traversal 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
--   String contains only isolated newline characters.
lined :: forall (f :: Type -> Type). Applicative f => IndexedLensLike' Int f String String

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

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

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

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

-- | Extract a NonEmpty of the targets of Fold1.
--   
--   
--   >>> toNonEmptyOf both1 ("hello", "world")
--   "hello" :| ["world"]
--   
--   
--   
--   toNonEmptyOf :: Getter s a      -> s -> NonEmpty a
--   toNonEmptyOf :: Fold1 s a       -> s -> NonEmpty a
--   toNonEmptyOf :: Lens' s a       -> s -> NonEmpty a
--   toNonEmptyOf :: Iso' s a        -> s -> NonEmpty a
--   toNonEmptyOf :: Traversal1' s a -> s -> NonEmpty a
--   
toNonEmptyOf :: Getting (NonEmptyDList a) s a -> s -> NonEmpty a

-- | Calls pure on the target of a Lens, Getter, or
--   Iso.
--   
--   Calls pure on the targets of a Traversal, Fold,
--   or Prism, and combines them with <|> (or
--   empty if none). Intuitively, it collects targets into an
--   Alternative until the container fills up or it runs out of
--   targets, whichever comes first.
--   
--   Generalizes toListOf and (^?).
--   
--   
--   >>> altOf both ("hello", "world") :: [String]
--   ["hello","world"]
--   
--   >>> altOf both ("hello", "world") :: Maybe String
--   Just "hello"
--   
--   
--   
--   altOf :: Applicative f => Lens' s a      -> s -> f a
--   altOf :: Applicative f => Getter s a     -> s -> f a
--   altOf :: Applicative f => Iso' s a       -> s -> f a
--   
--   altOf :: Alternative f => Traversal' s a -> s -> f a
--   altOf :: Alternative f => Fold s a       -> s -> f a
--   altOf :: Alternative f => Prism' s a     -> s -> f a
--   
altOf :: Applicative f => Getting (Alt f a) s a -> s -> f a

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

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

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

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

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

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

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

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

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

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

-- | See sequenceAOf_ and traverse1Of_.
--   
--   
--   sequence1Of_ :: Apply f => Fold1 s (f a) -> s -> f ()
--   
sequence1Of_ :: Functor f => Getting (TraversedF a f) s (f a) -> s -> f ()

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

-- | A variant of foldrOf' 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.
--   
--   
--   foldr1Of l f ≡ foldr1 f . toListOf l
--   
--   
--   
--   foldr1Of' :: Getter s a     -> (a -> a -> a) -> s -> a
--   foldr1Of' :: Fold s a       -> (a -> a -> a) -> s -> a
--   foldr1Of' :: Iso' s a       -> (a -> a -> a) -> s -> a
--   foldr1Of' :: Lens' s a      -> (a -> a -> a) -> s -> a
--   foldr1Of' :: Traversal' s a -> (a -> a -> a) -> s -> a
--   
foldr1Of' :: HasCallStack => Getting (Dual (Endo (Endo (Maybe a)))) s a -> (a -> a -> a) -> s -> a

-- | A variant of foldlOf' 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.
--   
--   
--   foldl1Of' l f ≡ foldl1' f . toListOf l
--   
--   
--   
--   foldl1Of' :: Getter s a     -> (a -> a -> a) -> s -> a
--   foldl1Of' :: Fold s a       -> (a -> a -> a) -> s -> a
--   foldl1Of' :: Iso' s a       -> (a -> a -> a) -> s -> a
--   foldl1Of' :: Lens' s a      -> (a -> a -> a) -> s -> a
--   foldl1Of' :: Traversal' s a -> (a -> a -> a) -> s -> a
--   
foldl1Of' :: HasCallStack => Getting (Endo (Endo (Maybe a))) s a -> (a -> a -> a) -> s -> a

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

-- | The ifindMOf function takes an IndexedFold or
--   IndexedTraversal, 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 Nothing if there is no
--   such element.
--   
--   When you don't need access to the index then findMOf is more
--   flexible in what it accepts.
--   
--   
--   findMOf l ≡ ifindMOf l . const
--   
--   
--   
--   ifindMOf :: Monad m => IndexedGetter i s a     -> (i -> a -> m Bool) -> s -> m (Maybe a)
--   ifindMOf :: Monad m => IndexedFold i s a       -> (i -> a -> m Bool) -> s -> m (Maybe a)
--   ifindMOf :: Monad m => IndexedLens' i s a      -> (i -> a -> m Bool) -> s -> m (Maybe a)
--   ifindMOf :: Monad m => IndexedTraversal' i s a -> (i -> a -> m Bool) -> s -> m (Maybe a)
--   
ifindMOf :: Monad m => IndexedGetting i (Endo (m (Maybe a))) s a -> (i -> a -> m Bool) -> s -> m (Maybe a)

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

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

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

-- | 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 foldlMOf is more
--   flexible in what it accepts.
--   
--   
--   foldlMOf l ≡ ifoldlMOf l . const
--   
--   
--   
--   ifoldlMOf :: Monad m => IndexedGetter i s a     -> (i -> r -> a -> m r) -> r -> s -> m r
--   ifoldlMOf :: Monad m => IndexedFold i s a       -> (i -> r -> a -> m r) -> r -> s -> m r
--   ifoldlMOf :: Monad m => IndexedLens' i s a      -> (i -> r -> a -> m r) -> r -> s -> m r
--   ifoldlMOf :: Monad m => IndexedTraversal' i s a -> (i -> r -> a -> m r) -> r -> s -> m r
--   
ifoldlMOf :: Monad m => IndexedGetting i (Endo (r -> m r)) s a -> (i -> r -> a -> m r) -> r -> s -> m r

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

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

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

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

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

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

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

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

-- | Filter an IndexedFold or IndexedGetter, obtaining an
--   IndexedFold.
--   
--   
--   >>> [0,0,0,5,5,5]^..traversed.ifiltered (\i a -> i <= a)
--   [0,5,5,5]
--   
--   
--   Compose with ifiltered to filter another IndexedLens,
--   IndexedIso, IndexedGetter, IndexedFold (or
--   IndexedTraversal) with access to both the value and the index.
--   
--   Note: As with filtered, this is not a legal
--   IndexedTraversal, 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

-- | Obtain an IndexedFold by taking elements from another
--   IndexedFold, IndexedLens, IndexedGetter or
--   IndexedTraversal while a predicate holds.
--   
--   
--   itakingWhile :: (i -> a -> Bool) -> IndexedFold i s a          -> IndexedFold i s a
--   itakingWhile :: (i -> a -> Bool) -> IndexedTraversal' i s a    -> IndexedFold i s a
--   itakingWhile :: (i -> a -> Bool) -> IndexedLens' i s a         -> IndexedFold i s a
--   itakingWhile :: (i -> a -> Bool) -> IndexedGetter i s a        -> IndexedFold i s a
--   
--   
--   Note: Applying itakingWhile to an IndexedLens or
--   IndexedTraversal will still allow you to use it as a
--   pseudo-IndexedTraversal, but if you change the value of any
--   target to one where the predicate returns False, then you will
--   break the Traversal laws and Traversal 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)) :: Type -> Type) s a -> Optical' p q f s a

-- | Obtain an IndexedFold by dropping elements from another
--   IndexedFold, IndexedLens, IndexedGetter or
--   IndexedTraversal while a predicate holds.
--   
--   
--   idroppingWhile :: (i -> a -> Bool) -> IndexedFold i s a          -> IndexedFold i s a
--   idroppingWhile :: (i -> a -> Bool) -> IndexedTraversal' i s a    -> IndexedFold i s a -- see notes
--   idroppingWhile :: (i -> a -> Bool) -> IndexedLens' i s a         -> IndexedFold i s a -- see notes
--   idroppingWhile :: (i -> a -> Bool) -> IndexedGetter i s a        -> IndexedFold i s a
--   
--   
--   Note: As with droppingWhile applying idroppingWhile to
--   an IndexedLens or IndexedTraversal will still allow you
--   to use it as a pseudo-IndexedTraversal, but if you change the
--   value of the first target to one where the predicate returns
--   True, then you will break the Traversal laws and
--   Traversal 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

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

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

-- | Build a Traversal by providing a function which specifies the
--   elements you wish to focus.
--   
--   The caller provides a function of type:
--   
--   
--   Applicative f => (a -> f b) -> s -> f t
--   
--   
--   Which is a higher order function which accepts a "focusing function"
--   and applies it to all desired focuses within s, then
--   constructs a t using the Applicative instance of f.
--   
--   Only elements which are "focused" using the focusing function will be
--   targeted by the resulting traversal.
--   
--   For example, we can explicitly write a traversal which targets the
--   first and third elements of a tuple like this:
--   
--   
--   firstAndThird :: Traversal (a, x, a) (b, x, b) a b
--   firstAndThird = traversal go
--     where
--       go :: Applicative f => (a -> f b) -> (a, x, a) -> f (b, x, b)
--       go focus (a, x, a') = liftA3 (,,) (focus a) (pure x) (focus a')
--   
--   
--   
--   >>> (1,"two",3) & firstAndThird *~ 10
--   (10,"two",30)
--   
--   
--   
--   >>> over firstAndThird length ("one",2,"three")
--   (3,2,5)
--   
--   
--   We can re-use existing Traversals when writing new ones by
--   passing our focusing function along to them. This example re-uses
--   traverse to focus all elements in a list which is embedded in a
--   tuple. This traversal could also be written simply as _2 .
--   traverse.
--   
--   
--   selectNested :: Traversal (x, [a]) (x, [b]) a b
--   selectNested = traversal go
--     where
--       go :: Applicative f => (a -> f b) -> (x, [a]) -> f (x, [b])
--       go focus (x, as) = liftA2 (,) (pure x) (traverse focus as)
--   
--   
--   
--   >>> selectNested .~ "hello" $ (1,[2,3,4,5])
--   (1,["hello","hello","hello","hello"])
--   
--   
--   
--   >>> (1,[2,3,4,5]) & selectNested *~ 3
--   (1,[6,9,12,15])
--   
--   
--   Note that the traversal function actually just returns the same
--   function you pass to it. The function it accepts is in fact a valid
--   traversal all on its own! The use of traversal does nothing
--   except verify that the function it is passed matches the signature of
--   a valid traversal. One could remove the traversal combinator
--   from either of the last two examples and use the definition of
--   go directly with no change in behaviour.
--   
--   This function exists for consistency with the lens,
--   prism and iso constructors as well as to serve as a
--   touchpoint for beginners who wish to construct their own traversals
--   but are uncertain how to do so.
traversal :: ((a -> f b) -> s -> f t) -> LensLike f s t a b

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

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

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

-- | Sequence the (monadic) effects targeted by a Lens in a
--   container from left to right.
--   
--   
--   >>> 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)]
--   
--   
--   
--   sequence ≡ sequenceOf traverse
--   sequenceOf l ≡ mapMOf l id
--   sequenceOf l ≡ unwrapMonad . l WrapMonad
--   
--   
--   
--   sequenceOf :: Monad m => Iso s t (m b) b       -> s -> m t
--   sequenceOf :: Monad m => Lens s t (m b) b      -> s -> m t
--   sequenceOf :: Monad m => Traversal s t (m b) b -> s -> m t
--   
sequenceOf :: LensLike (WrappedMonad m) s t (m b) b -> s -> m t

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

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

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

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

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

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

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

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

-- | An indexed version of partsOf 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 type-restricted version of partsOf that can only be used with
--   a Traversal.
partsOf' :: ATraversal s t a a -> Lens s t [a] [a]

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

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

-- | An indexed version of unsafePartsOf 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]
unsafePartsOf' :: ATraversal s t a b -> Lens s t [a] [b]
iunsafePartsOf' :: forall i s t a b. Over (Indexed i) (Bazaar (Indexed i) a b) s t a b -> IndexedLens [i] s t [a] [b]

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

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

-- | The non-empty version of holesOf. This extract a non-empty list
--   of immediate children according to a given Traversal1 as
--   editable contexts.
--   
--   
--   >>> let head1 f s = runPretext (NonEmpty.head $ holes1Of traversed1 s) f
--   
--   >>> ('a' :| "bc") ^. head1
--   'a'
--   
--   
--   
--   >>> ('a' :| "bc") & head1 %~ toUpper
--   'A' :| "bc"
--   
--   
--   
--   holes1Of :: Iso' s a                 -> s -> NonEmpty (Pretext' (->) a s)
--   holes1Of :: Lens' s a                -> s -> NonEmpty (Pretext' (->) a s)
--   holes1Of :: Traversal1' s a          -> s -> NonEmpty (Pretext' (->) a s)
--   holes1Of :: IndexedLens' i s a       -> s -> NonEmpty (Pretext' (Indexed i) a s)
--   holes1Of :: IndexedTraversal1' i s a -> s -> NonEmpty (Pretext' (Indexed i) a s)
--   
holes1Of :: Conjoined p => Over p (Bazaar1 p a a) s t a a -> s -> NonEmpty (Pretext p a a t)

-- | Traverse both parts of a Bitraversable container with matching
--   types.
--   
--   Usually that type will be a pair. Use each to traverse the
--   elements of arbitrary homogeneous tuples.
--   
--   
--   >>> (1,2) & both *~ 10
--   (10,20)
--   
--   
--   
--   >>> over both length ("hello","world")
--   (5,5)
--   
--   
--   
--   >>> ("hello","world")^.both
--   "helloworld"
--   
--   
--   
--   both :: Traversal (a, a)       (b, b)       a b
--   both :: Traversal (Either a a) (Either b b) a b
--   
both :: forall (r :: Type -> Type -> Type) a b. Bitraversable r => Traversal (r a a) (r b b) a b

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

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

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

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

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

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

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

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

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

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

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

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

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

-- | Traverse the nth element of a Traversable container.
--   
--   
--   element ≡ elementOf traverse
--   
element :: forall (t :: Type -> Type) a. Traversable t => Int -> IndexedTraversal' Int (t a) a

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

-- | Traverse elements of a Traversable container where their
--   ordinal positions match a predicate.
--   
--   
--   elements ≡ elementsOf traverse
--   
elements :: forall (t :: Type -> Type) a. Traversable t => (Int -> Bool) -> IndexedTraversal' Int (t a) a

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

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

-- | Try the second traversal. If it returns no entries, try again with all
--   entries from the first traversal, recursively.
--   
--   
--   deepOf :: Fold s s          -> Fold s a                   -> Fold s a
--   deepOf :: Traversal' s s    -> Traversal' s a             -> Traversal' s a
--   deepOf :: Traversal s t s t -> Traversal s t a b          -> Traversal s t a b
--   deepOf :: Fold s s          -> IndexedFold i s a          -> IndexedFold i s a
--   deepOf :: Traversal s t s t -> IndexedTraversal i s t a b -> IndexedTraversal i s t a b
--   
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

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

-- | Traverse a container using a specified Applicative.
--   
--   This is like traverseBy where the Traversable instance
--   can be specified by any Traversal
--   
--   
--   traverseByOf traverse ≡ traverseBy
--   
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

-- | Sequence a container using a specified Applicative.
--   
--   This is like traverseBy where the Traversable instance
--   can be specified by any Traversal
--   
--   
--   sequenceByOf traverse ≡ sequenceBy
--   
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

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

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

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

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

-- | Composition of Indexed 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

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

-- | The IndexedFold of a FoldableWithIndex container.
--   
--   ifolded . asIndex is a fold over the
--   keys of a FoldableWithIndex.
--   
--   
--   >>> Data.Map.fromList [(2, "hello"), (1, "world")]^..ifolded.asIndex
--   [1,2]
--   
ifolded :: forall i (f :: Type -> Type) a. FoldableWithIndex i f => IndexedFold i (f a) a

-- | The IndexedTraversal of a TraversableWithIndex
--   container.
itraversed :: forall i (t :: Type -> Type) a b. TraversableWithIndex i t => IndexedTraversal i (t a) (t b) a b
ifoldMapBy :: FoldableWithIndex i t => (r -> r -> r) -> r -> (i -> a -> r) -> t a -> r
ifoldMapByOf :: IndexedFold i t a -> (r -> r -> r) -> r -> (i -> a -> r) -> t -> r
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)
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

-- | Extract a witness of type Equality.
runEq :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2). AnEquality s t a b -> Identical s t a b

-- | Substituting types with Equality.
substEq :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2) (rep :: RuntimeRep) (r :: TYPE rep). AnEquality s t a b -> ((s ~ a, t ~ b) => r) -> r

-- | We can use Equality to do substitution into anything.
mapEq :: forall k1 k2 (s :: k1) (t :: k2) (a :: k1) (b :: k2) f. AnEquality s t a b -> f s -> f a

-- | Equality is symmetric.
fromEq :: forall {k2} {k1} (s :: k2) (t :: k1) (a :: k2) (b :: k1). AnEquality s t a b -> Equality b a t s

-- | This is an adverb that can be used to modify many other Lens
--   combinators to make them require simple lenses, simple traversals,
--   simple prisms or simple isos as input.
simply :: forall {k} {k1} p (f :: k -> k1) (s :: k) (a :: k) (rep :: RuntimeRep) (r :: TYPE rep). (Optic' p f s a -> r) -> Optic' p f s a -> r

-- | Composition with this isomorphism is occasionally useful when your
--   Lens, Traversal or Iso has a constraint on an
--   unused argument to force that argument to agree with the type of a
--   used argument and avoid ScopedTypeVariables or other
--   ugliness.
simple :: forall {k2} (a :: k2) k3 p (f :: k2 -> k3). p a (f a) -> p a (f a)
cloneEquality :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2). AnEquality s t a b -> Equality s t a b

-- | Construct an Equality from explicit equality evidence.
equality :: forall {k1} {k2} (s :: k1) (a :: k1) (b :: k2) (t :: k2). (s :~: a) -> (b :~: t) -> Equality s t a b

-- | A Simple version of equality
equality' :: forall {k2} (a :: k2) (b :: k2). (a :~: b) -> Equality' a b

-- | Recover a "profunctor lens" form of equality. Reverses
--   fromLeibniz.
overEquality :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2) p. AnEquality s t a b -> p a b -> p s t

-- | The opposite of working overEquality is working
--   underEquality.
underEquality :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2) p. AnEquality s t a b -> p t s -> p b a

-- | Convert a "profunctor lens" form of equality to an equality. Reverses
--   overEquality.
--   
--   The type should be understood as
--   
--   
--   fromLeibniz :: (forall p. p a b -> p s t) -> Equality s t a b
--   
fromLeibniz :: forall {k1} {k2} (a :: k1) (b :: k2) (s :: k1) (t :: k2). (Identical a b a b -> Identical a b s t) -> Equality s t a b

-- | Convert Leibniz equality to equality. Reverses mapEq in
--   Simple cases.
--   
--   The type should be understood as
--   
--   
--   fromLeibniz' :: (forall f. f s -> f a) -> Equality' s a
--   
fromLeibniz' :: forall {k2} (s :: k2) (a :: k2). ((s :~: s) -> s :~: a) -> Equality' s a

-- | A version of substEq that provides explicit, rather than
--   implicit, equality evidence.
withEquality :: forall {k1} {k2} (s :: k1) (t :: k2) (a :: k1) (b :: k2) (rep :: RuntimeRep) (r :: TYPE rep). AnEquality s t a b -> ((s :~: a) -> (b :~: t) -> r) -> r

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

-- | Extract the two functions, one from s -> a and one from
--   b -> t that characterize an Iso.
withIso :: forall s t a b (rep :: RuntimeRep) (r :: TYPE rep). AnIso s t a b -> ((s -> a) -> (b -> t) -> r) -> r

-- | Convert from AnIso back to any Iso.
--   
--   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 cloneLens or cloneTraversal for more information on
--   why you might want to do this.
cloneIso :: AnIso s t a b -> Iso s t a b

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

-- | Based on ala' from Conor McBride's work on Epigram.
--   
--   This version is generalized to accept any Iso, not just a
--   newtype.
--   
--   For a version you pass the name of the newtype constructor
--   to, see alaf.
--   
--   
--   >>> auf (_Wrapping Sum) (foldMapOf both) Prelude.length ("hello","world")
--   10
--   
--   
--   Mnemonically, the German auf plays a similar role to à
--   la, and the combinator is au with an extra function
--   argument:
--   
--   
--   auf :: Iso s t a b -> ((r -> t) -> e -> s) -> (r -> b) -> e -> a
--   
--   
--   but the signature is general.
--   
--   Note: The direction of the Iso required for this function
--   changed in lens 4.18 to match up with the behavior of
--   au. For the old behavior use xplatf or for a version
--   that is compatible across both old and new versions of lens
--   you can just use coerce!
auf :: (Functor f, Functor g) => AnIso s t a b -> (f t -> g s) -> f b -> g a

-- | xplat = au . from but with a nicer
--   signature.
xplat :: forall {k2} s g (t :: k2) a (b :: k2). Optic (Costar ((->) s)) g s t a b -> ((s -> a) -> g b) -> g t

-- | xplatf = auf . from but with a nicer
--   signature.
--   
--   
--   >>> xplatf (_Unwrapping Sum) (foldMapOf both) Prelude.length ("hello","world")
--   10
--   
--   
--   
--   xplatf :: Iso s t a b -> ((r -> a) -> e -> b) -> (r -> s) -> e -> t
--   
xplatf :: forall {k} {k2} f g (s :: k) (t :: k2) (a :: k) (b :: k2). Optic (Costar f) g s t a b -> (f a -> g b) -> f s -> g t

-- | The opposite of working over a Setter is working
--   under an isomorphism.
--   
--   
--   under ≡ over . from
--   
--   
--   
--   under :: Iso s t a b -> (t -> s) -> b -> a
--   
under :: AnIso s t a b -> (t -> s) -> b -> a

-- | This isomorphism can be used to convert to or from an instance of
--   Enum.
--   
--   
--   >>> LT^.from enum
--   0
--   
--   
--   
--   >>> 97^.enum :: Char
--   'a'
--   
--   
--   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
--   Enum instances for Double, and Float that exist
--   solely for [1.0 .. 4.0] sugar and the instances for those and
--   Integer don't cover all values in their range.
enum :: Enum a => Iso' Int a

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

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

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

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

-- | The canonical isomorphism for currying and uncurrying a function.
--   
--   
--   curried = iso curry uncurry
--   
--   
--   
--   >>> (fst^.curried) 3 4
--   3
--   
--   
--   
--   >>> view curried fst 3 4
--   3
--   
curried :: forall a b c d e f1 p f2. (Profunctor p, Functor f2) => p (a -> b -> c) (f2 (d -> e -> f1)) -> p ((a, b) -> c) (f2 ((d, e) -> f1))

-- | The canonical isomorphism for uncurrying and currying a function.
--   
--   
--   uncurried = iso uncurry curry
--   
--   
--   
--   uncurried = from curried
--   
--   
--   
--   >>> ((+)^.uncurried) (1,2)
--   3
--   
uncurried :: forall a b c d e f1 p f2. (Profunctor p, Functor f2) => p ((a, b) -> c) (f2 ((d, e) -> f1)) -> p (a -> b -> c) (f2 (d -> e -> f1))

-- | The isomorphism for flipping a function.
--   
--   
--   >>> ((,)^.flipped) 1 2
--   (2,1)
--   
flipped :: forall a b c a' b' c' p f. (Profunctor p, Functor f) => p (b -> a -> c) (f (b' -> a' -> c')) -> p (a -> b -> c) (f (a' -> b' -> c'))

-- | 
--   swapped . swapped ≡ id
--   first f . swapped = swapped . second f
--   second g . swapped = swapped . first g
--   bimap f g . swapped = swapped . bimap g f
--   
--   
--   
--   >>> (1,2)^.swapped
--   (2,1)
--   
swapped :: forall (p :: Type -> Type -> Type) a b c d. Swap p => Iso (p a b) (p c d) (p b a) (p d c)

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

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

-- | This isomorphism can be used to inspect a Traversal to see how
--   it associates the structure and it can also be used to bake the
--   Traversal into a Magma 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)

-- | This isomorphism can be used to inspect an IndexedTraversal to
--   see how it associates the structure and it can also be used to bake
--   the IndexedTraversal into a Magma 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)

-- | Lift an Iso into a Contravariant functor.
--   
--   
--   contramapping :: Contravariant f => Iso s t a b -> Iso (f a) (f b) (f s) (f t)
--   contramapping :: Contravariant f => Iso' s a -> Iso' (f a) (f s)
--   
contramapping :: forall (f :: Type -> Type) s t a b. Contravariant f => AnIso s t a b -> Iso (f a) (f b) (f s) (f t)

-- | Lift two Isos into both arguments of a Profunctor
--   simultaneously.
--   
--   
--   dimapping :: Profunctor p => Iso s t a b -> Iso s' t' a' b' -> Iso (p a s') (p b t') (p s a') (p t b')
--   dimapping :: Profunctor p => Iso' s a -> Iso' s' a' -> Iso' (p a s') (p s a')
--   
dimapping :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type) s t a b s' t' a' b'. (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 Iso contravariantly into the left argument of a
--   Profunctor.
--   
--   
--   lmapping :: Profunctor p => Iso s t a b -> Iso (p a x) (p b y) (p s x) (p t y)
--   lmapping :: Profunctor p => Iso' s a -> Iso' (p a x) (p s x)
--   
lmapping :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type) s t a b x y. (Profunctor p, Profunctor q) => AnIso s t a b -> Iso (p a x) (q b y) (p s x) (q t y)

-- | Lift an Iso covariantly into the right argument of a
--   Profunctor.
--   
--   
--   rmapping :: Profunctor p => Iso s t a b -> Iso (p x s) (p y t) (p x a) (p y b)
--   rmapping :: Profunctor p => Iso' s a -> Iso' (p x s) (p x a)
--   
rmapping :: forall (p :: Type -> Type -> Type) (q :: Type -> Type -> Type) s t a b x y. (Profunctor p, Profunctor q) => AnIso s t a b -> Iso (p x s) (q y t) (p x a) (q y b)

-- | Lift two Isos into both arguments of a Bifunctor.
--   
--   
--   bimapping :: Bifunctor p => Iso s t a b -> Iso s' t' a' b' -> Iso (p s s') (p t t') (p a a') (p b b')
--   bimapping :: Bifunctor p => Iso' s a -> Iso' s' a' -> Iso' (p s s') (p a a')
--   
bimapping :: forall (f :: Type -> Type -> Type) (g :: Type -> Type -> Type) s t a b s' t' a' b'. (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 Iso into the first argument of a Bifunctor.
--   
--   
--   firsting :: Bifunctor p => Iso s t a b -> Iso (p s x) (p t y) (p a x) (p b y)
--   firsting :: Bifunctor p => Iso' s a -> Iso' (p s x) (p a x)
--   
firsting :: forall (f :: Type -> Type -> Type) (g :: Type -> Type -> Type) s t a b x y. (Bifunctor f, Bifunctor g) => AnIso s t a b -> Iso (f s x) (g t y) (f a x) (g b y)

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

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

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

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

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

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

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

-- | Work under a newtype wrapper.
--   
--   
--   >>> Const "hello" & _Wrapped %~ Prelude.length & getConst
--   5
--   
--   
--   
--   _Wrapped   ≡ from _Unwrapped
--   _Unwrapped ≡ from _Wrapped
--   
_Wrapped :: Rewrapping s t => Iso s t (Unwrapped s) (Unwrapped t)
_Unwrapped :: Rewrapping s t => Iso (Unwrapped t) (Unwrapped s) t s

-- | Given the constructor for a Wrapped type, return a
--   deconstructor that is its inverse.
--   
--   Assuming the Wrapped instance is legal, these laws hold:
--   
--   
--   op f . f ≡ id
--   f . op f ≡ id
--   
--   
--   
--   >>> op Identity (Identity 4)
--   4
--   
--   
--   
--   >>> op Const (Const "hello")
--   "hello"
--   
op :: Wrapped s => (Unwrapped s -> s) -> s -> Unwrapped s

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

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

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

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

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

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

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

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

-- | 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 by applying a monadic rule everywhere you recursing with a
--   user-specified Traversal. 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 inside of a structure
--   located by a user-specified Traversal. 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 inside of a structure
--   located by a user-specified Traversal, using a user-specified
--   Traversal 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

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

-- | Given a Fold that knows how to locate immediate children,
--   retrieve all of the transitive descendants of a node, including
--   itself.
--   
--   
--   universeOf :: Fold a a -> a -> [a]
--   
universeOf :: Getting (Endo [a]) a a -> a -> [a]

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

-- | Given a Fold 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 Fold.
--   
--   
--   toListOf l ≡ universeOnOf l ignored
--   
universeOnOf :: Getting (Endo [a]) s a -> Getting (Endo [a]) a a -> s -> [a]

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

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

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

-- | Given a Fold 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 Fold.
--   
--   
--   cosmosOnOf :: Fold s a -> Fold a a -> Fold s a
--   
cosmosOnOf :: (Applicative f, Contravariant f) => LensLike' f s a -> LensLike' f a a -> LensLike' f s a

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

-- | Transform every element by recursively applying a given Setter
--   in a bottom-up manner.
--   
--   
--   transformOf :: Traversal' a a -> (a -> a) -> a -> a
--   transformOf :: Setter' a a    -> (a -> a) -> a -> a
--   
transformOf :: ASetter a b a b -> (b -> b) -> a -> b

-- | Transform every element in a region indicated by a Setter by
--   recursively applying another Setter in a bottom-up manner.
--   
--   
--   transformOnOf :: Setter' s a -> Traversal' a a -> (a -> a) -> s -> s
--   transformOnOf :: Setter' s a -> Setter' a a    -> (a -> a) -> s -> s
--   
transformOnOf :: ASetter s t a b -> ASetter a b a b -> (b -> b) -> s -> 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 the tree in a region indicated by a
--   supplied Traversal, in a bottom-up manner, monadically.
--   
--   
--   transformMOn :: (Monad m, Plated a) => Traversal' s a -> (a -> m a) -> s -> m s
--   
transformMOn :: (Monad m, Plated a) => LensLike (WrappedMonad m) s t a a -> (a -> m a) -> s -> m t

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

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

-- | Return a list of all of the editable contexts for every location in
--   the structure, recursively.
--   
--   
--   propUniverse x = universe x == map pos (contexts x)
--   propId x = all (== x) [extract w | w <- contexts x]
--   
--   
--   
--   contexts ≡ contextsOf plate
--   
contexts :: Plated a => a -> [Context 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
--   Traversal, recursively using plate.
--   
--   
--   contextsOn b ≡ contextsOnOf b plate
--   
--   
--   
--   contextsOn :: Plated a => Traversal' s a -> s -> [Context a a s]
--   
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 in an areas indicated by a user supplied
--   Traversal, recursively using another user-supplied
--   Traversal to walk each layer.
--   
--   
--   contextsOnOf :: Traversal' s a -> Traversal' a a -> s -> [Context a a s]
--   
contextsOnOf :: ATraversal s t a a -> ATraversal' a a -> s -> [Context a a t]

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

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

-- | Extract one level of holes from a container in a region
--   specified by one Traversal, using another.
--   
--   
--   holesOnOf b l ≡ holesOf (b . l)
--   
--   
--   
--   holesOnOf :: Iso' s a       -> Iso' a a                -> s -> [Pretext (->) a a s]
--   holesOnOf :: Lens' s a      -> Lens' a a               -> s -> [Pretext (->) a a s]
--   holesOnOf :: Traversal' s a -> Traversal' a a          -> s -> [Pretext (->) a a s]
--   holesOnOf :: Lens' s a      -> IndexedLens' i a a      -> s -> [Pretext (Indexed i) a a s]
--   holesOnOf :: Traversal' s a -> IndexedTraversal' i a a -> s -> [Pretext (Indexed i) a a s]
--   
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]

-- | Perform a fold-like computation on each value, technically a
--   paramorphism.
--   
--   
--   paraOf :: Fold a a -> (a -> [r] -> r) -> a -> r
--   
paraOf :: Getting (Endo [a]) a a -> (a -> [r] -> r) -> a -> r

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

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

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

-- | Implement plate operation for a type using its Generic
--   instance.
--   
--   Note: the behavior may be different than with uniplate in some
--   special cases. gplate doesn't look through other types in a
--   group of mutually recursive types.
--   
--   For example consider mutually recursive even and odd natural numbers:
--   
--   
--   >>> data Even = Z | E Odd deriving (Show, Generic, Data); data Odd = O Even deriving (Show, Generic, Data)
--   
--   
--   Then uniplate, which is based on Data, finds all even
--   numbers less or equal than four:
--   
--   
--   >>> import Data.Data.Lens (uniplate)
--   
--   >>> universeOf uniplate (E (O (E (O Z))))
--   [E (O (E (O Z))),E (O Z),Z]
--   
--   
--   but gplate doesn't see through Odd.
--   
--   
--   >>> universeOf gplate (E (O (E (O Z))))
--   [E (O (E (O Z)))]
--   
--   
--   If using Data is not an option, you can still write the
--   traversal manually. It is sometimes useful to use helper traversals
--   
--   
--   >>> :{
--   let oddeven :: Traversal' Odd Even
--       oddeven f (O n) = O <$> f n
--       evenplate :: Traversal' Even Even
--       evenplate f Z     = pure Z
--       evenplate f (E n) = E <$> oddeven f n
--   :}
--   
--   
--   
--   >>> universeOf evenplate (E (O (E (O Z))))
--   [E (O (E (O Z))),E (O Z),Z]
--   
gplate :: (Generic a, GPlated a (Rep a)) => Traversal' a a

-- | Implement plate operation for a type using its Generic1
--   instance.
gplate1 :: forall {k} (f :: k -> Type) (a :: k). (Generic1 f, GPlated1 f (Rep1 f)) => Traversal' (f a) (f a)

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

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

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

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

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

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

-- | Generate a Prism 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.
--   
--   e.g.
--   
--   
--   data FooBarBaz a
--     = Foo Int
--     | Bar a
--     | Baz Int Char
--   makeClassyPrisms ''FooBarBaz
--   
--   
--   will create
--   
--   
--   class AsFooBarBaz s a | s -> 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
--   
--   
--   Generate an As 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.
--   
--   In the event that the name of a data type is also the name of one of
--   its constructors, the name of the Prism generated for the
--   data type will be prefixed with an extra _ (if the data type
--   name is prefix) or . (if the name is infix) to disambiguate
--   it from the Prism for the corresponding constructor. For
--   example, this code:
--   
--   
--   data Quux = Quux Int | Fred Bool
--   makeClassyPrisms ''Quux
--   
--   
--   will create:
--   
--   
--   class AsQuux s where
--     __Quux :: Prism' s Quux -- Data type prism
--     _Quux :: Prism' s Int   -- Constructor prism
--     _Fred :: Prism' s Bool
--   
--     _Quux = __Quux . _Quux
--     _Fred = __Quux . _Fred
--   
--   instance AsQuux Quux
--   
makeClassyPrisms :: Name -> DecsQ

-- | Generate "simple" optics even when type-changing optics are possible.
--   (e.g. Lens' instead of Lens)
simpleLenses :: 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 "updateable" optics when True. When False,
--   Folds will be generated instead of Traversals and
--   Getters will be generated instead of Lenses. This mode
--   is intended to be used for types with invariants which must be
--   maintained by "smart" constructors.
generateUpdateableOptics :: Lens' LensRules Bool

-- | Generate optics using lazy pattern matches. This can allow fields of
--   an undefined value to be initialized with lenses:
--   
--   
--   data Foo = Foo {_x :: Int, _y :: Bool}
--     deriving Show
--   
--   makeLensesWith (lensRules & generateLazyPatterns .~ True) ''Foo
--   
--   
--   
--   > undefined & x .~ 8 & y .~ True
--   Foo {_x = 8, _y = True}
--   
--   
--   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 $!:
--   
--   
--   strictOptic = ($!) . lazyOptic
--   
generateLazyPatterns :: Lens' LensRules Bool
generateRecordSyntax :: Lens' LensRules Bool

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

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

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

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

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

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

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

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

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

-- | A LensRules used by makeClassy_.
classyRules_ :: LensRules

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

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

-- | Make lenses and traversals for a type, and create a class when the
--   type has no arguments. Works the same as makeClassy 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

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

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

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

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

-- | Similar to makeLensesFor, but takes a declaration quote.
declareLensesFor :: [(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.
--   
--   e.g.
--   
--   
--   declareClassy [d|
--     data Foo = Foo { fooX, fooY :: Int }
--       deriving Show
--     |]
--   
--   
--   will create
--   
--   
--   data Foo = Foo Int Int deriving Show
--   class HasFoo t where
--     foo :: Lens' t Foo
--   instance HasFoo Foo where foo = id
--   fooX, fooY :: HasFoo t => Lens' t Int
--   
declareClassy :: DecsQ -> DecsQ

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

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

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

-- | 
--   declareFields = declareLensesWith defaultFieldRules
--   
declareFields :: DecsQ -> DecsQ

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

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

-- | Field rules for fields in the form  _prefix_fieldname 
underscoreFields :: LensRules

-- | A FieldNamer for underscoreFields.
underscoreNamer :: FieldNamer

-- | Field rules for fields in the form  prefixFieldname or
--   _prefixFieldname  If you want all fields to be lensed, then there
--   is no reason to use an _ before the prefix. If any of the
--   record fields leads with an _ then it is assume a field
--   without an _ should not have a lens created.
--   
--   Note: The prefix 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
--   makeLensesWith abbreviatedFields
camelCaseFields :: LensRules

-- | A FieldNamer for camelCaseFields.
camelCaseNamer :: FieldNamer

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

-- | A FieldNamer for classUnderscoreNoPrefixFields.
classUnderscoreNoPrefixNamer :: FieldNamer

-- | Field rules fields in the form  prefixFieldname or
--   _prefixFieldname  If you want all fields to be lensed, then there
--   is no reason to use an _ before the prefix. If any of the
--   record fields leads with an _ then it is assume a field
--   without an _ should not have a lens created.
--   
--   Note that prefix 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
--   defaultFieldRules had in lens 4.4 and earlier.
abbreviatedFields :: LensRules

-- | A FieldNamer for abbreviatedFields.
abbreviatedNamer :: FieldNamer

-- | Generate overloaded field accessors.
--   
--   e.g
--   
--   
--   data Foo a = Foo { _fooX :: Int, _fooY :: a }
--   newtype Bar = Bar { _barX :: Char }
--   makeFields ''Foo
--   makeFields ''Bar
--   
--   
--   will create
--   
--   
--   _fooXLens :: Lens' (Foo a) Int
--   _fooYLens :: Lens (Foo a) (Foo b) a b
--   class HasX s a | s -> a where
--     x :: Lens' s a
--   instance HasX (Foo a) Int where
--     x = _fooXLens
--   class HasY s a | s -> 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
--   
--   
--   For details, see camelCaseFields.
--   
--   
--   makeFields = makeLensesWith defaultFieldRules
--   
makeFields :: Name -> DecsQ

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

-- | A functor with application, providing operations to
--   
--   
--   
- embed pure expressions (pure), and
--   
- sequence computations and combine their results (<*>
--   and liftA2).
--   
--   
--   A minimal complete definition must include implementations of
--   pure and of either <*> or liftA2. If it
--   defines both, then they must behave the same as their default
--   definitions:
--   
--   
--   (<*>) = liftA2 id
--   
--   
--   
--   liftA2 f x y = f <$> x <*> y
--   
--   
--   Further, any definition must satisfy the following:
--   
--   
--   
- Identity 
pure id <*> v =
--   v

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

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

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

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

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

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

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

--   
- 
m1 <*> m2 = m1 >>= (\x1 -> m2
--   >>= (\x2 -> return (x1 x2)))

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

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

-- | Lift a value.
pure :: Applicative f => a -> f a

-- | Sequential application.
--   
--   A few functors support an implementation of <*> that is
--   more efficient than the default one.
--   
--   
Example
--   
--   Used in combination with (<$>),
--   (<*>) can be used to build a record.
--   
--   
--   >>> data MyState = MyState {arg1 :: Foo, arg2 :: Bar, arg3 :: Baz}
--   
--   
--   
--   >>> produceFoo :: Applicative f => f Foo
--   
--   
--   
--   >>> produceBar :: Applicative f => f Bar
--   
--   >>> produceBaz :: Applicative f => f Baz
--   
--   
--   
--   >>> mkState :: Applicative f => f MyState
--   
--   >>> mkState = MyState <$> produceFoo <*> produceBar <*> produceBaz
--   
(<*>) :: Applicative f => f (a -> b) -> f a -> f b

-- | Lift a binary function to actions.
--   
--   Some functors support an implementation of liftA2 that is more
--   efficient than the default one. In particular, if fmap is an
--   expensive operation, it is likely better to use liftA2 than to
--   fmap over the structure and then use <*>.
--   
--   This became a typeclass method in 4.10.0.0. Prior to that, it was a
--   function defined in terms of <*> and fmap.
--   
--   
Example
--   
--   
--   >>> liftA2 (,) (Just 3) (Just 5)
--   Just (3,5)
--   
liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c

-- | Sequence actions, discarding the value of the first argument.
--   
--   
Examples
--   
--   If used in conjunction with the Applicative instance for Maybe,
--   you can chain Maybe computations, with a possible "early return" in
--   case of Nothing.
--   
--   
--   >>> Just 2 *> Just 3
--   Just 3
--   
--   
--   
--   >>> Nothing *> Just 3
--   Nothing
--   
--   
--   Of course a more interesting use case would be to have effectful
--   computations instead of just returning pure values.
--   
--   
--   >>> import Data.Char
--   
--   >>> import Text.ParserCombinators.ReadP
--   
--   >>> let p = string "my name is " *> munch1 isAlpha <* eof
--   
--   >>> readP_to_S p "my name is Simon"
--   [("Simon","")]
--   
(*>) :: Applicative f => f a -> f b -> f b

-- | Sequence actions, discarding the value of the second argument.
(<*) :: Applicative f => f a -> f b -> f a
infixl 4 <*>
infixl 4 *>
infixl 4 <*

-- | Sequence actions, discarding the value of the first argument.
--   
--   
Examples
--   
--   If used in conjunction with the Applicative instance for Maybe,
--   you can chain Maybe computations, with a possible "early return" in
--   case of Nothing.
--   
--   
--   >>> Just 2 *> Just 3
--   Just 3
--   
--   
--   
--   >>> Nothing *> Just 3
--   Nothing
--   
--   
--   Of course a more interesting use case would be to have effectful
--   computations instead of just returning pure values.
--   
--   
--   >>> import Data.Char
--   
--   >>> import Text.ParserCombinators.ReadP
--   
--   >>> let p = string "my name is " *> munch1 isAlpha <* eof
--   
--   >>> readP_to_S p "my name is Simon"
--   [("Simon","")]
--   
(*>) :: Applicative f => f a -> f b -> f b
infixl 4 *>

-- | Sequence actions, discarding the value of the second argument.
(<*) :: Applicative f => f a -> f b -> f a
infixl 4 <*

-- | An infix synonym for fmap.
--   
--   The name of this operator is an allusion to $. Note the
--   similarities between their types:
--   
--   
--    ($)  ::              (a -> b) ->   a ->   b
--   (<$>) :: Functor f => (a -> b) -> f a -> f b
--   
--   
--   Whereas $ is function application, <$> is function
--   application lifted over a Functor.
--   
--   
Examples
--   
--   Convert from a Maybe Int to a Maybe
--   String using show:
--   
--   
--   >>> show <$> Nothing
--   Nothing
--   
--   >>> show <$> Just 3
--   Just "3"
--   
--   
--   Convert from an Either Int Int to an
--   Either Int String using show:
--   
--   
--   >>> show <$> Left 17
--   Left 17
--   
--   >>> show <$> Right 17
--   Right "17"
--   
--   
--   Double each element of a list:
--   
--   
--   >>> (*2) <$> [1,2,3]
--   [2,4,6]
--   
--   
--   Apply even to the second element of a pair:
--   
--   
--   >>> even <$> (2,2)
--   (2,True)
--   
(<$>) :: Functor f => (a -> b) -> f a -> f b
infixl 4 <$>

-- | Replace all locations in the input with the same value. The default
--   definition is fmap . const, but this may be
--   overridden with a more efficient version.
--   
--   
Examples
--   
--   Perform a computation with Maybe and replace the result with a
--   constant value if it is Just:
--   
--   
--   >>> 'a' <$ Just 2
--   Just 'a'
--   
--   >>> 'a' <$ Nothing
--   Nothing
--   
(<$) :: Functor f => a -> f b -> f a
infixl 4 <$

-- | Lift a function to actions. Equivalent to Functor's fmap but
--   implemented using only Applicative's methods: liftA
--   f a = pure f <*> a
--   
--   As such this function may be used to implement a Functor
--   instance from an Applicative one.
--   
--   
Examples
--   
--   Using the Applicative instance for Lists:
--   
--   
--   >>> liftA (+1) [1, 2]
--   [2,3]
--   
--   
--   Or the Applicative instance for Maybe
--   
--   
--   >>> liftA (+1) (Just 3)
--   Just 4
--   
liftA :: Applicative f => (a -> b) -> f a -> f b

-- | Lift a binary function to actions.
--   
--   Some functors support an implementation of liftA2 that is more
--   efficient than the default one. In particular, if fmap is an
--   expensive operation, it is likely better to use liftA2 than to
--   fmap over the structure and then use <*>.
--   
--   This became a typeclass method in 4.10.0.0. Prior to that, it was a
--   function defined in terms of <*> and fmap.
--   
--   
Example
--   
--   
--   >>> liftA2 (,) (Just 3) (Just 5)
--   Just (3,5)
--   
liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c

-- | Lift a ternary function to actions.
liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d
