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

-- | Type classes for mapping, folding, and traversing monomorphic containers
--   
--   Please see the README at
--   https://www.stackage.org/package/mono-traversable
@package mono-traversable
@version 1.0.21.0

-- | Type classes mirroring standard typeclasses, but working with
--   monomorphic containers.
--   
--   The motivation is that some commonly used data types (i.e.,
--   ByteString and Text) do not allow for instances of
--   typeclasses like Functor and Foldable, since they are
--   monomorphic structures. This module allows both monomorphic and
--   polymorphic data types to be instances of the same typeclasses.
--   
--   All of the laws for the polymorphic typeclasses apply to their
--   monomorphic cousins. Thus, even though a MonoFunctor instance
--   for Set could theoretically be defined, it is omitted since it
--   could violate the functor law of omap f . omap g =
--   omap (f . g).
--   
--   Note that all typeclasses have been prefixed with Mono, and
--   functions have been prefixed with o. The mnemonic for
--   o is "only one", or alternatively "it's mono, but m is
--   overused in Haskell, so we'll use the second letter instead." (Agreed,
--   it's not a great mangling scheme, input is welcome!)
module Data.MonoTraversable

-- | Type family for getting the type of the elements of a monomorphic
--   container.
type family Element mono

-- | Monomorphic containers that can be mapped over.
class MonoFunctor mono

-- | Map over a monomorphic container
omap :: MonoFunctor mono => (Element mono -> Element mono) -> mono -> mono
($dmomap) :: forall (f :: Type -> Type) a. (MonoFunctor mono, Functor f, Element (f a) ~ a, f a ~ mono) => (Element mono -> Element mono) -> mono -> mono

-- | replaceElem old new replaces all old elements
--   with new.
replaceElem :: (MonoFunctor mono, Eq (Element mono)) => Element mono -> Element mono -> mono -> mono
replaceElemStrictText :: Char -> Char -> Text -> Text
replaceElemLazyText :: Char -> Char -> Text -> Text

-- | Monomorphic containers that can be folded.
class MonoFoldable mono

-- | Map each element of a monomorphic container to a Monoid and
--   combine the results.
ofoldMap :: (MonoFoldable mono, Monoid m) => (Element mono -> m) -> mono -> m
($dmofoldMap) :: forall (t :: Type -> Type) a m. (MonoFoldable mono, t a ~ mono, a ~ Element (t a), Foldable t, Monoid m) => (Element mono -> m) -> mono -> m

-- | Right-associative fold of a monomorphic container.
ofoldr :: MonoFoldable mono => (Element mono -> b -> b) -> b -> mono -> b
($dmofoldr) :: forall (t :: Type -> Type) a b. (MonoFoldable mono, t a ~ mono, a ~ Element (t a), Foldable t) => (Element mono -> b -> b) -> b -> mono -> b

-- | Strict left-associative fold of a monomorphic container.
ofoldl' :: MonoFoldable mono => (a -> Element mono -> a) -> a -> mono -> a
($dmofoldl') :: forall (t :: Type -> Type) b a. (MonoFoldable mono, t b ~ mono, b ~ Element (t b), Foldable t) => (a -> Element mono -> a) -> a -> mono -> a

-- | Convert a monomorphic container to a list.
otoList :: MonoFoldable mono => mono -> [Element mono]

-- | Are all of the elements in a monomorphic container converted to
--   booleans True?
oall :: MonoFoldable mono => (Element mono -> Bool) -> mono -> Bool

-- | Are any of the elements in a monomorphic container converted to
--   booleans True?
oany :: MonoFoldable mono => (Element mono -> Bool) -> mono -> Bool

-- | Is the monomorphic container empty?
onull :: MonoFoldable mono => mono -> Bool

-- | Length of a monomorphic container, returns a Int.
olength :: MonoFoldable mono => mono -> Int

-- | Length of a monomorphic container, returns a Int64.
olength64 :: MonoFoldable mono => mono -> Int64

-- | Compare the length of a monomorphic container and a given number.
ocompareLength :: (MonoFoldable mono, Integral i) => mono -> i -> Ordering

-- | Map each element of a monomorphic container to an action, evaluate
--   these actions from left to right, and ignore the results.
otraverse_ :: (MonoFoldable mono, Applicative f) => (Element mono -> f b) -> mono -> f ()

-- | ofor_ is otraverse_ with its arguments flipped.
ofor_ :: (MonoFoldable mono, Applicative f) => mono -> (Element mono -> f b) -> f ()

-- | Map each element of a monomorphic container to a monadic action,
--   evaluate these actions from left to right, and ignore the results.
omapM_ :: (MonoFoldable mono, Applicative m) => (Element mono -> m ()) -> mono -> m ()

-- | oforM_ is omapM_ with its arguments flipped.
oforM_ :: (MonoFoldable mono, Applicative m) => mono -> (Element mono -> m ()) -> m ()

-- | Monadic fold over the elements of a monomorphic container, associating
--   to the left.
ofoldlM :: (MonoFoldable mono, Monad m) => (a -> Element mono -> m a) -> a -> mono -> m a

-- | Map each element of a monomorphic container to a semigroup, and
--   combine the results.
--   
--   Note: this is a partial function. On an empty MonoFoldable, it
--   will throw an exception.
--   
--   See ofoldMap1 from Data.NonNull for a total version
--   of this function.
ofoldMap1Ex :: (MonoFoldable mono, Semigroup m) => (Element mono -> m) -> mono -> m

-- | Right-associative fold of a monomorphic container with no base
--   element.
--   
--   Note: this is a partial function. On an empty MonoFoldable, it
--   will throw an exception.
--   
--   See ofoldr1 from Data.NonNull for a total version of
--   this function.
ofoldr1Ex :: MonoFoldable mono => (Element mono -> Element mono -> Element mono) -> mono -> Element mono
($dmofoldr1Ex) :: forall (t :: Type -> Type) a. (MonoFoldable mono, t a ~ mono, a ~ Element (t a), Foldable t) => (Element mono -> Element mono -> Element mono) -> mono -> Element mono

-- | Strict left-associative fold of a monomorphic container with no base
--   element.
--   
--   Note: this is a partial function. On an empty MonoFoldable, it
--   will throw an exception.
--   
--   See ofoldl1' from Data.NonNull for a total version of
--   this function.
ofoldl1Ex' :: MonoFoldable mono => (Element mono -> Element mono -> Element mono) -> mono -> Element mono
($dmofoldl1Ex') :: forall (t :: Type -> Type) a. (MonoFoldable mono, t a ~ mono, a ~ Element (t a), Foldable t) => (Element mono -> Element mono -> Element mono) -> mono -> Element mono

-- | Get the first element of a monomorphic container.
--   
--   Note: this is a partial function. On an empty MonoFoldable, it
--   will throw an exception.
--   
--   See head from Data.NonNull for a total version of
--   this function.
headEx :: MonoFoldable mono => mono -> Element mono

-- | Get the last element of a monomorphic container.
--   
--   Note: this is a partial function. On an empty MonoFoldable, it
--   will throw an exception.
--   
--   See last from Data.NonNull for a total version of
--   this function.
lastEx :: MonoFoldable mono => mono -> Element mono

-- | Equivalent to headEx.
unsafeHead :: MonoFoldable mono => mono -> Element mono

-- | Equivalent to lastEx.
unsafeLast :: MonoFoldable mono => mono -> Element mono

-- | Get the maximum element of a monomorphic container, using a supplied
--   element ordering function.
--   
--   Note: this is a partial function. On an empty MonoFoldable, it
--   will throw an exception.
--   
--   See maximumBy from Data.NonNull for a total version
--   of this function.
maximumByEx :: MonoFoldable mono => (Element mono -> Element mono -> Ordering) -> mono -> Element mono

-- | Get the minimum element of a monomorphic container, using a supplied
--   element ordering function.
--   
--   Note: this is a partial function. On an empty MonoFoldable, it
--   will throw an exception.
--   
--   See minimumBy from Data.NonNull for a total version
--   of this function.
minimumByEx :: MonoFoldable mono => (Element mono -> Element mono -> Ordering) -> mono -> Element mono

-- | Checks if the monomorphic container includes the supplied element.
oelem :: MonoFoldable mono => Element mono -> mono -> Bool

-- | Checks if the monomorphic container does not include the supplied
--   element.
onotElem :: MonoFoldable mono => Element mono -> mono -> Bool

-- | Safe version of headEx.
--   
--   Returns Nothing instead of throwing an exception when
--   encountering an empty monomorphic container.
headMay :: MonoFoldable mono => mono -> Maybe (Element mono)

-- | Safe version of lastEx.
--   
--   Returns Nothing instead of throwing an exception when
--   encountering an empty monomorphic container.
lastMay :: MonoFoldable mono => mono -> Maybe (Element mono)

-- | osum computes the sum of the numbers of a monomorphic
--   container.
osum :: (MonoFoldable mono, Num (Element mono)) => mono -> Element mono

-- | oproduct computes the product of the numbers of a monomorphic
--   container.
oproduct :: (MonoFoldable mono, Num (Element mono)) => mono -> Element mono

-- | Are all of the elements True?
oand :: (Element mono ~ Bool, MonoFoldable mono) => mono -> Bool

-- | Are any of the elements True?
oor :: (Element mono ~ Bool, MonoFoldable mono) => mono -> Bool

-- | Synonym for ofoldMap
oconcatMap :: (MonoFoldable mono, Monoid m) => (Element mono -> m) -> mono -> m

-- | Monoidally combine all values in the container
ofold :: (MonoFoldable mono, Monoid (Element mono)) => mono -> Element mono

-- | Synonym for ofold
oconcat :: (MonoFoldable mono, Monoid (Element mono)) => mono -> Element mono

-- | Synonym for ofoldlM
ofoldM :: (MonoFoldable mono, Monad m) => (a -> Element mono -> m a) -> a -> mono -> m a

-- | Perform all actions in the given container
osequence_ :: (Applicative m, MonoFoldable mono, Element mono ~ m ()) => mono -> m ()

-- | Get the minimum element of a monomorphic container.
--   
--   Note: this is a partial function. On an empty MonoFoldable, it
--   will throw an exception.
--   
--   See maximum from Data.NonNull for a total version of
--   this function.
maximumEx :: (MonoFoldable mono, Ord (Element mono)) => mono -> Element mono

-- | Get the maximum element of a monomorphic container.
--   
--   Note: this is a partial function. On an empty MonoFoldable, it
--   will throw an exception.
--   
--   See minimum from Data.NonNull for a total version of
--   this function.
minimumEx :: (MonoFoldable mono, Ord (Element mono)) => mono -> Element mono

-- | Safe version of maximumEx.
--   
--   Returns Nothing instead of throwing an exception when
--   encountering an empty monomorphic container.
maximumMay :: (MonoFoldable mono, Ord (Element mono)) => mono -> Maybe (Element mono)

-- | Safe version of maximumByEx.
--   
--   Returns Nothing instead of throwing an exception when
--   encountering an empty monomorphic container.
maximumByMay :: MonoFoldable mono => (Element mono -> Element mono -> Ordering) -> mono -> Maybe (Element mono)

-- | Safe version of minimumEx.
--   
--   Returns Nothing instead of throwing an exception when
--   encountering an empty monomorphic container.
minimumMay :: (MonoFoldable mono, Ord (Element mono)) => mono -> Maybe (Element mono)

-- | Safe version of minimumByEx.
--   
--   Returns Nothing instead of throwing an exception when
--   encountering an empty monomorphic container.
minimumByMay :: MonoFoldable mono => (Element mono -> Element mono -> Ordering) -> mono -> Maybe (Element mono)

-- | Monomorphic containers that can be traversed from left to right.
--   
--   NOTE: Due to limitations with the role system, GHC is yet unable to
--   provide newtype-derivation of MonoTraversable. See
--   https://stackoverflow.com/questions/49776924/newtype-deriving-issequence.
class (MonoFunctor mono, MonoFoldable mono) => MonoTraversable mono

-- | Map each element of a monomorphic container to an action, evaluate
--   these actions from left to right, and collect the results.
otraverse :: (MonoTraversable mono, Applicative f) => (Element mono -> f (Element mono)) -> mono -> f mono
($dmotraverse) :: forall (t :: Type -> Type) a f. (MonoTraversable mono, Traversable t, mono ~ t a, a ~ Element mono, Applicative f) => (Element mono -> f (Element mono)) -> mono -> f mono

-- | Map each element of a monomorphic container to a monadic action,
--   evaluate these actions from left to right, and collect the results.
omapM :: (MonoTraversable mono, Applicative m) => (Element mono -> m (Element mono)) -> mono -> m mono

-- | ofor is otraverse with its arguments flipped.
ofor :: (MonoTraversable mono, Applicative f) => mono -> (Element mono -> f (Element mono)) -> f mono

-- | oforM is omapM with its arguments flipped.
oforM :: (MonoTraversable mono, Applicative f) => mono -> (Element mono -> f (Element mono)) -> f mono

-- | A strict left fold, together with an unwrap function.
--   
--   This is convenient when the accumulator value is not the same as the
--   final expected type. It is provided mainly for integration with the
--   foldl package, to be used in conjunction with
--   purely.
ofoldlUnwrap :: MonoFoldable mono => (x -> Element mono -> x) -> x -> (x -> b) -> mono -> b

-- | A monadic strict left fold, together with an unwrap function.
--   
--   Similar to foldlUnwrap, but allows monadic actions. To be
--   used with impurely from foldl.
ofoldMUnwrap :: (Monad m, MonoFoldable mono) => (x -> Element mono -> m x) -> m x -> (x -> m b) -> mono -> m b

-- | Typeclass for monomorphic containers that an element can be lifted
--   into.
--   
--   For any MonoFunctor, the following law holds:
--   
--   
--   omap f . opoint = opoint . f
--   
class MonoPointed mono

-- | Lift an element into a monomorphic container.
--   
--   opoint is the same as pure for an Applicative
opoint :: MonoPointed mono => Element mono -> mono
($dmopoint) :: forall (f :: Type -> Type) a. (MonoPointed mono, Applicative f, f a ~ mono, Element (f a) ~ a) => Element mono -> mono

-- | Typeclass for monomorphic containers where it is always okay to
--   "extract" a value from with oextract, and where you can
--   extrapolate any "extracting" function to be a function on the whole
--   part with oextend.
--   
--   oextend and oextract should work together following the
--   laws:
--   
--   
--   oextend oextract      = id
--   oextract . oextend f  = f
--   oextend f . oextend g = oextend (f . oextend g)
--   
--   
--   As an intuition, oextend f uses f to "build
--   up" a new mono with pieces from the old one received by
--   f.
class MonoFunctor mono => MonoComonad mono

-- | Extract an element from mono. Can be thought of as a dual
--   concept to opoint.
oextract :: MonoComonad mono => mono -> Element mono

-- | Extend a mono -> Element mono function to be
--   a mono -> mono; that is, builds a new mono from
--   the old one by using pieces glimpsed from the given function.
oextend :: MonoComonad mono => (mono -> Element mono) -> mono -> mono

-- | Containers which, when two values are combined, the combined length is
--   no less than the larger of the two inputs. In code:
--   
--   
--   olength (x <> y) >= max (olength x) (olength y)
--   
--   
--   This class has no methods, and is simply used to assert that this law
--   holds, in order to provide guarantees of correctness (see, for
--   instance, Data.NonNull).
--   
--   This should have a Semigroup superclass constraint, however,
--   due to Semigroup only recently moving to base, some packages
--   do not provide instances.
class MonoFoldable mono => GrowingAppend mono

-- | intercalate seq seqs inserts seq in between
--   seqs and concatenates the result.
ointercalate :: (MonoFoldable mono, Monoid (Element mono)) => Element mono -> mono -> Element mono

-- | Provides a MonoFoldable, MonoFunctor or
--   MonoPointed for an arbitrary Foldable, Functor or
--   Applicative.
--   
--   Useful for, e.g., passing a Foldable type you don't own into a
--   function that expects a MonoFoldable.
--   
--   
--   // package A
--   data MyList a = MyList [a] deriving Foldable
--   
--   // package B
--   process :: MonoFoldable mono => mono -> IO ()
--   
--   // package C
--   process (WrappedPoly (MyList []))
--   
newtype WrappedPoly (f :: Type -> Type) a
WrappedPoly :: f a -> WrappedPoly (f :: Type -> Type) a
[unwrapPoly] :: WrappedPoly (f :: Type -> Type) a -> f a

-- | Provides a Foldable for an arbitrary MonoFoldable.
data WrappedMono mono a
[WrappedMono] :: forall mono a. Element mono ~ a => mono -> WrappedMono mono a

-- | Unwraps a WrappedMono.
unwrapMono :: WrappedMono mono a -> mono
instance GHC.Internal.Base.Applicative f => GHC.Internal.Base.Applicative (Data.MonoTraversable.WrappedPoly f)
instance Data.MonoTraversable.MonoFoldable mono => GHC.Internal.Data.Foldable.Foldable (Data.MonoTraversable.WrappedMono mono)
instance GHC.Internal.Data.Foldable.Foldable f => GHC.Internal.Data.Foldable.Foldable (Data.MonoTraversable.WrappedPoly f)
instance GHC.Internal.Base.Functor f => GHC.Internal.Base.Functor (Data.MonoTraversable.WrappedPoly f)
instance Data.MonoTraversable.GrowingAppend Data.ByteString.Lazy.Internal.ByteString
instance Data.MonoTraversable.GrowingAppend Data.ByteString.Internal.Type.ByteString
instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k) => Data.MonoTraversable.GrowingAppend (Data.HashMap.Internal.HashMap k v)
instance (GHC.Classes.Eq v, Data.Hashable.Class.Hashable v) => Data.MonoTraversable.GrowingAppend (Data.HashSet.Internal.HashSet v)
instance Data.MonoTraversable.GrowingAppend (Data.IntMap.Internal.IntMap v)
instance Data.MonoTraversable.GrowingAppend Data.IntSet.Internal.IntSet
instance Data.MonoTraversable.GrowingAppend [a]
instance GHC.Classes.Ord k => Data.MonoTraversable.GrowingAppend (Data.Map.Internal.Map k v)
instance Data.MonoTraversable.GrowingAppend (GHC.Internal.Base.NonEmpty a)
instance Data.MonoTraversable.GrowingAppend (Data.Sequence.Internal.Seq a)
instance GHC.Classes.Ord v => Data.MonoTraversable.GrowingAppend (Data.Set.Internal.Set v)
instance Data.MonoTraversable.GrowingAppend Data.Text.Internal.Lazy.Text
instance Data.MonoTraversable.GrowingAppend Data.Text.Internal.Text
instance Data.MonoTraversable.GrowingAppend (Data.Vector.Strict.Vector a)
instance GHC.Internal.Foreign.Storable.Storable a => Data.MonoTraversable.GrowingAppend (Data.Vector.Storable.Vector a)
instance Data.Vector.Unboxed.Base.Unbox a => Data.MonoTraversable.GrowingAppend (Data.Vector.Unboxed.Base.Vector a)
instance Data.MonoTraversable.GrowingAppend (Data.Vector.Vector a)
instance GHC.Internal.Base.Monad f => GHC.Internal.Base.Monad (Data.MonoTraversable.WrappedPoly f)
instance Data.MonoTraversable.MonoComonad (Data.Sequence.Internal.ViewL a)
instance Data.MonoTraversable.MonoComonad (Data.Sequence.Internal.ViewR a)
instance (GHC.Internal.Data.Foldable.Foldable f, GHC.Internal.Data.Foldable.Foldable g) => Data.MonoTraversable.MonoFoldable ((GHC.Internal.Generics.:*:) f g a)
instance (GHC.Internal.Data.Foldable.Foldable f, GHC.Internal.Data.Foldable.Foldable g) => Data.MonoTraversable.MonoFoldable ((GHC.Internal.Generics.:+:) f g a)
instance (GHC.Internal.Data.Foldable.Foldable f, GHC.Internal.Data.Foldable.Foldable g) => Data.MonoTraversable.MonoFoldable ((GHC.Internal.Generics.:.:) f g a)
instance Data.MonoTraversable.MonoFoldable Data.ByteString.Lazy.Internal.ByteString
instance Data.MonoTraversable.MonoFoldable Data.ByteString.Internal.Type.ByteString
instance (GHC.Internal.Data.Foldable.Foldable f, GHC.Internal.Data.Foldable.Foldable g) => Data.MonoTraversable.MonoFoldable (Data.Functor.Compose.Compose f g a)
instance Data.MonoTraversable.MonoFoldable (GHC.Internal.Data.Functor.Const.Const m a)
instance Data.MonoTraversable.MonoFoldable (GHC.Internal.Data.Either.Either a b)
instance Data.MonoTraversable.MonoFoldable (Data.HashMap.Internal.HashMap k v)
instance Data.MonoTraversable.MonoFoldable (Data.HashSet.Internal.HashSet e)
instance Data.MonoTraversable.MonoFoldable (GHC.Internal.Data.Functor.Identity.Identity a)
instance GHC.Internal.Data.Foldable.Foldable f => Data.MonoTraversable.MonoFoldable (Control.Monad.Trans.Identity.IdentityT f a)
instance Data.MonoTraversable.MonoFoldable (Data.IntMap.Internal.IntMap a)
instance Data.MonoTraversable.MonoFoldable Data.IntSet.Internal.IntSet
instance Data.MonoTraversable.MonoFoldable (GHC.Internal.Generics.K1 i c a)
instance Data.MonoTraversable.MonoFoldable [a]
instance GHC.Internal.Data.Foldable.Foldable f => Data.MonoTraversable.MonoFoldable (GHC.Internal.Generics.M1 i c f a)
instance Data.MonoTraversable.MonoFoldable (Data.Map.Internal.Map k v)
instance Data.MonoTraversable.MonoFoldable (GHC.Internal.Maybe.Maybe a)
instance GHC.Internal.Data.Foldable.Foldable f => Data.MonoTraversable.MonoFoldable (Control.Monad.Trans.Maybe.MaybeT f a)
instance Data.MonoTraversable.MonoFoldable (GHC.Internal.Base.NonEmpty a)
instance Data.MonoTraversable.MonoFoldable (GHC.Internal.Generics.Par1 a)
instance (GHC.Internal.Data.Foldable.Foldable f, GHC.Internal.Data.Foldable.Foldable g) => Data.MonoTraversable.MonoFoldable (Data.Functor.Product.Product f g a)
instance Data.MonoTraversable.MonoFoldable (GHC.Internal.Data.Proxy.Proxy a)
instance GHC.Internal.Data.Foldable.Foldable f => Data.MonoTraversable.MonoFoldable (GHC.Internal.Generics.Rec1 f a)
instance Data.MonoTraversable.MonoFoldable (f a) => Data.MonoTraversable.MonoFoldable (Data.Functor.Reverse.Reverse f a)
instance Data.MonoTraversable.MonoFoldable (Data.Sequence.Internal.Seq a)
instance GHC.Classes.Ord e => Data.MonoTraversable.MonoFoldable (Data.Set.Internal.Set e)
instance Data.MonoTraversable.MonoFoldable Data.Text.Internal.Lazy.Text
instance Data.MonoTraversable.MonoFoldable Data.Text.Internal.Text
instance Data.MonoTraversable.MonoFoldable (Data.Tree.Tree a)
instance Data.MonoTraversable.MonoFoldable (a, b)
instance Data.MonoTraversable.MonoFoldable (GHC.Internal.Generics.U1 a)
instance Data.MonoTraversable.MonoFoldable (GHC.Internal.Generics.V1 a)
instance Data.MonoTraversable.MonoFoldable (Data.Vector.Strict.Vector a)
instance GHC.Internal.Foreign.Storable.Storable a => Data.MonoTraversable.MonoFoldable (Data.Vector.Storable.Vector a)
instance Data.Vector.Unboxed.Base.Unbox a => Data.MonoTraversable.MonoFoldable (Data.Vector.Unboxed.Base.Vector a)
instance Data.MonoTraversable.MonoFoldable (Data.Vector.Vector a)
instance Data.MonoTraversable.MonoFoldable (Data.Sequence.Internal.ViewL a)
instance Data.MonoTraversable.MonoFoldable (Data.Sequence.Internal.ViewR a)
instance Data.MonoTraversable.MonoFoldable mono => Data.MonoTraversable.MonoFoldable (Data.MonoTraversable.WrappedMono mono a)
instance GHC.Internal.Data.Foldable.Foldable f => Data.MonoTraversable.MonoFoldable (Data.MonoTraversable.WrappedPoly f a)
instance GHC.Internal.Data.Foldable.Foldable f => Data.MonoTraversable.MonoFoldable (Control.Monad.Trans.Writer.Strict.WriterT w f a)
instance GHC.Internal.Data.Foldable.Foldable f => Data.MonoTraversable.MonoFoldable (Control.Monad.Trans.Writer.Lazy.WriterT w f a)
instance (GHC.Internal.Base.Functor f, GHC.Internal.Base.Functor g) => Data.MonoTraversable.MonoFunctor ((GHC.Internal.Generics.:*:) f g a)
instance (GHC.Internal.Base.Functor f, GHC.Internal.Base.Functor g) => Data.MonoTraversable.MonoFunctor ((GHC.Internal.Generics.:+:) f g a)
instance (GHC.Internal.Base.Functor f, GHC.Internal.Base.Functor g) => Data.MonoTraversable.MonoFunctor ((GHC.Internal.Generics.:.:) f g a)
instance Data.MonoTraversable.MonoFunctor (Data.Semigroup.Arg a b)
instance Data.MonoTraversable.MonoFunctor Data.ByteString.Lazy.Internal.ByteString
instance Data.MonoTraversable.MonoFunctor Data.ByteString.Internal.Type.ByteString
instance (GHC.Internal.Base.Functor f, GHC.Internal.Base.Functor g) => Data.MonoTraversable.MonoFunctor (Data.Functor.Compose.Compose f g a)
instance Data.MonoTraversable.MonoFunctor (GHC.Internal.Data.Functor.Const.Const m a)
instance GHC.Internal.Base.Functor m => Data.MonoTraversable.MonoFunctor (Control.Monad.Trans.Cont.ContT r m a)
instance Data.MonoTraversable.MonoFunctor (GHC.Internal.Data.Either.Either a b)
instance Data.MonoTraversable.MonoFunctor (r -> a)
instance Data.MonoTraversable.MonoFunctor (Data.HashMap.Internal.HashMap k v)
instance Data.MonoTraversable.MonoFunctor (GHC.Types.IO a)
instance Data.MonoTraversable.MonoFunctor (GHC.Internal.Data.Functor.Identity.Identity a)
instance GHC.Internal.Base.Functor m => Data.MonoTraversable.MonoFunctor (Control.Monad.Trans.Identity.IdentityT m a)
instance Data.MonoTraversable.MonoFunctor (Data.IntMap.Internal.IntMap a)
instance Data.MonoTraversable.MonoFunctor (GHC.Internal.Generics.K1 i c a)
instance Data.MonoTraversable.MonoFunctor [a]
instance GHC.Internal.Base.Functor f => Data.MonoTraversable.MonoFunctor (GHC.Internal.Generics.M1 i c f a)
instance Data.MonoTraversable.MonoFunctor (Data.Map.Internal.Map k v)
instance Data.MonoTraversable.MonoFunctor (GHC.Internal.Maybe.Maybe a)
instance GHC.Internal.Base.Functor m => Data.MonoTraversable.MonoFunctor (Control.Monad.Trans.Maybe.MaybeT m a)
instance Data.MonoTraversable.MonoFunctor (GHC.Internal.Base.NonEmpty a)
instance Data.MonoTraversable.MonoFunctor (GHC.Internal.Generics.Par1 a)
instance (GHC.Internal.Base.Functor f, GHC.Internal.Base.Functor g) => Data.MonoTraversable.MonoFunctor (Data.Functor.Product.Product f g a)
instance Data.MonoTraversable.MonoFunctor (GHC.Internal.Data.Proxy.Proxy a)
instance GHC.Internal.Base.Functor m => Data.MonoTraversable.MonoFunctor (Control.Monad.Trans.RWS.Strict.RWST r w s m a)
instance GHC.Internal.Base.Functor m => Data.MonoTraversable.MonoFunctor (Control.Monad.Trans.RWS.Lazy.RWST r w s m a)
instance GHC.Internal.Base.Functor m => Data.MonoTraversable.MonoFunctor (Control.Monad.Trans.Reader.ReaderT r m a)
instance GHC.Internal.Base.Functor f => Data.MonoTraversable.MonoFunctor (GHC.Internal.Generics.Rec1 f a)
instance Data.MonoTraversable.MonoFunctor (f a) => Data.MonoTraversable.MonoFunctor (Data.Functor.Reverse.Reverse f a)
instance Data.MonoTraversable.MonoFunctor (Data.Sequence.Internal.Seq a)
instance GHC.Internal.Base.Functor m => Data.MonoTraversable.MonoFunctor (Control.Monad.Trans.State.Strict.StateT s m a)
instance GHC.Internal.Base.Functor m => Data.MonoTraversable.MonoFunctor (Control.Monad.Trans.State.Lazy.StateT s m a)
instance Data.MonoTraversable.MonoFunctor Data.Text.Internal.Lazy.Text
instance Data.MonoTraversable.MonoFunctor Data.Text.Internal.Text
instance Data.MonoTraversable.MonoFunctor (Data.Tree.Tree a)
instance Data.MonoTraversable.MonoFunctor (a, b)
instance Data.MonoTraversable.MonoFunctor (GHC.Internal.Generics.U1 a)
instance Data.MonoTraversable.MonoFunctor (GHC.Internal.Generics.V1 a)
instance Data.MonoTraversable.MonoFunctor (Data.Vector.Strict.Vector a)
instance GHC.Internal.Foreign.Storable.Storable a => Data.MonoTraversable.MonoFunctor (Data.Vector.Storable.Vector a)
instance Data.Vector.Unboxed.Base.Unbox a => Data.MonoTraversable.MonoFunctor (Data.Vector.Unboxed.Base.Vector a)
instance Data.MonoTraversable.MonoFunctor (Data.Vector.Vector a)
instance Data.MonoTraversable.MonoFunctor (Data.Sequence.Internal.ViewL a)
instance Data.MonoTraversable.MonoFunctor (Data.Sequence.Internal.ViewR a)
instance GHC.Internal.Control.Arrow.Arrow a => Data.MonoTraversable.MonoFunctor (Control.Applicative.WrappedArrow a b c)
instance GHC.Internal.Base.Monad m => Data.MonoTraversable.MonoFunctor (Control.Applicative.WrappedMonad m a)
instance Data.MonoTraversable.MonoFunctor mono => Data.MonoTraversable.MonoFunctor (Data.MonoTraversable.WrappedMono mono a)
instance GHC.Internal.Base.Functor f => Data.MonoTraversable.MonoFunctor (Data.MonoTraversable.WrappedPoly f a)
instance GHC.Internal.Base.Functor m => Data.MonoTraversable.MonoFunctor (Control.Monad.Trans.Writer.Strict.WriterT w m a)
instance GHC.Internal.Base.Functor m => Data.MonoTraversable.MonoFunctor (Control.Monad.Trans.Writer.Lazy.WriterT w m a)
instance Data.MonoTraversable.MonoFunctor (GHC.Internal.Functor.ZipList.ZipList a)
instance (GHC.Internal.Base.Applicative f, GHC.Internal.Base.Applicative g) => Data.MonoTraversable.MonoPointed ((GHC.Internal.Generics.:*:) f g a)
instance (GHC.Internal.Base.Applicative f, GHC.Internal.Base.Applicative g) => Data.MonoTraversable.MonoPointed ((GHC.Internal.Generics.:+:) f g a)
instance (GHC.Internal.Base.Applicative f, GHC.Internal.Base.Applicative g) => Data.MonoTraversable.MonoPointed ((GHC.Internal.Generics.:.:) f g a)
instance Data.MonoTraversable.MonoPointed Data.Text.Internal.Builder.Builder
instance Data.MonoTraversable.MonoPointed Data.ByteString.Builder.Internal.Builder
instance Data.MonoTraversable.MonoPointed Data.ByteString.Lazy.Internal.ByteString
instance Data.MonoTraversable.MonoPointed Data.ByteString.Internal.Type.ByteString
instance (GHC.Internal.Base.Applicative f, GHC.Internal.Base.Applicative g) => Data.MonoTraversable.MonoPointed (Data.Functor.Compose.Compose f g a)
instance GHC.Internal.Base.Monoid m => Data.MonoTraversable.MonoPointed (GHC.Internal.Data.Functor.Const.Const m a)
instance Data.MonoTraversable.MonoPointed (Control.Monad.Trans.Cont.ContT r m a)
instance Data.MonoTraversable.MonoPointed (GHC.Internal.Data.Either.Either a b)
instance Data.MonoTraversable.MonoPointed (r -> a)
instance Data.Hashable.Class.Hashable a => Data.MonoTraversable.MonoPointed (Data.HashSet.Internal.HashSet a)
instance Data.MonoTraversable.MonoPointed (GHC.Types.IO a)
instance Data.MonoTraversable.MonoPointed (GHC.Internal.Data.Functor.Identity.Identity a)
instance GHC.Internal.Base.Applicative m => Data.MonoTraversable.MonoPointed (Control.Monad.Trans.Identity.IdentityT m a)
instance Data.MonoTraversable.MonoPointed Data.IntSet.Internal.IntSet
instance Data.MonoTraversable.MonoPointed [a]
instance GHC.Internal.Base.Applicative f => Data.MonoTraversable.MonoPointed (GHC.Internal.Generics.M1 i c f a)
instance Data.MonoTraversable.MonoPointed (GHC.Internal.Maybe.Maybe a)
instance GHC.Internal.Base.Applicative f => Data.MonoTraversable.MonoPointed (Control.Monad.Trans.Maybe.MaybeT f a)
instance Data.MonoTraversable.MonoPointed (GHC.Internal.Base.NonEmpty a)
instance Data.MonoTraversable.MonoPointed (GHC.Internal.Generics.Par1 a)
instance (GHC.Internal.Base.Applicative f, GHC.Internal.Base.Applicative g) => Data.MonoTraversable.MonoPointed (Data.Functor.Product.Product f g a)
instance Data.MonoTraversable.MonoPointed (GHC.Internal.Data.Proxy.Proxy a)
instance (GHC.Internal.Base.Monoid w, GHC.Internal.Base.Applicative m) => Data.MonoTraversable.MonoPointed (Control.Monad.Trans.RWS.Strict.RWST r w s m a)
instance (GHC.Internal.Base.Monoid w, GHC.Internal.Base.Applicative m) => Data.MonoTraversable.MonoPointed (Control.Monad.Trans.RWS.Lazy.RWST r w s m a)
instance GHC.Internal.Base.Applicative m => Data.MonoTraversable.MonoPointed (Control.Monad.Trans.Reader.ReaderT r m a)
instance GHC.Internal.Base.Applicative f => Data.MonoTraversable.MonoPointed (GHC.Internal.Generics.Rec1 f a)
instance Data.MonoTraversable.MonoPointed (Data.Sequence.Internal.Seq a)
instance Data.MonoTraversable.MonoPointed (Data.Set.Internal.Set a)
instance GHC.Internal.Base.Applicative m => Data.MonoTraversable.MonoPointed (Control.Monad.Trans.State.Strict.StateT s m a)
instance GHC.Internal.Base.Applicative m => Data.MonoTraversable.MonoPointed (Control.Monad.Trans.State.Lazy.StateT s m a)
instance Data.MonoTraversable.MonoPointed Data.Text.Internal.Lazy.Text
instance Data.MonoTraversable.MonoPointed Data.Text.Internal.Text
instance Data.MonoTraversable.MonoPointed (Data.Tree.Tree a)
instance GHC.Internal.Base.Monoid a => Data.MonoTraversable.MonoPointed (a, b)
instance Data.MonoTraversable.MonoPointed (GHC.Internal.Generics.U1 a)
instance Data.MonoTraversable.MonoPointed (Data.Vector.Strict.Vector a)
instance GHC.Internal.Foreign.Storable.Storable a => Data.MonoTraversable.MonoPointed (Data.Vector.Storable.Vector a)
instance Data.Vector.Unboxed.Base.Unbox a => Data.MonoTraversable.MonoPointed (Data.Vector.Unboxed.Base.Vector a)
instance Data.MonoTraversable.MonoPointed (Data.Vector.Vector a)
instance Data.MonoTraversable.MonoPointed (Data.Sequence.Internal.ViewL a)
instance Data.MonoTraversable.MonoPointed (Data.Sequence.Internal.ViewR a)
instance GHC.Internal.Control.Arrow.Arrow a => Data.MonoTraversable.MonoPointed (Control.Applicative.WrappedArrow a b c)
instance GHC.Internal.Base.Monad m => Data.MonoTraversable.MonoPointed (Control.Applicative.WrappedMonad m a)
instance (Data.MonoTraversable.MonoPointed mono, Data.MonoTraversable.Element mono GHC.Types.~ a) => Data.MonoTraversable.MonoPointed (Data.MonoTraversable.WrappedMono mono a)
instance GHC.Internal.Base.Applicative f => Data.MonoTraversable.MonoPointed (Data.MonoTraversable.WrappedPoly f a)
instance (GHC.Internal.Base.Monoid w, GHC.Internal.Base.Applicative m) => Data.MonoTraversable.MonoPointed (Control.Monad.Trans.Writer.Strict.WriterT w m a)
instance (GHC.Internal.Base.Monoid w, GHC.Internal.Base.Applicative m) => Data.MonoTraversable.MonoPointed (Control.Monad.Trans.Writer.Lazy.WriterT w m a)
instance Data.MonoTraversable.MonoPointed (GHC.Internal.Functor.ZipList.ZipList a)
instance (GHC.Internal.Data.Traversable.Traversable f, GHC.Internal.Data.Traversable.Traversable g) => Data.MonoTraversable.MonoTraversable ((GHC.Internal.Generics.:*:) f g a)
instance (GHC.Internal.Data.Traversable.Traversable f, GHC.Internal.Data.Traversable.Traversable g) => Data.MonoTraversable.MonoTraversable ((GHC.Internal.Generics.:+:) f g a)
instance (GHC.Internal.Data.Traversable.Traversable f, GHC.Internal.Data.Traversable.Traversable g) => Data.MonoTraversable.MonoTraversable ((GHC.Internal.Generics.:.:) f g a)
instance Data.MonoTraversable.MonoTraversable Data.ByteString.Lazy.Internal.ByteString
instance Data.MonoTraversable.MonoTraversable Data.ByteString.Internal.Type.ByteString
instance (GHC.Internal.Data.Traversable.Traversable f, GHC.Internal.Data.Traversable.Traversable g) => Data.MonoTraversable.MonoTraversable (Data.Functor.Compose.Compose f g a)
instance Data.MonoTraversable.MonoTraversable (GHC.Internal.Data.Functor.Const.Const m a)
instance Data.MonoTraversable.MonoTraversable (GHC.Internal.Data.Either.Either a b)
instance Data.MonoTraversable.MonoTraversable (Data.HashMap.Internal.HashMap k v)
instance Data.MonoTraversable.MonoTraversable (GHC.Internal.Data.Functor.Identity.Identity a)
instance GHC.Internal.Data.Traversable.Traversable f => Data.MonoTraversable.MonoTraversable (Control.Monad.Trans.Identity.IdentityT f a)
instance Data.MonoTraversable.MonoTraversable (Data.IntMap.Internal.IntMap a)
instance Data.MonoTraversable.MonoTraversable (GHC.Internal.Generics.K1 i c a)
instance Data.MonoTraversable.MonoTraversable [a]
instance GHC.Internal.Data.Traversable.Traversable f => Data.MonoTraversable.MonoTraversable (GHC.Internal.Generics.M1 i c f a)
instance Data.MonoTraversable.MonoTraversable (Data.Map.Internal.Map k v)
instance Data.MonoTraversable.MonoTraversable (GHC.Internal.Maybe.Maybe a)
instance GHC.Internal.Data.Traversable.Traversable f => Data.MonoTraversable.MonoTraversable (Control.Monad.Trans.Maybe.MaybeT f a)
instance Data.MonoTraversable.MonoTraversable (GHC.Internal.Base.NonEmpty a)
instance Data.MonoTraversable.MonoTraversable (GHC.Internal.Generics.Par1 a)
instance (GHC.Internal.Data.Traversable.Traversable f, GHC.Internal.Data.Traversable.Traversable g) => Data.MonoTraversable.MonoTraversable (Data.Functor.Product.Product f g a)
instance Data.MonoTraversable.MonoTraversable (GHC.Internal.Data.Proxy.Proxy a)
instance GHC.Internal.Data.Traversable.Traversable f => Data.MonoTraversable.MonoTraversable (GHC.Internal.Generics.Rec1 f a)
instance Data.MonoTraversable.MonoTraversable (f a) => Data.MonoTraversable.MonoTraversable (Data.Functor.Reverse.Reverse f a)
instance Data.MonoTraversable.MonoTraversable (Data.Sequence.Internal.Seq a)
instance Data.MonoTraversable.MonoTraversable Data.Text.Internal.Lazy.Text
instance Data.MonoTraversable.MonoTraversable Data.Text.Internal.Text
instance Data.MonoTraversable.MonoTraversable (Data.Tree.Tree a)
instance Data.MonoTraversable.MonoTraversable (a, b)
instance Data.MonoTraversable.MonoTraversable (GHC.Internal.Generics.U1 a)
instance Data.MonoTraversable.MonoTraversable (GHC.Internal.Generics.V1 a)
instance Data.MonoTraversable.MonoTraversable (Data.Vector.Strict.Vector a)
instance GHC.Internal.Foreign.Storable.Storable a => Data.MonoTraversable.MonoTraversable (Data.Vector.Storable.Vector a)
instance Data.Vector.Unboxed.Base.Unbox a => Data.MonoTraversable.MonoTraversable (Data.Vector.Unboxed.Base.Vector a)
instance Data.MonoTraversable.MonoTraversable (Data.Vector.Vector a)
instance Data.MonoTraversable.MonoTraversable (Data.Sequence.Internal.ViewL a)
instance Data.MonoTraversable.MonoTraversable (Data.Sequence.Internal.ViewR a)
instance GHC.Internal.Data.Traversable.Traversable f => Data.MonoTraversable.MonoTraversable (Control.Monad.Trans.Writer.Strict.WriterT w f a)
instance GHC.Internal.Data.Traversable.Traversable f => Data.MonoTraversable.MonoTraversable (Control.Monad.Trans.Writer.Lazy.WriterT w f a)

module Data.Containers

-- | A container whose values are stored in Key-Value pairs.
class (Monoid set, Semigroup set, MonoFoldable set, Eq ContainerKey set, GrowingAppend set) => SetContainer set where {
    
    -- | The type of the key
    type ContainerKey set;
}

-- | Check if there is a value with the supplied key in the container.
member :: SetContainer set => ContainerKey set -> set -> Bool

-- | Check if there isn't a value with the supplied key in the container.
notMember :: SetContainer set => ContainerKey set -> set -> Bool

-- | Get the union of two containers.
union :: SetContainer set => set -> set -> set

-- | Combine a collection of SetContainers, with left-most values
--   overriding when there are matching keys.
unions :: (SetContainer set, MonoFoldable mono, Element mono ~ set) => mono -> set

-- | Get the difference of two containers.
difference :: SetContainer set => set -> set -> set

-- | Get the intersection of two containers.
intersection :: SetContainer set => set -> set -> set

-- | Get a list of all of the keys in the container.
keys :: SetContainer set => set -> [ContainerKey set]

-- | A guaranteed-polymorphic Map, which allows for more
--   polymorphic versions of functions.
class PolyMap (map :: Type -> Type)

-- | Get the difference between two maps, using the left map's values.
differenceMap :: PolyMap map => map value1 -> map value2 -> map value1

-- | Get the intersection of two maps, using the left map's values.
intersectionMap :: PolyMap map => map value1 -> map value2 -> map value1

-- | Get the intersection of two maps with a supplied function that takes
--   in the left map's value and the right map's value.
intersectionWithMap :: PolyMap map => (value1 -> value2 -> value3) -> map value1 -> map value2 -> map value3

-- | A Map type polymorphic in both its key and value.
class BiPolyMap (map :: Type -> Type -> Type) where {
    type BPMKeyConstraint (map :: Type -> Type -> Type) key;
}
mapKeysWith :: (BiPolyMap map, BPMKeyConstraint map k1, BPMKeyConstraint map k2) => (v -> v -> v) -> (k1 -> k2) -> map k1 v -> map k2 v

-- | Polymorphic typeclass for interacting with different map types
class (MonoTraversable map, SetContainer map) => IsMap map where {
    
    -- | In some cases, <a>MapValue</a> and <a>Element</a> will be different,
    --   e.g., the <a>IsMap</a> instance of associated lists.
    type MapValue map;
}

-- | Look up a value in a map with a specified key.
lookup :: IsMap map => ContainerKey map -> map -> Maybe (MapValue map)

-- | Insert a key-value pair into a map.
insertMap :: IsMap map => ContainerKey map -> MapValue map -> map -> map

-- | Delete a key-value pair of a map using a specified key.
deleteMap :: IsMap map => ContainerKey map -> map -> map

-- | Create a map from a single key-value pair.
singletonMap :: IsMap map => ContainerKey map -> MapValue map -> map

-- | Convert a list of key-value pairs to a map
mapFromList :: IsMap map => [(ContainerKey map, MapValue map)] -> map

-- | Convert a map to a list of key-value pairs.
mapToList :: IsMap map => map -> [(ContainerKey map, MapValue map)]

-- | Like lookup, but uses a default value when the key does not
--   exist in the map.
findWithDefault :: IsMap map => MapValue map -> ContainerKey map -> map -> MapValue map

-- | Insert a key-value pair into a map.
--   
--   Inserts the value directly if the key does not exist in the map.
--   Otherwise, apply a supplied function that accepts the new value and
--   the previous value and insert that result into the map.
insertWith :: IsMap map => (MapValue map -> MapValue map -> MapValue map) -> ContainerKey map -> MapValue map -> map -> map

-- | Insert a key-value pair into a map.
--   
--   Inserts the value directly if the key does not exist in the map.
--   Otherwise, apply a supplied function that accepts the key, the new
--   value, and the previous value and insert that result into the map.
insertWithKey :: IsMap map => (ContainerKey map -> MapValue map -> MapValue map -> MapValue map) -> ContainerKey map -> MapValue map -> map -> map

-- | Insert a key-value pair into a map, return the previous key's value if
--   it existed.
--   
--   Inserts the value directly if the key does not exist in the map.
--   Otherwise, apply a supplied function that accepts the key, the new
--   value, and the previous value and insert that result into the map.
insertLookupWithKey :: IsMap map => (ContainerKey map -> MapValue map -> MapValue map -> MapValue map) -> ContainerKey map -> MapValue map -> map -> (Maybe (MapValue map), map)

-- | Apply a function to the value of a given key.
--   
--   Returns the input map when the key-value pair does not exist.
adjustMap :: IsMap map => (MapValue map -> MapValue map) -> ContainerKey map -> map -> map

-- | Equivalent to adjustMap, but the function accepts the key, as
--   well as the previous value.
adjustWithKey :: IsMap map => (ContainerKey map -> MapValue map -> MapValue map) -> ContainerKey map -> map -> map

-- | Apply a function to the value of a given key.
--   
--   If the function returns Nothing, this deletes the key-value
--   pair.
--   
--   Returns the input map when the key-value pair does not exist.
updateMap :: IsMap map => (MapValue map -> Maybe (MapValue map)) -> ContainerKey map -> map -> map

-- | Equivalent to updateMap, but the function accepts the key, as
--   well as the previous value.
updateWithKey :: IsMap map => (ContainerKey map -> MapValue map -> Maybe (MapValue map)) -> ContainerKey map -> map -> map

-- | Apply a function to the value of a given key.
--   
--   If the map does not contain the key this returns Nothing and
--   the input map.
--   
--   If the map does contain the key but the function returns
--   Nothing, this returns the previous value and the map with the
--   key-value pair removed.
--   
--   If the map contains the key and the function returns a value, this
--   returns the new value and the map with the key-value pair with the new
--   value.
updateLookupWithKey :: IsMap map => (ContainerKey map -> MapValue map -> Maybe (MapValue map)) -> ContainerKey map -> map -> (Maybe (MapValue map), map)

-- | Update/Delete the value of a given key.
--   
--   Applies a function to previous value of a given key, if it results in
--   Nothing delete the key-value pair from the map, otherwise
--   replace the previous value with the new value.
alterMap :: IsMap map => (Maybe (MapValue map) -> Maybe (MapValue map)) -> ContainerKey map -> map -> map

-- | Combine two maps.
--   
--   When a key exists in both maps, apply a function to both of the values
--   and use the result of that as the value of the key in the resulting
--   map.
unionWith :: IsMap map => (MapValue map -> MapValue map -> MapValue map) -> map -> map -> map
unionWithKey :: IsMap map => (ContainerKey map -> MapValue map -> MapValue map -> MapValue map) -> map -> map -> map

-- | Combine a list of maps.
--   
--   When a key exists in two different maps, apply a function to both of
--   the values and use the result of that as the value of the key in the
--   resulting map.
unionsWith :: IsMap map => (MapValue map -> MapValue map -> MapValue map) -> [map] -> map

-- | Apply a function over every key-value pair of a map.
mapWithKey :: IsMap map => (ContainerKey map -> MapValue map -> MapValue map) -> map -> map

-- | Apply a function over every key of a pair and run unionsWith
--   over the results.
omapKeysWith :: IsMap map => (MapValue map -> MapValue map -> MapValue map) -> (ContainerKey map -> ContainerKey map) -> map -> map

-- | Filter values in a map.
filterMap :: IsMap map => (MapValue map -> Bool) -> map -> map

-- | Equivalent to filterMap, but the function accepts the key, as
--   well as the value.
filterWithKey :: IsMap map => (ContainerKey map -> MapValue map -> Bool) -> map -> map

-- | Polymorphic typeclass for interacting with different set types
class (SetContainer set, Element set ~ ContainerKey set) => IsSet set

-- | Insert a value into a set.
insertSet :: IsSet set => Element set -> set -> set

-- | Delete a value from a set.
deleteSet :: IsSet set => Element set -> set -> set

-- | Create a set from a single element.
singletonSet :: IsSet set => Element set -> set

-- | Convert a list to a set.
setFromList :: IsSet set => [Element set] -> set

-- | Convert a set to a list.
setToList :: IsSet set => set -> [Element set]

-- | Filter values in a set.
filterSet :: IsSet set => (Element set -> Bool) -> set -> set

-- | Zip operations on MonoFunctors.
class MonoFunctor mono => MonoZip mono

-- | Combine each element of two MonoZips using a supplied function.
ozipWith :: MonoZip mono => (Element mono -> Element mono -> Element mono) -> mono -> mono -> mono

-- | Take two MonoZips and return a list of the pairs of their
--   elements.
ozip :: MonoZip mono => mono -> mono -> [(Element mono, Element mono)]

-- | Take a list of pairs of elements and return a MonoZip of the
--   first components and a MonoZip of the second components.
ounzip :: MonoZip mono => [(Element mono, Element mono)] -> (mono, mono)

-- | Type class for maps whose keys can be converted into sets.
class SetContainer set => HasKeysSet set where {
    
    -- | Type of the key set.
    type KeySet set;
}

-- | Convert a map into a set of its keys.
keysSet :: HasKeysSet set => set -> KeySet set
instance Data.Containers.BiPolyMap Data.HashMap.Internal.HashMap
instance Data.Containers.BiPolyMap Data.Map.Internal.Map
instance (Data.Hashable.Class.Hashable k, GHC.Classes.Eq k) => Data.Containers.HasKeysSet (Data.HashMap.Internal.HashMap k v)
instance Data.Containers.HasKeysSet (Data.IntMap.Internal.IntMap v)
instance GHC.Classes.Ord k => Data.Containers.HasKeysSet (Data.Map.Internal.Map k v)
instance (GHC.Classes.Eq key, Data.Hashable.Class.Hashable key) => Data.Containers.IsMap (Data.HashMap.Internal.HashMap key value)
instance Data.Containers.IsMap (Data.IntMap.Internal.IntMap value)
instance GHC.Classes.Eq key => Data.Containers.IsMap [(key, value)]
instance GHC.Classes.Ord key => Data.Containers.IsMap (Data.Map.Internal.Map key value)
instance (GHC.Classes.Eq element, Data.Hashable.Class.Hashable element) => Data.Containers.IsSet (Data.HashSet.Internal.HashSet element)
instance Data.Containers.IsSet Data.IntSet.Internal.IntSet
instance GHC.Classes.Ord element => Data.Containers.IsSet (Data.Set.Internal.Set element)
instance Data.Containers.MonoZip Data.ByteString.Lazy.Internal.ByteString
instance Data.Containers.MonoZip Data.ByteString.Internal.Type.ByteString
instance Data.Containers.MonoZip Data.Text.Internal.Lazy.Text
instance Data.Containers.MonoZip Data.Text.Internal.Text
instance (GHC.Classes.Eq key, Data.Hashable.Class.Hashable key) => Data.Containers.PolyMap (Data.HashMap.Internal.HashMap key)
instance Data.Containers.PolyMap Data.IntMap.Internal.IntMap
instance GHC.Classes.Ord key => Data.Containers.PolyMap (Data.Map.Internal.Map key)
instance (GHC.Classes.Eq key, Data.Hashable.Class.Hashable key) => Data.Containers.SetContainer (Data.HashMap.Internal.HashMap key value)
instance (GHC.Classes.Eq element, Data.Hashable.Class.Hashable element) => Data.Containers.SetContainer (Data.HashSet.Internal.HashSet element)
instance Data.Containers.SetContainer (Data.IntMap.Internal.IntMap value)
instance Data.Containers.SetContainer Data.IntSet.Internal.IntSet
instance GHC.Classes.Eq key => Data.Containers.SetContainer [(key, value)]
instance GHC.Classes.Ord k => Data.Containers.SetContainer (Data.Map.Internal.Map k v)
instance GHC.Classes.Ord element => Data.Containers.SetContainer (Data.Set.Internal.Set element)

-- | The functions in Data.MonoTraversable are all prefixed with the
--   letter o to avoid conflicts with their polymorphic
--   counterparts. This module exports the same identifiers without the
--   prefix, for all cases where the monomorphic variant loses no
--   generality versus the polymorphic version. For example, olength
--   is just as general as Data.Foldable.length, so we export
--   length = length. By contrast, omap cannot fully
--   subsume fmap or map, so we do not provide such an
--   export.
module Data.MonoTraversable.Unprefixed

-- | Synonym for ofoldMap
foldMap :: (MonoFoldable mono, Monoid m) => (Element mono -> m) -> mono -> m

-- | Synonym for ofoldr
foldr :: MonoFoldable mono => (Element mono -> b -> b) -> b -> mono -> b

-- | Synonym for ofoldl'
foldl' :: MonoFoldable mono => (a -> Element mono -> a) -> a -> mono -> a

-- | Synonym for otoList
toList :: MonoFoldable mono => mono -> [Element mono]

-- | Synonym for oall
all :: MonoFoldable mono => (Element mono -> Bool) -> mono -> Bool

-- | Synonym for oany
any :: MonoFoldable mono => (Element mono -> Bool) -> mono -> Bool

-- | Synonym for onull
null :: MonoFoldable mono => mono -> Bool

-- | Synonym for olength
length :: MonoFoldable mono => mono -> Int

-- | Synonym for olength64
length64 :: MonoFoldable mono => mono -> Int64

-- | Synonym for ocompareLength
compareLength :: (MonoFoldable mono, Integral i) => mono -> i -> Ordering

-- | Synonym for otraverse_
traverse_ :: (MonoFoldable mono, Applicative f) => (Element mono -> f b) -> mono -> f ()

-- | Synonym for ofor_
for_ :: (MonoFoldable mono, Applicative f) => mono -> (Element mono -> f b) -> f ()

-- | Synonym for omapM_
mapM_ :: (MonoFoldable mono, Applicative m) => (Element mono -> m ()) -> mono -> m ()

-- | Synonym for oforM_
forM_ :: (MonoFoldable mono, Applicative m) => mono -> (Element mono -> m ()) -> m ()

-- | Synonym for ofoldlM
foldlM :: (MonoFoldable mono, Monad m) => (a -> Element mono -> m a) -> a -> mono -> m a

-- | Synonym for ofoldMap1Ex
foldMap1Ex :: (MonoFoldable mono, Semigroup m) => (Element mono -> m) -> mono -> m

-- | Synonym for ofoldr1Ex
foldr1Ex :: MonoFoldable mono => (Element mono -> Element mono -> Element mono) -> mono -> Element mono

-- | Synonym for ofoldl1Ex'
foldl1Ex' :: MonoFoldable mono => (Element mono -> Element mono -> Element mono) -> mono -> Element mono

-- | Synonym for osum
sum :: (MonoFoldable mono, Num (Element mono)) => mono -> Element mono

-- | Synonym for oproduct
product :: (MonoFoldable mono, Num (Element mono)) => mono -> Element mono

-- | Synonym for oand
and :: (MonoFoldable mono, Element mono ~ Bool) => mono -> Bool

-- | Synonym for oor
or :: (MonoFoldable mono, Element mono ~ Bool) => mono -> Bool

-- | Synonym for oconcatMap
concatMap :: (MonoFoldable mono, Monoid m) => (Element mono -> m) -> mono -> m

-- | Synonym for oelem
elem :: (MonoFoldable mono, Eq (Element mono)) => Element mono -> mono -> Bool

-- | Synonym for onotElem
notElem :: (MonoFoldable mono, Eq (Element mono)) => Element mono -> mono -> Bool

-- | Synonym for opoint
point :: MonoPointed mono => Element mono -> mono

-- | Synonym for ointercalate
intercalate :: (MonoFoldable mono, Monoid (Element mono)) => Element mono -> mono -> Element mono

-- | Synonym for ofold
fold :: (MonoFoldable mono, Monoid (Element mono)) => mono -> Element mono

-- | Synonym for oconcat
concat :: (MonoFoldable mono, Monoid (Element mono)) => mono -> Element mono

-- | Synonym for ofoldM
foldM :: (MonoFoldable mono, Monad m) => (a -> Element mono -> m a) -> a -> mono -> m a

-- | Synonym for osequence_
sequence_ :: (Applicative m, MonoFoldable mono, Element mono ~ m ()) => mono -> m ()

-- | Abstractions over sequential data structures, like lists and vectors.
module Data.Sequences

-- | SemiSequence was created to share code between
--   IsSequence and NonNull.
--   
--   Semi means SemiGroup A SemiSequence can
--   accommodate a SemiGroup such as NonEmpty or
--   NonNull A Monoid should be able to fill out
--   IsSequence.
--   
--   SemiSequence operations maintain the same type because they all
--   maintain the same number of elements or increase them. However, a
--   decreasing function such as filter may change they type. For example,
--   from NonEmpty to '[]' This type-changing function exists on
--   NonNull as nfilter
--   
--   filter and other such functions are placed in IsSequence
--   
--   NOTE: Like GrowingAppend, ideally we'd have a
--   Semigroup superclass constraint here, but that would pull in
--   more dependencies to this package than desired.
class (Integral Index seq, GrowingAppend seq) => SemiSequence seq where {
    
    -- | The type of the index of a sequence.
    type Index seq;
}

-- | intersperse takes an element and intersperses that element
--   between the elements of the sequence.
--   
--   
--   > intersperse ',' "abcde"
--   "a,b,c,d,e"
--   
intersperse :: SemiSequence seq => Element seq -> seq -> seq

-- | Reverse a sequence
--   
--   
--   > reverse "hello world"
--   "dlrow olleh"
--   
reverse :: SemiSequence seq => seq -> seq

-- | find takes a predicate and a sequence and returns the first
--   element in the sequence matching the predicate, or Nothing if
--   there isn't an element that matches the predicate.
--   
--   
--   > find (== 5) [1 .. 10]
--   Just 5
--   
--   > find (== 15) [1 .. 10]
--   Nothing
--   
find :: SemiSequence seq => (Element seq -> Bool) -> seq -> Maybe (Element seq)

-- | Sort a sequence using an supplied element ordering function.
--   
--   
--   > let compare' x y = case compare x y of LT -> GT; EQ -> EQ; GT -> LT
--   > sortBy compare' [5,3,6,1,2,4]
--   [6,5,4,3,2,1]
--   
sortBy :: SemiSequence seq => (Element seq -> Element seq -> Ordering) -> seq -> seq

-- | Prepend an element onto a sequence.
--   
--   
--   > 4 `<a>cons</a>` [1,2,3]
--   [4,1,2,3]
--   
cons :: SemiSequence seq => Element seq -> seq -> seq

-- | Append an element onto a sequence.
--   
--   
--   > [1,2,3] `<a>snoc</a>` 4
--   [1,2,3,4]
--   
snoc :: SemiSequence seq => seq -> Element seq -> seq

-- | Create a sequence from a single element.
--   
--   
--   > singleton a :: String
--   "a"
--   > singleton a :: Vector Char
--   fromList "a"
--   
singleton :: MonoPointed seq => Element seq -> seq

-- | Sequence Laws:
--   
--   
--   fromList . otoList = id
--   fromList (x <> y) = fromList x <> fromList y
--   otoList (fromList x <> fromList y) = x <> y
--   
class (Monoid seq, MonoTraversable seq, SemiSequence seq, MonoPointed seq) => IsSequence seq

-- | Convert a list to a sequence.
--   
--   
--   > fromList [a, b, c] :: Text
--   "abc"
--   
fromList :: IsSequence seq => [Element seq] -> seq

-- | lengthIndex returns the length of a sequence as
--   Index seq.
lengthIndex :: IsSequence seq => seq -> Index seq

-- | break applies a predicate to a sequence, and returns a tuple
--   where the first element is the longest prefix (possibly empty) of
--   elements that do not satisfy the predicate. The second element
--   of the tuple is the remainder of the sequence.
--   
--   break p is equivalent to span (not
--   . p)
--   
--   
--   > break (> 3) (fromList [1,2,3,4,1,2,3,4] :: Vector Int)
--   (fromList [1,2,3],fromList [4,1,2,3,4])
--   
--   > break (< z) (fromList "abc" :: Text)
--   ("","abc")
--   
--   > break (> z) (fromList "abc" :: Text)
--   ("abc","")
--   
break :: IsSequence seq => (Element seq -> Bool) -> seq -> (seq, seq)

-- | span applies a predicate to a sequence, and returns a tuple
--   where the first element is the longest prefix (possibly empty) that
--   does satisfy the predicate. The second element of the tuple is
--   the remainder of the sequence.
--   
--   span p xs is equivalent to (takeWhile p xs,
--   dropWhile p xs)
--   
--   
--   > span (< 3) (fromList [1,2,3,4,1,2,3,4] :: Vector Int)
--   (fromList [1,2],fromList [3,4,1,2,3,4])
--   
--   > span (< z) (fromList "abc" :: Text)
--   ("abc","")
--   
--   > span (< 0) 1,2,3
--   
span :: IsSequence seq => (Element seq -> Bool) -> seq -> (seq, seq)

-- | dropWhile returns the suffix remaining after takeWhile.
--   
--   
--   > dropWhile (< 3) [1,2,3,4,5,1,2,3]
--   [3,4,5,1,2,3]
--   
--   > dropWhile (< z) (fromList "abc" :: Text)
--   ""
--   
dropWhile :: IsSequence seq => (Element seq -> Bool) -> seq -> seq

-- | takeWhile applies a predicate to a sequence, and returns the
--   longest prefix (possibly empty) of the sequence of elements that
--   satisfy the predicate.
--   
--   
--   > takeWhile (< 3) [1,2,3,4,5,1,2,3]
--   [1,2]
--   
--   > takeWhile (< z) (fromList "abc" :: Text)
--   "abc"
--   
takeWhile :: IsSequence seq => (Element seq -> Bool) -> seq -> seq

-- | splitAt n se returns a tuple where the first element
--   is the prefix of the sequence se with length n, and
--   the second element is the remainder of the sequence.
--   
--   
--   > splitAt 6 "Hello world!"
--   ("Hello ","world!")
--   
--   > splitAt 3 (fromList [1,2,3,4,5] :: Vector Int)
--   (fromList [1,2,3],fromList [4,5])
--   
splitAt :: IsSequence seq => Index seq -> seq -> (seq, seq)

-- | Equivalent to splitAt.
unsafeSplitAt :: IsSequence seq => Index seq -> seq -> (seq, seq)

-- | take n returns the prefix of a sequence of length
--   n, or the sequence itself if n > olength
--   seq.
--   
--   
--   > take 3 "abcdefg"
--   "abc"
--   > take 4 (fromList [1,2,3,4,5,6] :: Vector Int)
--   fromList [1,2,3,4]
--   
take :: IsSequence seq => Index seq -> seq -> seq

-- | Equivalent to take.
unsafeTake :: IsSequence seq => Index seq -> seq -> seq

-- | drop n returns the suffix of a sequence after the
--   first n elements, or an empty sequence if n >
--   olength seq.
--   
--   
--   > drop 3 "abcdefg"
--   "defg"
--   > drop 4 (fromList [1,2,3,4,5,6] :: Vector Int)
--   fromList [5,6]
--   
drop :: IsSequence seq => Index seq -> seq -> seq

-- | Equivalent to drop
unsafeDrop :: IsSequence seq => Index seq -> seq -> seq

-- | Same as drop but drops from the end of the sequence instead.
--   
--   
--   > dropEnd 3 "abcdefg"
--   "abcd"
--   > dropEnd 4 (fromList [1,2,3,4,5,6] :: Vector Int)
--   fromList [1,2]
--   
dropEnd :: IsSequence seq => Index seq -> seq -> seq

-- | partition takes a predicate and a sequence and returns the pair
--   of sequences of elements which do and do not satisfy the predicate.
--   
--   
--   partition p se = (filter p se, filter (not . p) se)
--   
partition :: IsSequence seq => (Element seq -> Bool) -> seq -> (seq, seq)

-- | uncons returns the tuple of the first element of a sequence and
--   the rest of the sequence, or Nothing if the sequence is empty.
--   
--   
--   > uncons (fromList [1,2,3,4] :: Vector Int)
--   Just (1,fromList [2,3,4])
--   
--   > uncons ([] :: [Int])
--   Nothing
--   
uncons :: IsSequence seq => seq -> Maybe (Element seq, seq)

-- | unsnoc returns the tuple of the init of a sequence and the last
--   element, or Nothing if the sequence is empty.
--   
--   
--   > unsnoc (fromList [1,2,3,4] :: Vector Int)
--   Just (fromList [1,2,3],4)
--   
--   > unsnoc ([] :: [Int])
--   Nothing
--   
unsnoc :: IsSequence seq => seq -> Maybe (seq, Element seq)

-- | filter given a predicate returns a sequence of all elements
--   that satisfy the predicate.
--   
--   
--   > filter (< 5) [1 .. 10]
--   [1,2,3,4]
--   
filter :: IsSequence seq => (Element seq -> Bool) -> seq -> seq

-- | The monadic version of filter.
filterM :: (IsSequence seq, Monad m) => (Element seq -> m Bool) -> seq -> m seq

-- | replicate n x is a sequence of length n with
--   x as the value of every element.
--   
--   
--   > replicate 10 a :: Text
--   "aaaaaaaaaa"
--   
replicate :: IsSequence seq => Index seq -> Element seq -> seq

-- | The monadic version of replicateM.
replicateM :: (IsSequence seq, Monad m) => Index seq -> m (Element seq) -> m seq

-- | group takes a sequence and returns a list of sequences such
--   that the concatenation of the result is equal to the argument. Each
--   subsequence in the result contains only equal elements, using the
--   supplied equality test.
--   
--   
--   > groupBy (==) Mississippi
--   [M,"i","ss","i","ss","i","pp","i"]
--   
groupBy :: IsSequence seq => (Element seq -> Element seq -> Bool) -> seq -> [seq]

-- | Similar to standard groupBy, but operates on the whole
--   collection, not just the consecutive items.
groupAllOn :: (IsSequence seq, Eq b) => (Element seq -> b) -> seq -> [seq]

-- | subsequences returns a list of all subsequences of the
--   argument.
--   
--   
--   > subsequences "abc"
--   ["","a","b","ab","c","ac","bc","abc"]
--   
subsequences :: IsSequence seq => seq -> [seq]

-- | permutations returns a list of all permutations of the
--   argument.
--   
--   
--   > permutations "abc"
--   ["abc","bac","cba","bca","cab","acb"]
--   
permutations :: IsSequence seq => seq -> [seq]

-- | Unsafe
--   
--   Get the tail of a sequence, throw an exception if the sequence is
--   empty.
--   
--   
--   > tailEx [1,2,3]
--   [2,3]
--   
tailEx :: IsSequence seq => seq -> seq

-- | Safe version of tailEx.
--   
--   Returns Nothing instead of throwing an exception when
--   encountering an empty monomorphic container.
tailMay :: IsSequence seq => seq -> Maybe seq

-- | Unsafe
--   
--   Get the init of a sequence, throw an exception if the sequence is
--   empty.
--   
--   
--   > initEx [1,2,3]
--   [1,2]
--   
initEx :: IsSequence seq => seq -> seq

-- | Safe version of initEx.
--   
--   Returns Nothing instead of throwing an exception when
--   encountering an empty monomorphic container.
initMay :: IsSequence seq => seq -> Maybe seq

-- | Equivalent to tailEx.
unsafeTail :: IsSequence seq => seq -> seq

-- | Equivalent to initEx.
unsafeInit :: IsSequence seq => seq -> seq

-- | Get the element of a sequence at a certain index, returns
--   Nothing if that index does not exist.
--   
--   
--   > index (fromList [1,2,3] :: Vector Int) 1
--   Just 2
--   > index (fromList [1,2,3] :: Vector Int) 4
--   Nothing
--   
index :: IsSequence seq => seq -> Index seq -> Maybe (Element seq)

-- | Unsafe
--   
--   Get the element of a sequence at a certain index, throws an exception
--   if the index does not exist.
indexEx :: IsSequence seq => seq -> Index seq -> Element seq

-- | Equivalent to indexEx.
unsafeIndex :: IsSequence seq => seq -> Index seq -> Element seq

-- | splitWhen splits a sequence into components delimited by
--   separators, where the predicate returns True for a separator element.
--   The resulting components do not contain the separators. Two adjacent
--   separators result in an empty component in the output. The number of
--   resulting components is greater by one than number of separators.
--   
--   Since 0.9.3
splitWhen :: IsSequence seq => (Element seq -> Bool) -> seq -> [seq]

-- | Returns all the final segments of seq with the longest first.
--   
--   
--   > tails [1,2]
--   [[1,2],[2],[]]
--   > tails []
--   [[]]
--   
tails :: IsSequence seq => seq -> [seq]

-- | Return all the initial segments of seq with the shortest
--   first.
--   
--   
--   > inits [1,2]
--   [[],[1],[1,2]]
--   > inits []
--   [[]]
--   
inits :: IsSequence seq => seq -> [seq]

-- | Return all the pairs of inital and final segments of seq.
--   
--   
--   > initTails [1,2]
--   [([],[1,2]),([1],[2]),([1,2],[])]
--   > initTails []
--   [([],[])]
--   
initTails :: IsSequence seq => seq -> [(seq, seq)]

-- | Use Data.List's implementation of find.
defaultFind :: MonoFoldable seq => (Element seq -> Bool) -> seq -> Maybe (Element seq)

-- | Use Data.List's implementation of intersperse.
defaultIntersperse :: IsSequence seq => Element seq -> seq -> seq

-- | Use Data.List's implementation of reverse.
defaultReverse :: IsSequence seq => seq -> seq

-- | Use Data.List's implementation of sortBy.
defaultSortBy :: IsSequence seq => (Element seq -> Element seq -> Ordering) -> seq -> seq

-- | Use splitWhen from Data.List.Split
defaultSplitWhen :: IsSequence seq => (Element seq -> Bool) -> seq -> [seq]

-- | Sort a vector using an supplied element ordering function.
vectorSortBy :: Vector v e => (e -> e -> Ordering) -> v e -> v e

-- | Sort a vector.
vectorSort :: (Vector v e, Ord e) => v e -> v e

-- | Use Data.List's : to prepend an element to a sequence.
defaultCons :: IsSequence seq => Element seq -> seq -> seq

-- | Use Data.List's ++ to append an element to a sequence.
defaultSnoc :: IsSequence seq => seq -> Element seq -> seq

-- | like Data.List.tail, but an input of mempty returns
--   mempty
tailDef :: IsSequence seq => seq -> seq

-- | like Data.List.init, but an input of mempty returns
--   mempty
initDef :: IsSequence seq => seq -> seq

-- | splitElem splits a sequence into components delimited
--   by separator element. It's equivalent to splitWhen with
--   equality predicate:
--   
--   
--   splitElem sep === splitWhen (== sep)
--   
--   
--   Since 0.9.3
splitElem :: (IsSequence seq, Eq (Element seq)) => Element seq -> seq -> [seq]

-- | splitSeq splits a sequence into components delimited
--   by separator subsequence. splitSeq is the right inverse of
--   intercalate:
--   
--   
--   ointercalate x . splitSeq x === id
--   
--   
--   splitElem can be considered a special case of splitSeq
--   
--   
--   splitSeq (singleton sep) === splitElem sep
--   
--   
--   splitSeq mempty is another special case: it splits
--   just before each element, and in line with splitWhen rules, it
--   has at least one output component:
--   
--   
--   > splitSeq "" ""
--   [""]
--   > splitSeq "" "a"
--   ["", "a"]
--   > splitSeq "" "ab"
--   ["", "a", "b"]
--   
--   
--   Since 0.9.3
splitSeq :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> [seq]

-- | replaceSeq old new replaces all old
--   subsequences with new.
--   
--   
--   replaceSeq old new === ointercalate new . splitSeq old
--   
replaceSeq :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> seq -> seq

-- | stripPrefix drops the given prefix from a sequence. It returns
--   Nothing if the sequence did not start with the prefix given, or
--   Just the sequence after the prefix, if it does.
--   
--   
--   > stripPrefix "foo" "foobar"
--   Just "bar"
--   > stripPrefix "abc" "foobar"
--   Nothing
--   
stripPrefix :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> Maybe seq

-- | stripSuffix drops the given suffix from a sequence. It returns
--   Nothing if the sequence did not end with the suffix given, or
--   Just the sequence before the suffix, if it does.
--   
--   
--   > stripSuffix "bar" "foobar"
--   Just "foo"
--   > stripSuffix "abc" "foobar"
--   Nothing
--   
stripSuffix :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> Maybe seq

-- | dropPrefix drops the given prefix from a sequence. It returns
--   the original sequence if the sequence doesn't start with the given
--   prefix.
--   
--   
--   > dropPrefix "foo" "foobar"
--   "bar"
--   > dropPrefix "abc" "foobar"
--   "foobar"
--   
dropPrefix :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> seq

-- | dropSuffix drops the given suffix from a sequence. It returns
--   the original sequence if the sequence doesn't end with the given
--   suffix.
--   
--   
--   > dropSuffix "bar" "foobar"
--   "foo"
--   > dropSuffix "abc" "foobar"
--   "foobar"
--   
dropSuffix :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> seq

-- | ensurePrefix will add a prefix to a sequence if it doesn't
--   exist, and otherwise have no effect.
--   
--   
--   > ensurePrefix "foo" "foobar"
--   "foobar"
--   > ensurePrefix "abc" "foobar"
--   "abcfoobar"
--   
ensurePrefix :: (Eq (Element seq), IsSequence seq) => seq -> seq -> seq

-- | Append a suffix to a sequence, unless it already has that suffix.
--   
--   
--   > ensureSuffix "bar" "foobar"
--   "foobar"
--   > ensureSuffix "abc" "foobar"
--   "foobarabc"
--   
ensureSuffix :: (Eq (Element seq), IsSequence seq) => seq -> seq -> seq

-- | isPrefixOf takes two sequences and returns True if the
--   first sequence is a prefix of the second.
isPrefixOf :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> Bool

-- | isSuffixOf takes two sequences and returns True if the
--   first sequence is a suffix of the second.
isSuffixOf :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> Bool

-- | isInfixOf takes two sequences and returns true if the
--   first sequence is contained, wholly and intact, anywhere within the
--   second.
isInfixOf :: (IsSequence seq, Eq (Element seq)) => seq -> seq -> Bool

-- | Equivalent to groupBy (==)
group :: (IsSequence seq, Eq (Element seq)) => seq -> [seq]

-- | Similar to standard group, but operates on the whole
--   collection, not just the consecutive items.
--   
--   Equivalent to groupAllOn id
groupAll :: (IsSequence seq, Eq (Element seq)) => seq -> [seq]

delete :: (IsSequence seq, Eq (Element seq)) => Element seq -> seq -> seq

deleteBy :: (IsSequence seq, Eq (Element seq)) => (Element seq -> Element seq -> Bool) -> Element seq -> seq -> seq
splitElemStrictBS :: Word8 -> ByteString -> [ByteString]
stripPrefixStrictBS :: ByteString -> ByteString -> Maybe ByteString
stripSuffixStrictBS :: ByteString -> ByteString -> Maybe ByteString
splitSeqLazyBS :: Word8 -> ByteString -> [ByteString]
stripPrefixLazyBS :: ByteString -> ByteString -> Maybe ByteString
stripSuffixLazyBS :: ByteString -> ByteString -> Maybe ByteString
splitSeqStrictText :: Text -> Text -> [Text]
replaceSeqStrictText :: Text -> Text -> Text -> Text
splitSeqLazyText :: Text -> Text -> [Text]
replaceSeqLazyText :: Text -> Text -> Text -> Text

-- | Sort a ordered sequence.
--   
--   
--   > sort [4,3,1,2]
--   [1,2,3,4]
--   
sort :: (SemiSequence seq, Ord (Element seq)) => seq -> seq

-- | A typeclass for sequences whose elements are Chars.
class (IsSequence t, IsString t, Element t ~ Char) => Textual t

-- | Break up a textual sequence into a list of words, which were delimited
--   by white space.
--   
--   
--   > words "abc  def ghi"
--   ["abc","def","ghi"]
--   
words :: Textual t => t -> [t]

-- | Join a list of textual sequences using separating spaces.
--   
--   
--   > unwords ["abc","def","ghi"]
--   "abc def ghi"
--   
unwords :: (Textual t, Element seq ~ t, MonoFoldable seq) => seq -> t

-- | Break up a textual sequence at newline characters.
--   
--   
--   > lines "hello\nworld"
--   ["hello","world"]
--   
lines :: Textual t => t -> [t]

-- | Join a list of textual sequences using newlines.
--   
--   
--   > unlines ["abc","def","ghi"]
--   "abc\ndef\nghi"
--   
unlines :: (Textual t, Element seq ~ t, MonoFoldable seq) => seq -> t

-- | Convert a textual sequence to lower-case.
--   
--   
--   > toLower "HELLO WORLD"
--   "hello world"
--   
toLower :: Textual t => t -> t

-- | Convert a textual sequence to upper-case.
--   
--   
--   > toUpper "hello world"
--   "HELLO WORLD"
--   
toUpper :: Textual t => t -> t

-- | Convert a textual sequence to folded-case.
--   
--   Slightly different from toLower, see
--   Data.Text.toCaseFold
toCaseFold :: Textual t => t -> t

-- | Split a textual sequence into two parts, split at the first space.
--   
--   
--   > breakWord "hello world"
--   ("hello","world")
--   
breakWord :: Textual t => t -> (t, t)

-- | Split a textual sequence into two parts, split at the newline.
--   
--   
--   > breakLine "abc\ndef"
--   ("abc","def")
--   
breakLine :: Textual t => t -> (t, t)

-- | Takes all of the Just values from a sequence of Maybe
--   ts and concatenates them into an unboxed sequence of ts.
--   
--   Since 0.6.2
catMaybes :: (IsSequence (f (Maybe t)), Functor f, Element (f (Maybe t)) ~ Maybe t) => f (Maybe t) -> f t

-- | Same as sortBy . comparing.
--   
--   Since 0.7.0
sortOn :: (Ord o, SemiSequence seq) => (Element seq -> o) -> seq -> seq

-- | Lazy sequences containing strict chunks of data.
class (IsSequence lazy, IsSequence strict) => LazySequence lazy strict | lazy -> strict, strict -> lazy
toChunks :: LazySequence lazy strict => lazy -> [strict]
fromChunks :: LazySequence lazy strict => [strict] -> lazy
toStrict :: LazySequence lazy strict => lazy -> strict
fromStrict :: LazySequence lazy strict => strict -> lazy

-- | Synonym for fromList
pack :: IsSequence seq => [Element seq] -> seq

-- | Synonym for otoList
unpack :: MonoFoldable mono => mono -> [Element mono]

-- | Repack from one type to another, dropping to a list in the middle.
--   
--   repack = pack . unpack.
repack :: (MonoFoldable a, IsSequence b, Element a ~ Element b) => a -> b

-- | Textual data which can be encoded to and decoded from UTF8.
class (Textual textual, IsSequence binary) => Utf8 textual binary | textual -> binary, binary -> textual

-- | Encode from textual to binary using UTF-8 encoding
encodeUtf8 :: Utf8 textual binary => textual -> binary

-- | Note that this function is required to be pure. In the case of a
--   decoding error, Unicode replacement characters must be used.
decodeUtf8 :: Utf8 textual binary => binary -> textual
instance Data.Sequences.IsSequence Data.ByteString.Lazy.Internal.ByteString
instance Data.Sequences.IsSequence Data.ByteString.Internal.Type.ByteString
instance Data.Sequences.IsSequence [a]
instance Data.Sequences.IsSequence (Data.Sequence.Internal.Seq a)
instance Data.Sequences.IsSequence Data.Text.Internal.Lazy.Text
instance Data.Sequences.IsSequence Data.Text.Internal.Text
instance GHC.Internal.Foreign.Storable.Storable a => Data.Sequences.IsSequence (Data.Vector.Storable.Vector a)
instance Data.Vector.Unboxed.Base.Unbox a => Data.Sequences.IsSequence (Data.Vector.Unboxed.Base.Vector a)
instance Data.Sequences.IsSequence (Data.Vector.Strict.Vector a)
instance Data.Sequences.IsSequence (Data.Vector.Vector a)
instance Data.Sequences.LazySequence Data.ByteString.Lazy.Internal.ByteString Data.ByteString.Internal.Type.ByteString
instance Data.Sequences.LazySequence Data.Text.Internal.Lazy.Text Data.Text.Internal.Text
instance Data.Sequences.SemiSequence Data.ByteString.Lazy.Internal.ByteString
instance Data.Sequences.SemiSequence Data.ByteString.Internal.Type.ByteString
instance Data.Sequences.SemiSequence [a]
instance Data.Sequences.SemiSequence (GHC.Internal.Base.NonEmpty a)
instance Data.Sequences.SemiSequence (Data.Sequence.Internal.Seq a)
instance Data.Sequences.SemiSequence Data.Text.Internal.Lazy.Text
instance Data.Sequences.SemiSequence Data.Text.Internal.Text
instance GHC.Internal.Foreign.Storable.Storable a => Data.Sequences.SemiSequence (Data.Vector.Storable.Vector a)
instance Data.Vector.Unboxed.Base.Unbox a => Data.Sequences.SemiSequence (Data.Vector.Unboxed.Base.Vector a)
instance Data.Sequences.SemiSequence (Data.Vector.Strict.Vector a)
instance Data.Sequences.SemiSequence (Data.Vector.Vector a)
instance (c GHC.Types.~ GHC.Types.Char) => Data.Sequences.Textual [c]
instance Data.Sequences.Textual Data.Text.Internal.Lazy.Text
instance Data.Sequences.Textual Data.Text.Internal.Text
instance (c GHC.Types.~ GHC.Types.Char, w GHC.Types.~ GHC.Internal.Word.Word8) => Data.Sequences.Utf8 [c] [w]
instance Data.Sequences.Utf8 Data.Text.Internal.Lazy.Text Data.ByteString.Lazy.Internal.ByteString
instance Data.Sequences.Utf8 Data.Text.Internal.Text Data.ByteString.Internal.Type.ByteString

-- | Data.NonNull extends the concepts from
--   Data.List.NonEmpty to any MonoFoldable.
--   
--   NonNull is a newtype wrapper for a container with 1 or more
--   elements.
module Data.NonNull

-- | A monomorphic container that is not null.
data NonNull mono

-- | Safely convert from an unsafe monomorphic container to a
--   safe non-null monomorphic container.
fromNullable :: MonoFoldable mono => mono -> Maybe (NonNull mono)

-- | Unsafely convert from an unsafe monomorphic container to
--   a safe non-null monomorphic container.
--   
--   Throws an exception if the monomorphic container is empty.
impureNonNull :: MonoFoldable mono => mono -> NonNull mono

-- | Old synonym for impureNonNull

-- | Deprecated: Please use the more explicit impureNonNull instead
nonNull :: MonoFoldable mono => mono -> NonNull mono

-- | Safely convert from a non-null monomorphic container to a
--   nullable monomorphic container.
toNullable :: NonNull mono -> mono

-- | Safely convert from a NonEmpty list to a non-null
--   monomorphic container.
fromNonEmpty :: IsSequence seq => NonEmpty (Element seq) -> NonNull seq

-- | Safely convert from a NonNull container to a
--   NonEmpty list.
toNonEmpty :: MonoFoldable mono => NonNull mono -> NonEmpty (Element mono)

-- | Prepend an element to a SemiSequence, creating a non-null
--   SemiSequence.
--   
--   Generally this uses cons underneath. cons is not efficient for most
--   data structures.
--   
--   Alternatives:
--   
--   
--   
- if you don't need to cons, use fromNullable or
--   nonNull if you can create your structure in one go.
--   
- if you need to cons, you might be able to start off with an
--   efficient data structure such as a NonEmpty List.
--   fromNonEmpty will convert that to your data structure using the
--   structure's fromList function.
--   
ncons :: SemiSequence seq => Element seq -> seq -> NonNull seq

-- | Extract the first element of a sequence and the rest of the non-null
--   sequence if it exists.
nuncons :: IsSequence seq => NonNull seq -> (Element seq, Maybe (NonNull seq))

-- | Same as nuncons with no guarantee that the rest of the sequence
--   is non-null.
splitFirst :: IsSequence seq => NonNull seq -> (Element seq, seq)

-- | Equivalent to Data.Sequences.filter, but works
--   on non-nullable sequences.
nfilter :: IsSequence seq => (Element seq -> Bool) -> NonNull seq -> seq

-- | Equivalent to Data.Sequences.filterM, but works
--   on non-nullable sequences.
nfilterM :: (Monad m, IsSequence seq) => (Element seq -> m Bool) -> NonNull seq -> m seq

-- | Equivalent to Data.Sequences.replicate
--   
--   i must be > 0
--   
--   i <= 0 is treated the same as providing 1
nReplicate :: IsSequence seq => Index seq -> Element seq -> NonNull seq

-- | Return the first element of a monomorphic container.
--   
--   Safe version of headEx, only works on monomorphic containers
--   wrapped in a NonNull.
head :: MonoFoldable mono => NonNull mono -> Element mono

-- | Safe version of tailEx, only working on non-nullable
--   sequences.
tail :: IsSequence seq => NonNull seq -> seq

-- | Return the last element of a monomorphic container.
--   
--   Safe version of lastEx, only works on monomorphic containers
--   wrapped in a NonNull.
last :: MonoFoldable mono => NonNull mono -> Element mono

-- | Safe version of initEx, only working on non-nullable
--   sequences.
init :: IsSequence seq => NonNull seq -> seq

-- | Map each element of a monomorphic container to a semigroup, and
--   combine the results.
--   
--   Safe version of ofoldMap1Ex, only works on monomorphic
--   containers wrapped in a NonNull.
--   
--   
Examples
--   
--   
--   > let xs = ncons ("hello", 1 :: Integer) [(" world", 2)]
--   > ofoldMap1 fst xs
--   "hello world"
--   
ofoldMap1 :: (MonoFoldable mono, Semigroup m) => (Element mono -> m) -> NonNull mono -> m

-- | Join a monomorphic container, whose elements are Semigroups,
--   together.
--   
--   Safe, only works on monomorphic containers wrapped in a
--   NonNull.
--   
--   
Examples
--   
--   
--   > let xs = ncons "a" ["b", "c"]
--   > xs
--   NonNull {toNullable = ["a","b","c"]}
--   
--   > ofold1 xs
--   "abc"
--   
ofold1 :: (MonoFoldable mono, Semigroup (Element mono)) => NonNull mono -> Element mono

-- | Right-associative fold of a monomorphic container with no base
--   element.
--   
--   Safe version of ofoldr1Ex, only works on monomorphic containers
--   wrapped in a NonNull.
--   
--   
--   foldr1 f = Prelude.foldr1 f . otoList
--   
--   
--   
Examples
--   
--   
--   > let xs = ncons "a" ["b", "c"]
--   > ofoldr1 (++) xs
--   "abc"
--   
ofoldr1 :: MonoFoldable mono => (Element mono -> Element mono -> Element mono) -> NonNull mono -> Element mono

-- | Strict left-associative fold of a monomorphic container with no base
--   element.
--   
--   Safe version of ofoldl1Ex', only works on monomorphic
--   containers wrapped in a NonNull.
--   
--   
--   foldl1' f = Prelude.foldl1' f . otoList
--   
--   
--   
Examples
--   
--   
--   > let xs = ncons "a" ["b", "c"]
--   > ofoldl1' (++) xs
--   "abc"
--   
ofoldl1' :: MonoFoldable mono => (Element mono -> Element mono -> Element mono) -> NonNull mono -> Element mono

-- | Get the maximum element of a monomorphic container.
--   
--   Safe version of maximumEx, only works on monomorphic containers
--   wrapped in a NonNull.
--   
--   
Examples
--   
--   
--   > let xs = ncons 1 [2, 3 :: Int]
--   > maximum xs
--   3
--   
maximum :: (MonoFoldable mono, Ord (Element mono)) => NonNull mono -> Element mono

-- | Get the maximum element of a monomorphic container, using a supplied
--   element ordering function.
--   
--   Safe version of maximumByEx, only works on monomorphic
--   containers wrapped in a NonNull.
maximumBy :: MonoFoldable mono => (Element mono -> Element mono -> Ordering) -> NonNull mono -> Element mono

-- | Get the minimum element of a monomorphic container.
--   
--   Safe version of minimumEx, only works on monomorphic containers
--   wrapped in a NonNull.
--   
--   
Examples
--   
--   
--   > let xs = ncons 1 [2, 3 :: Int]
--   > minimum xs
--   1
--   
minimum :: (MonoFoldable mono, Ord (Element mono)) => NonNull mono -> Element mono

-- | Get the minimum element of a monomorphic container, using a supplied
--   element ordering function.
--   
--   Safe version of minimumByEx, only works on monomorphic
--   containers wrapped in a NonNull.
minimumBy :: MonoFoldable mono => (Element mono -> Element mono -> Ordering) -> NonNull mono -> Element mono

-- | Prepend an element to a non-null SemiSequence.
(<|) :: SemiSequence seq => Element seq -> NonNull seq -> NonNull seq
infixr 5 <|

-- | Specializes fromNonEmpty to lists only.
toMinList :: NonEmpty a -> NonNull [a]

-- | fmap over the underlying container in a NonNull.
mapNonNull :: (Functor f, MonoFoldable (f b)) => (a -> b) -> NonNull (f a) -> NonNull (f b)

-- | Containers which, when two values are combined, the combined length is
--   no less than the larger of the two inputs. In code:
--   
--   
--   olength (x <> y) >= max (olength x) (olength y)
--   
--   
--   This class has no methods, and is simply used to assert that this law
--   holds, in order to provide guarantees of correctness (see, for
--   instance, Data.NonNull).
--   
--   This should have a Semigroup superclass constraint, however,
--   due to Semigroup only recently moving to base, some packages
--   do not provide instances.
class MonoFoldable mono => GrowingAppend mono
instance GHC.Internal.Data.Data.Data mono => GHC.Internal.Data.Data.Data (Data.NonNull.NonNull mono)
instance GHC.Classes.Eq mono => GHC.Classes.Eq (Data.NonNull.NonNull mono)
instance GHC.Internal.Exception.Type.Exception Data.NonNull.NullError
instance Data.MonoTraversable.GrowingAppend mono => Data.MonoTraversable.GrowingAppend (Data.NonNull.NonNull mono)
instance Data.Sequences.IsSequence mono => Data.MonoTraversable.MonoComonad (Data.NonNull.NonNull mono)
instance Data.MonoTraversable.MonoFoldable mono => Data.MonoTraversable.MonoFoldable (Data.NonNull.NonNull mono)
instance Data.MonoTraversable.MonoFunctor mono => Data.MonoTraversable.MonoFunctor (Data.NonNull.NonNull mono)
instance Data.MonoTraversable.MonoPointed mono => Data.MonoTraversable.MonoPointed (Data.NonNull.NonNull mono)
instance Data.MonoTraversable.MonoTraversable mono => Data.MonoTraversable.MonoTraversable (Data.NonNull.NonNull mono)
instance GHC.Classes.Ord mono => GHC.Classes.Ord (Data.NonNull.NonNull mono)
instance GHC.Internal.Read.Read mono => GHC.Internal.Read.Read (Data.NonNull.NonNull mono)
instance Data.Sequences.SemiSequence seq => Data.Sequences.SemiSequence (Data.NonNull.NonNull seq)
instance (GHC.Internal.Base.Semigroup mono, Data.MonoTraversable.GrowingAppend mono) => GHC.Internal.Base.Semigroup (Data.NonNull.NonNull mono)
instance GHC.Internal.Show.Show mono => GHC.Internal.Show.Show (Data.NonNull.NonNull mono)
instance GHC.Internal.Show.Show Data.NonNull.NullError
