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

-- | Align and Zip type-classes from the common Semialign ancestor.
--   
--   The major use of These of this is provided by the
--   align member of Semialign class, representing a
--   generalized notion of "zipping with padding" that combines structures
--   without truncating to the size of the smaller input.
--   
--   It turns out that zip operation fits well the
--   Semialign class, forming lattice-like structure.
@package semialign
@version 1.3.1

-- | Zipping and aligning of indexed functors.
module Data.Semialign.Indexed

-- | Indexed version of Semialign.
class (FunctorWithIndex i f, Semialign f) => SemialignWithIndex i (f :: Type -> Type) | f -> i

-- | Analogous to alignWith, but also provides an index.
ialignWith :: SemialignWithIndex i f => (i -> These a b -> c) -> f a -> f b -> f c

-- | Indexed version of Zip.
class (SemialignWithIndex i f, Zip f) => ZipWithIndex i (f :: Type -> Type) | f -> i

-- | Analogous to zipWith, but also provides an index.
izipWith :: ZipWithIndex i f => (i -> a -> b -> c) -> f a -> f b -> f c

-- | Indexed version of Repeat.
class (ZipWithIndex i f, Repeat f) => RepeatWithIndex i (f :: Type -> Type) | f -> i

-- | Analogous to repeat, but also provides an index.
--   
--   This should be the same as tabulate for representable
--   functors.
irepeat :: RepeatWithIndex i f => (i -> a) -> f a

-- | Zipping and aligning of functors with non-uniform shapes.
module Data.Semialign

-- | Functors supporting an align operation that takes the union of
--   non-uniform shapes.
--   
--   Minimal definition: either align or alignWith.
--   
--   
Laws
--   
--   The laws of align and zip resemble lattice laws. There
--   is a plenty of laws, but they are simply satisfied.
--   
--   And an additional property if f is Foldable, which
--   tries to enforce align-feel: neither values are duplicated nor
--   lost.
--   
--   Note: join f x = f x x
--   
--   Idempotency
--   
--   
--   join align ≡ fmap (join These)
--   
--   
--   Commutativity
--   
--   
--   align x y ≡ swap <$> align y x
--   
--   
--   Associativity
--   
--   
--   align x (align y z) ≡ assoc <$> align (align x y) z
--   
--   
--   With
--   
--   
--   alignWith f a b ≡ f <$> align a b
--   
--   
--   Functoriality
--   
--   
--   align (f <$> x) (g <$> y) ≡ bimap f g <$> align x y
--   
--   
--   Alignedness, if f is Foldable
--   
--   
--   toList x ≡ toListOf (folded . here) (align x y)
--            ≡ mapMaybe justHere (toList (align x y))
--   
class Functor f => Semialign (f :: Type -> Type)

-- | Analogous to zip, combines two structures by taking
--   the union of their shapes and using These to hold the
--   elements.
align :: Semialign f => f a -> f b -> f (These a b)

-- | Analogous to zipWith, combines two structures by
--   taking the union of their shapes and combining the elements with the
--   given function.
alignWith :: Semialign f => (These a b -> c) -> f a -> f b -> f c

-- | A unit of align.
--   
--   
Laws
--   
--   
--   (`align` nil) ≡ fmap This
--   (nil `align`) ≡ fmap That
--   
class Semialign f => Align (f :: Type -> Type)

-- | An empty structure. aligning with nil
--   will produce a structure with the same shape and elements as the other
--   input, modulo This or That.
nil :: Align f => f a

-- | Alignable functors supporting an "inverse" to align: splitting
--   a union shape into its component parts.
--   
--   
Laws
--   
--   
--   uncurry align (unalign xs) ≡ xs
--   unalign (align xs ys) ≡ (xs, ys)
--   
--   
--   
Compatibility note
--   
--   In version 1 unalign was changed to return (f a, f b)
--   pair, instead of (f (Just a), f (Just b)). Old behaviour can
--   be achieved with if ever needed.
--   
--   
--   >>> unzipWith (unalign . Just) [This 'a', That 'b', These 'c' 'd']
--   ([Just 'a',Nothing,Just 'c'],[Nothing,Just 'b',Just 'd'])
--   
class Semialign f => Unalign (f :: Type -> Type)
unalign :: Unalign f => f (These a b) -> (f a, f b)
unalignWith :: Unalign f => (c -> These a b) -> f c -> (f a, f b)

-- | Functors supporting a zip operation that takes the intersection
--   of non-uniform shapes.
--   
--   Minimal definition: either zip or zipWith.
--   
--   Idempotency
--   
--   
--   join zip   ≡ fmap (join (,))
--   
--   
--   Commutativity
--   
--   
--   zip x y ≡ swap <$> zip y x
--   
--   
--   Associativity
--   
--   
--   zip x (zip y z) ≡ assoc <$> zip (zip x y) z
--   
--   
--   Absorption
--   
--   
--   fst    <$> zip xs (align xs ys) ≡ xs
--   toThis <$> align xs (zip xs ys) ≡ This <$> xs
--     where
--       toThis (This a)    = This a
--       toThis (These a _) = This a
--       toThis (That b)    = That b
--   
--   
--   With
--   
--   
--   zipWith f a b ≡ f <$> zip a b
--   
--   
--   Functoriality
--   
--   
--   zip (f <$> x) (g <$> y) ≡ bimap f g <$> zip x y
--   
--   
--   Zippyness
--   
--   
--   fmap fst (zip x x) ≡ x
--   fmap snd (zip x x) ≡ x
--   zip (fmap fst x) (fmap snd x) ≡ x
--   
--   
--   Distributivity
--   
--   
--                      align (zip xs ys) zs ≡ undistrThesePair <$> zip (align xs zs) (align ys zs)
--   distrPairThese <$> zip (align xs ys) zs ≡                      align (zip xs zs) (zip ys zs)
--                      zip (align xs ys) zs ≡ undistrPairThese <$> align (zip xs zs) (zip ys zs)
--   
--   
--   Note, the following doesn't hold:
--   
--   
--   distrThesePair <$> align (zip xs ys) zs ≢ zip (align xs zs) (align ys zs)
--   
--   
--   when xs = [] and ys = zs = [0], then the left hand
--   side is "only" [(That 0, That 0)], but the
--   right hand side is [(That 0, These 0 0)].
class Semialign f => Zip (f :: Type -> Type)

-- | Combines two structures by taking the intersection of their shapes and
--   using pair to hold the elements.
zip :: Zip f => f a -> f b -> f (a, b)

-- | Combines two structures by taking the intersection of their shapes and
--   combining the elements with the given function.
zipWith :: Zip f => (a -> b -> c) -> f a -> f b -> f c

-- | Zippable functors supporting left and right units
--   
--   Unit
--   
--   
--   fst <$> zip xs (repeat y) ≡ xs
--   snd <$> zip (repeat x) ys ≡ ys
--   
class Zip f => Repeat (f :: Type -> Type)

-- | A repeat structure.
repeat :: Repeat f => a -> f a

-- | Right inverse of zip.
--   
--   This class is definable for every Functor. See
--   unzipDefault.
--   
--   
Laws
--   
--   
--   uncurry zip (unzip xs) ≡ xs
--   unzip (zip xs xs) ≡ (xs, xs)
--   
--   
--   Note:
--   
--   
--   unzip (zip xs ys) ≢ (xs, _) or (_, ys)
--   
--   
--   For sequence-like types this holds, but for Map-like it doesn't.
class Zip f => Unzip (f :: Type -> Type)
unzipWith :: Unzip f => (c -> (a, b)) -> f c -> (f a, f b)
unzip :: Unzip f => f (a, b) -> (f a, f b)
unzipDefault :: Functor f => f (a, b) -> (f a, f b)

-- | Align two structures and combine with <>.
salign :: (Semialign f, Semigroup a) => f a -> f a -> f a

-- | Align two structures as in zip, but filling in blanks with
--   Nothing.
padZip :: Semialign f => f a -> f b -> f (Maybe a, Maybe b)

-- | Align two structures as in zipWith, but filling in blanks with
--   Nothing.
padZipWith :: Semialign f => (Maybe a -> Maybe b -> c) -> f a -> f b -> f c

-- | Left-padded zip.
lpadZip :: [a] -> [b] -> [(Maybe a, b)]

-- | Left-padded zipWith.
lpadZipWith :: (Maybe a -> b -> c) -> [a] -> [b] -> [c]

-- | Right-padded zip.
rpadZip :: [a] -> [b] -> [(a, Maybe b)]

-- | Right-padded zipWith.
rpadZipWith :: (a -> Maybe b -> c) -> [a] -> [b] -> [c]
alignVectorWith :: (Vector v a, Vector v b, Vector v c) => (These a b -> c) -> v a -> v b -> v c

-- | These-based aligning and unaligning of functors with
--   non-uniform shapes.
--   
--   For a traversals traversal of (bi)foldable (bi)functors through said
--   functors see Data.Crosswalk.
module Data.Align

-- | Functors supporting an align operation that takes the union of
--   non-uniform shapes.
--   
--   Minimal definition: either align or alignWith.
--   
--   
Laws
--   
--   The laws of align and zip resemble lattice laws. There
--   is a plenty of laws, but they are simply satisfied.
--   
--   And an additional property if f is Foldable, which
--   tries to enforce align-feel: neither values are duplicated nor
--   lost.
--   
--   Note: join f x = f x x
--   
--   Idempotency
--   
--   
--   join align ≡ fmap (join These)
--   
--   
--   Commutativity
--   
--   
--   align x y ≡ swap <$> align y x
--   
--   
--   Associativity
--   
--   
--   align x (align y z) ≡ assoc <$> align (align x y) z
--   
--   
--   With
--   
--   
--   alignWith f a b ≡ f <$> align a b
--   
--   
--   Functoriality
--   
--   
--   align (f <$> x) (g <$> y) ≡ bimap f g <$> align x y
--   
--   
--   Alignedness, if f is Foldable
--   
--   
--   toList x ≡ toListOf (folded . here) (align x y)
--            ≡ mapMaybe justHere (toList (align x y))
--   
class Functor f => Semialign (f :: Type -> Type)

-- | Analogous to zip, combines two structures by taking
--   the union of their shapes and using These to hold the
--   elements.
align :: Semialign f => f a -> f b -> f (These a b)

-- | Analogous to zipWith, combines two structures by
--   taking the union of their shapes and combining the elements with the
--   given function.
alignWith :: Semialign f => (These a b -> c) -> f a -> f b -> f c

-- | A unit of align.
--   
--   
Laws
--   
--   
--   (`align` nil) ≡ fmap This
--   (nil `align`) ≡ fmap That
--   
class Semialign f => Align (f :: Type -> Type)

-- | An empty structure. aligning with nil
--   will produce a structure with the same shape and elements as the other
--   input, modulo This or That.
nil :: Align f => f a

-- | Alignable functors supporting an "inverse" to align: splitting
--   a union shape into its component parts.
--   
--   
Laws
--   
--   
--   uncurry align (unalign xs) ≡ xs
--   unalign (align xs ys) ≡ (xs, ys)
--   
--   
--   
Compatibility note
--   
--   In version 1 unalign was changed to return (f a, f b)
--   pair, instead of (f (Just a), f (Just b)). Old behaviour can
--   be achieved with if ever needed.
--   
--   
--   >>> unzipWith (unalign . Just) [This 'a', That 'b', These 'c' 'd']
--   ([Just 'a',Nothing,Just 'c'],[Nothing,Just 'b',Just 'd'])
--   
class Semialign f => Unalign (f :: Type -> Type)
unalign :: Unalign f => f (These a b) -> (f a, f b)
unalignWith :: Unalign f => (c -> These a b) -> f c -> (f a, f b)

-- | Align two structures and combine with <>.
salign :: (Semialign f, Semigroup a) => f a -> f a -> f a

-- | Align two structures as in zip, but filling in blanks with
--   Nothing.
padZip :: Semialign f => f a -> f b -> f (Maybe a, Maybe b)

-- | Align two structures as in zipWith, but filling in blanks with
--   Nothing.
padZipWith :: Semialign f => (Maybe a -> Maybe b -> c) -> f a -> f b -> f c

-- | Left-padded zip.
lpadZip :: [a] -> [b] -> [(Maybe a, b)]

-- | Left-padded zipWith.
lpadZipWith :: (Maybe a -> b -> c) -> [a] -> [b] -> [c]

-- | Right-padded zip.
rpadZip :: [a] -> [b] -> [(a, Maybe b)]

-- | Right-padded zipWith.
rpadZipWith :: (a -> Maybe b -> c) -> [a] -> [b] -> [c]
alignVectorWith :: (Vector v a, Vector v b, Vector v c) => (These a b -> c) -> v a -> v b -> v c

module Data.Crosswalk

-- | Foldable functors supporting traversal through an alignable functor.
--   
--   Minimal definition: crosswalk or sequenceL.
--   
--   Laws:
--   
--   
--   crosswalk (const nil) = const nil
--   crosswalk f = sequenceL . fmap f
--   
class (Functor t, Foldable t) => Crosswalk (t :: Type -> Type)
crosswalk :: (Crosswalk t, Align f) => (a -> f b) -> t a -> f (t b)
sequenceL :: (Crosswalk t, Align f) => t (f a) -> f (t a)

-- | Bifoldable bifunctors supporting traversal through an alignable
--   functor.
--   
--   Minimal definition: bicrosswalk or bisequenceL.
--   
--   Laws:
--   
--   
--   bicrosswalk (const empty) (const empty) = const empty
--   bicrosswalk f g = bisequenceL . bimap f g
--   
class (Bifunctor t, Bifoldable t) => Bicrosswalk (t :: Type -> Type -> Type)
bicrosswalk :: (Bicrosswalk t, Align f) => (a -> f c) -> (b -> f d) -> t a b -> f (t c d)
bisequenceL :: (Bicrosswalk t, Align f) => t (f a) (f b) -> f (t a b)
instance Data.Crosswalk.Bicrosswalk GHC.Internal.Data.Either.Either
instance Data.Crosswalk.Bicrosswalk Data.These.These
instance (Data.Crosswalk.Crosswalk f, Data.Crosswalk.Crosswalk g) => Data.Crosswalk.Crosswalk (Data.Functor.Compose.Compose f g)
instance Data.Crosswalk.Crosswalk GHC.Internal.Data.Functor.Identity.Identity
instance Data.Crosswalk.Crosswalk []
instance Data.Crosswalk.Crosswalk GHC.Internal.Maybe.Maybe
instance Data.Crosswalk.Crosswalk Data.Sequence.Internal.Seq
instance Data.Crosswalk.Crosswalk (Data.These.These a)
instance Data.Crosswalk.Crosswalk ((,) a)
instance Data.Crosswalk.Crosswalk Data.Vector.Vector

-- | Zipping and unzipping of functors with non-uniform shapes.
module Data.Zip

-- | Functors supporting an align operation that takes the union of
--   non-uniform shapes.
--   
--   Minimal definition: either align or alignWith.
--   
--   
Laws
--   
--   The laws of align and zip resemble lattice laws. There
--   is a plenty of laws, but they are simply satisfied.
--   
--   And an additional property if f is Foldable, which
--   tries to enforce align-feel: neither values are duplicated nor
--   lost.
--   
--   Note: join f x = f x x
--   
--   Idempotency
--   
--   
--   join align ≡ fmap (join These)
--   
--   
--   Commutativity
--   
--   
--   align x y ≡ swap <$> align y x
--   
--   
--   Associativity
--   
--   
--   align x (align y z) ≡ assoc <$> align (align x y) z
--   
--   
--   With
--   
--   
--   alignWith f a b ≡ f <$> align a b
--   
--   
--   Functoriality
--   
--   
--   align (f <$> x) (g <$> y) ≡ bimap f g <$> align x y
--   
--   
--   Alignedness, if f is Foldable
--   
--   
--   toList x ≡ toListOf (folded . here) (align x y)
--            ≡ mapMaybe justHere (toList (align x y))
--   
class Functor f => Semialign (f :: Type -> Type)

-- | Analogous to zip, combines two structures by taking
--   the union of their shapes and using These to hold the
--   elements.
align :: Semialign f => f a -> f b -> f (These a b)

-- | Analogous to zipWith, combines two structures by
--   taking the union of their shapes and combining the elements with the
--   given function.
alignWith :: Semialign f => (These a b -> c) -> f a -> f b -> f c

-- | Functors supporting a zip operation that takes the intersection
--   of non-uniform shapes.
--   
--   Minimal definition: either zip or zipWith.
--   
--   Idempotency
--   
--   
--   join zip   ≡ fmap (join (,))
--   
--   
--   Commutativity
--   
--   
--   zip x y ≡ swap <$> zip y x
--   
--   
--   Associativity
--   
--   
--   zip x (zip y z) ≡ assoc <$> zip (zip x y) z
--   
--   
--   Absorption
--   
--   
--   fst    <$> zip xs (align xs ys) ≡ xs
--   toThis <$> align xs (zip xs ys) ≡ This <$> xs
--     where
--       toThis (This a)    = This a
--       toThis (These a _) = This a
--       toThis (That b)    = That b
--   
--   
--   With
--   
--   
--   zipWith f a b ≡ f <$> zip a b
--   
--   
--   Functoriality
--   
--   
--   zip (f <$> x) (g <$> y) ≡ bimap f g <$> zip x y
--   
--   
--   Zippyness
--   
--   
--   fmap fst (zip x x) ≡ x
--   fmap snd (zip x x) ≡ x
--   zip (fmap fst x) (fmap snd x) ≡ x
--   
--   
--   Distributivity
--   
--   
--                      align (zip xs ys) zs ≡ undistrThesePair <$> zip (align xs zs) (align ys zs)
--   distrPairThese <$> zip (align xs ys) zs ≡                      align (zip xs zs) (zip ys zs)
--                      zip (align xs ys) zs ≡ undistrPairThese <$> align (zip xs zs) (zip ys zs)
--   
--   
--   Note, the following doesn't hold:
--   
--   
--   distrThesePair <$> align (zip xs ys) zs ≢ zip (align xs zs) (align ys zs)
--   
--   
--   when xs = [] and ys = zs = [0], then the left hand
--   side is "only" [(That 0, That 0)], but the
--   right hand side is [(That 0, These 0 0)].
class Semialign f => Zip (f :: Type -> Type)

-- | Combines two structures by taking the intersection of their shapes and
--   using pair to hold the elements.
zip :: Zip f => f a -> f b -> f (a, b)

-- | Combines two structures by taking the intersection of their shapes and
--   combining the elements with the given function.
zipWith :: Zip f => (a -> b -> c) -> f a -> f b -> f c

-- | Zippable functors supporting left and right units
--   
--   Unit
--   
--   
--   fst <$> zip xs (repeat y) ≡ xs
--   snd <$> zip (repeat x) ys ≡ ys
--   
class Zip f => Repeat (f :: Type -> Type)

-- | A repeat structure.
repeat :: Repeat f => a -> f a

-- | Right inverse of zip.
--   
--   This class is definable for every Functor. See
--   unzipDefault.
--   
--   
Laws
--   
--   
--   uncurry zip (unzip xs) ≡ xs
--   unzip (zip xs xs) ≡ (xs, xs)
--   
--   
--   Note:
--   
--   
--   unzip (zip xs ys) ≢ (xs, _) or (_, ys)
--   
--   
--   For sequence-like types this holds, but for Map-like it doesn't.
class Zip f => Unzip (f :: Type -> Type)
unzipWith :: Unzip f => (c -> (a, b)) -> f c -> (f a, f b)
unzip :: Unzip f => f (a, b) -> (f a, f b)
unzipDefault :: Functor f => f (a, b) -> (f a, f b)
newtype Zippy (f :: Type -> Type) a
Zippy :: f a -> Zippy (f :: Type -> Type) a
[getZippy] :: Zippy (f :: Type -> Type) a -> f a
instance Data.Semialign.Internal.Repeat f => GHC.Internal.Base.Applicative (Data.Zip.Zippy f)
instance Data.Semialign.Internal.Zip f => Data.Functor.Bind.Class.Apply (Data.Zip.Zippy f)
instance GHC.Classes.Eq (f a) => GHC.Classes.Eq (Data.Zip.Zippy f a)
instance GHC.Internal.Base.Functor f => GHC.Internal.Base.Functor (Data.Zip.Zippy f)
instance (Data.Semialign.Internal.Repeat f, GHC.Internal.Base.Monoid a) => GHC.Internal.Base.Monoid (Data.Zip.Zippy f a)
instance GHC.Classes.Ord (f a) => GHC.Classes.Ord (Data.Zip.Zippy f a)
instance GHC.Internal.Read.Read (f a) => GHC.Internal.Read.Read (Data.Zip.Zippy f a)
instance (Data.Semialign.Internal.Zip f, GHC.Internal.Base.Semigroup a) => GHC.Internal.Base.Semigroup (Data.Zip.Zippy f a)
instance GHC.Internal.Show.Show (f a) => GHC.Internal.Show.Show (Data.Zip.Zippy f a)
