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

-- | base-compat with extra batteries
--   
--   Provides functions available in later versions of base to a
--   wider range of compilers, without requiring you to use CPP pragmas in
--   your code.
--   
--   This package provides the same API as the base-compat
--   library, but depends on compatibility packages (such as
--   semigroups) to offer a wider support window than
--   base-compat, which has no dependencies. Most of the modules
--   in this library have the same names as in base-compat to make
--   it easier to switch between the two. There also exist versions of each
--   module with the suffix .Repl.Batteries, which are distinct
--   from anything in base-compat, to allow for easier use in
--   GHCi.
--   
--   See here for a more comprehensive list of differences
--   between base-compat and base-compat-batteries.
@package base-compat-batteries
@version 0.13.1

module Control.Concurrent.Compat

-- | Reexports Control.Concurrent.Compat from a globally unique
--   namespace.
module Control.Concurrent.Compat.Repl.Batteries

module Control.Concurrent.MVar.Compat

-- | Reexports Control.Concurrent.MVar.Compat from a globally unique
--   namespace.
module Control.Concurrent.MVar.Compat.Repl.Batteries

module Control.Exception.Compat

-- | Reexports Control.Exception.Compat from a globally unique
--   namespace.
module Control.Exception.Compat.Repl.Batteries

module Control.Monad.Compat

-- | Monads that also support choice and failure.
class (Alternative m, Monad m) => MonadPlus (m :: Type -> Type)

-- | The identity of mplus. It should also satisfy the equations
--   
--   
--   mzero >>= f  =  mzero
--   v >> mzero   =  mzero
--   
--   
--   The default definition is
--   
--   
--   mzero = empty
--   
mzero :: MonadPlus m => m a

-- | An associative operation. The default definition is
--   
--   
--   mplus = (<|>)
--   
mplus :: MonadPlus m => m a -> m a -> m a

-- | The Monad class defines the basic operations over a
--   monad, a concept from a branch of mathematics known as
--   category theory. From the perspective of a Haskell programmer,
--   however, it is best to think of a monad as an abstract datatype
--   of actions. Haskell's do expressions provide a convenient
--   syntax for writing monadic expressions.
--   
--   Instances of Monad should satisfy the following:
--   
--   
--   
- Left identity return a >>= k = k
--   a
--   
- Right identity m >>= return =
--   m
--   
- Associativity m >>= (\x -> k x
--   >>= h) = (m >>= k) >>=
--   h
--   
--   
--   Furthermore, the Monad and Applicative operations should
--   relate as follows:
--   
--   
--   
- 
pure = return

--   
- 
m1 <*> m2 = m1 >>= (\x1 -> m2
--   >>= (\x2 -> return (x1 x2)))

--   
--   
--   The above laws imply:
--   
--   
--   
- 
fmap f xs = xs >>= return .
--   f

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

--   
--   
--   and that pure and (<*>) satisfy the applicative
--   functor laws.
--   
--   The instances of Monad for lists, Maybe and IO
--   defined in the Prelude satisfy these laws.
class Applicative m => Monad (m :: Type -> Type)

-- | Sequentially compose two actions, passing any value produced by the
--   first as an argument to the second.
--   
--   'as >>= bs' can be understood as the do
--   expression
--   
--   
--   do a <- as
--      bs a
--   
(>>=) :: Monad m => m a -> (a -> m b) -> m b

-- | Sequentially compose two actions, discarding any value produced by the
--   first, like sequencing operators (such as the semicolon) in imperative
--   languages.
--   
--   'as >> bs' can be understood as the do
--   expression
--   
--   
--   do as
--      bs
--   
(>>) :: Monad m => m a -> m b -> m b

-- | Inject a value into the monadic type.
return :: Monad m => a -> m a
infixl 1 >>=
infixl 1 >>

-- | A type f is a Functor if it provides a function fmap
--   which, given any types a and b lets you apply any
--   function from (a -> b) to turn an f a into an
--   f b, preserving the structure of f. Furthermore
--   f needs to adhere to the following:
--   
--   
--   
- Identity fmap id == id
--   
- Composition fmap (f . g) == fmap f .
--   fmap g
--   
--   
--   Note, that the second law follows from the free theorem of the type
--   fmap and the first law, so you need only check that the former
--   condition holds. See
--   https://www.schoolofhaskell.com/user/edwardk/snippets/fmap or
--   https://github.com/quchen/articles/blob/master/second_functor_law.md
--   for an explanation.
class () => Functor (f :: Type -> Type)

-- | fmap is used to apply a function of type (a -> b)
--   to a value of type f a, where f is a functor, to produce a
--   value of type f b. Note that for any type constructor with
--   more than one parameter (e.g., Either), only the last type
--   parameter can be modified with fmap (e.g., b in
--   `Either a b`).
--   
--   Some type constructors with two parameters or more have a
--   Bifunctor instance that allows both the last and the
--   penultimate parameters to be mapped over.
--   
--   
Examples
--   
--   Convert from a Maybe Int to a Maybe String
--   using show:
--   
--   
--   >>> fmap show Nothing
--   Nothing
--   
--   >>> fmap show (Just 3)
--   Just "3"
--   
--   
--   Convert from an Either Int Int to an Either Int
--   String using show:
--   
--   
--   >>> fmap show (Left 17)
--   Left 17
--   
--   >>> fmap show (Right 17)
--   Right "17"
--   
--   
--   Double each element of a list:
--   
--   
--   >>> fmap (*2) [1,2,3]
--   [2,4,6]
--   
--   
--   Apply even to the second element of a pair:
--   
--   
--   >>> fmap even (2,2)
--   (2,True)
--   
--   
--   It may seem surprising that the function is only applied to the last
--   element of the tuple compared to the list example above which applies
--   it to every element in the list. To understand, remember that tuples
--   are type constructors with multiple type parameters: a tuple of 3
--   elements (a,b,c) can also be written (,,) a b c and
--   its Functor instance is defined for Functor ((,,) a
--   b) (i.e., only the third parameter is free to be mapped over with
--   fmap).
--   
--   It explains why fmap can be used with tuples containing
--   values of different types as in the following example:
--   
--   
--   >>> fmap even ("hello", 1.0, 4)
--   ("hello",1.0,True)
--   
fmap :: Functor f => (a -> b) -> f a -> f b

-- | Replace all locations in the input with the same value. The default
--   definition is fmap . const, but this may be
--   overridden with a more efficient version.
--   
--   
Examples
--   
--   Perform a computation with Maybe and replace the result with a
--   constant value if it is Just:
--   
--   
--   >>> 'a' <$ Just 2
--   Just 'a'
--   
--   >>> 'a' <$ Nothing
--   Nothing
--   
(<$) :: Functor f => a -> f b -> f a
infixl 4 <$

-- | When a value is bound in do-notation, the pattern on the left
--   hand side of <- might not match. In this case, this class
--   provides a function to recover.
--   
--   A Monad without a MonadFail instance may only be used in
--   conjunction with pattern that always match, such as newtypes, tuples,
--   data types with only a single data constructor, and irrefutable
--   patterns (~pat).
--   
--   Instances of MonadFail should satisfy the following law:
--   fail s should be a left zero for >>=,
--   
--   
--   fail s >>= f  =  fail s
--   
--   
--   If your Monad is also MonadPlus, a popular definition is
--   
--   
--   fail _ = mzero
--   
--   
--   fail s should be an action that runs in the monad itself, not
--   an exception (except in instances of MonadIO). In particular,
--   fail should not be implemented in terms of error.
class Monad m => MonadFail (m :: Type -> Type)

-- | Map each element of a structure to a monadic action, evaluate these
--   actions from left to right, and collect the results. For a version
--   that ignores the results see mapM_.
--   
--   
Examples
--   
--   mapM is literally a traverse with a type signature
--   restricted to Monad. Its implementation may be more efficient
--   due to additional power of Monad.
mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)

-- | Evaluate each monadic action in the structure from left to right, and
--   collect the results. For a version that ignores the results see
--   sequence_.
--   
--   
Examples
--   
--   Basic usage:
--   
--   The first two examples are instances where the input and and output of
--   sequence are isomorphic.
--   
--   
--   >>> sequence $ Right [1,2,3,4]
--   [Right 1,Right 2,Right 3,Right 4]
--   
--   
--   
--   >>> sequence $ [Right 1,Right 2,Right 3,Right 4]
--   Right [1,2,3,4]
--   
--   
--   The following examples demonstrate short circuit behavior for
--   sequence.
--   
--   
--   >>> sequence $ Left [1,2,3,4]
--   Left [1,2,3,4]
--   
--   
--   
--   >>> sequence $ [Left 0, Right 1,Right 2,Right 3,Right 4]
--   Left 0
--   
sequence :: (Traversable t, Monad m) => t (m a) -> m (t a)

-- | forM is mapM with its arguments flipped. For a version
--   that ignores the results see forM_.
forM :: (Traversable t, Monad m) => t a -> (a -> m b) -> m (t b)

-- | Repeat an action indefinitely.
--   
--   
Examples
--   
--   A common use of forever is to process input from network
--   sockets, Handles, and channels (e.g. MVar and
--   Chan).
--   
--   For example, here is how we might implement an echo server,
--   using forever both to listen for client connections on a
--   network socket and to echo client input on client connection handles:
--   
--   
--   echoServer :: Socket -> IO ()
--   echoServer socket = forever $ do
--     client <- accept socket
--     forkFinally (echo client) (\_ -> hClose client)
--     where
--       echo :: Handle -> IO ()
--       echo client = forever $
--         hGetLine client >>= hPutStrLn client
--   
--   
--   Note that "forever" isn't necessarily non-terminating. If the action
--   is in a MonadPlus and short-circuits after some number
--   of iterations. then forever actually returns
--   mzero, effectively short-circuiting its caller.
forever :: Applicative f => f a -> f b

-- | Promote a function to a monad.
liftM :: Monad m => (a1 -> r) -> m a1 -> m r

-- | Conditional failure of Alternative computations. Defined by
--   
--   
--   guard True  = pure ()
--   guard False = empty
--   
--   
--   
Examples
--   
--   Common uses of guard include conditionally signaling an error
--   in an error monad and conditionally rejecting the current choice in an
--   Alternative-based parser.
--   
--   As an example of signaling an error in the error monad Maybe,
--   consider a safe division function safeDiv x y that returns
--   Nothing when the denominator y is zero and
--   Just (x `div` y) otherwise. For example:
--   
--   
--   >>> safeDiv 4 0
--   Nothing
--   
--   
--   
--   >>> safeDiv 4 2
--   Just 2
--   
--   
--   A definition of safeDiv using guards, but not guard:
--   
--   
--   safeDiv :: Int -> Int -> Maybe Int
--   safeDiv x y | y /= 0    = Just (x `div` y)
--               | otherwise = Nothing
--   
--   
--   A definition of safeDiv using guard and Monad
--   do-notation:
--   
--   
--   safeDiv :: Int -> Int -> Maybe Int
--   safeDiv x y = do
--     guard (y /= 0)
--     return (x `div` y)
--   
guard :: Alternative f => Bool -> f ()

-- | The join function is the conventional monad join operator. It
--   is used to remove one level of monadic structure, projecting its bound
--   argument into the outer level.
--   
--   'join bss' can be understood as the do
--   expression
--   
--   
--   do bs <- bss
--      bs
--   
--   
--   
Examples
--   
--   A common use of join is to run an IO computation
--   returned from an STM transaction, since STM transactions
--   can't perform IO directly. Recall that
--   
--   
--   atomically :: STM a -> IO a
--   
--   
--   is used to run STM transactions atomically. So, by specializing
--   the types of atomically and join to
--   
--   
--   atomically :: STM (IO b) -> IO (IO b)
--   join       :: IO (IO b)  -> IO b
--   
--   
--   we can compose them as
--   
--   
--   join . atomically :: STM (IO b) -> IO b
--   
--   
--   to run an STM transaction and the IO action it returns.
join :: Monad m => m (m a) -> m a

-- | Same as >>=, but with the arguments interchanged.
(=<<) :: Monad m => (a -> m b) -> m a -> m b
infixr 1 =<<

-- | Conditional execution of Applicative expressions. For example,
--   
--   
--   when debug (putStrLn "Debugging")
--   
--   
--   will output the string Debugging if the Boolean value
--   debug is True, and otherwise do nothing.
when :: Applicative f => Bool -> f () -> f ()

-- | Promote a function to a monad, scanning the monadic arguments from
--   left to right. For example,
--   
--   
--   liftM2 (+) [0,1] [0,2] = [0,2,1,3]
--   liftM2 (+) (Just 1) Nothing = Nothing
--   
liftM2 :: Monad m => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r

-- | Promote a function to a monad, scanning the monadic arguments from
--   left to right (cf. liftM2).
liftM3 :: Monad m => (a1 -> a2 -> a3 -> r) -> m a1 -> m a2 -> m a3 -> m r

-- | Promote a function to a monad, scanning the monadic arguments from
--   left to right (cf. liftM2).
liftM4 :: Monad m => (a1 -> a2 -> a3 -> a4 -> r) -> m a1 -> m a2 -> m a3 -> m a4 -> m r

-- | Promote a function to a monad, scanning the monadic arguments from
--   left to right (cf. liftM2).
liftM5 :: Monad m => (a1 -> a2 -> a3 -> a4 -> a5 -> r) -> m a1 -> m a2 -> m a3 -> m a4 -> m a5 -> m r

-- | In many situations, the liftM operations can be replaced by
--   uses of ap, which promotes function application.
--   
--   
--   return f `ap` x1 `ap` ... `ap` xn
--   
--   
--   is equivalent to
--   
--   
--   liftMn f x1 x2 ... xn
--   
ap :: Monad m => m (a -> b) -> m a -> m b

-- | void value discards or ignores the result of
--   evaluation, such as the return value of an IO action.
--   
--   
Examples
--   
--   Replace the contents of a Maybe Int with unit:
--   
--   
--   >>> void Nothing
--   Nothing
--   
--   >>> void (Just 3)
--   Just ()
--   
--   
--   Replace the contents of an Either Int
--   Int with unit, resulting in an Either
--   Int ():
--   
--   
--   >>> void (Left 8675309)
--   Left 8675309
--   
--   >>> void (Right 8675309)
--   Right ()
--   
--   
--   Replace every element of a list with unit:
--   
--   
--   >>> void [1,2,3]
--   [(),(),()]
--   
--   
--   Replace the second element of a pair with unit:
--   
--   
--   >>> void (1,2)
--   (1,())
--   
--   
--   Discard the result of an IO action:
--   
--   
--   >>> mapM print [1,2]
--   1
--   2
--   [(),()]
--   
--   >>> void $ mapM print [1,2]
--   1
--   2
--   
void :: Functor f => f a -> f ()

-- | Map each element of a structure to a monadic action, evaluate these
--   actions from left to right, and ignore the results. For a version that
--   doesn't ignore the results see mapM.
--   
--   mapM_ is just like traverse_, but specialised to monadic
--   actions.
mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()

-- | forM_ is mapM_ with its arguments flipped. For a version
--   that doesn't ignore the results see forM.
--   
--   forM_ is just like for_, but specialised to monadic
--   actions.
forM_ :: (Foldable t, Monad m) => t a -> (a -> m b) -> m ()

-- | Evaluate each monadic action in the structure from left to right, and
--   ignore the results. For a version that doesn't ignore the results see
--   sequence.
--   
--   sequence_ is just like sequenceA_, but specialised to
--   monadic actions.
sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()

-- | The sum of a collection of actions using (<|>),
--   generalizing concat.
--   
--   msum is just like asum, but specialised to
--   MonadPlus.
--   
--   
Examples
--   
--   Basic usage, using the MonadPlus instance for Maybe:
--   
--   
--   >>> msum [Just "Hello", Nothing, Just "World"]
--   Just "Hello"
--   
msum :: (Foldable t, MonadPlus m) => t (m a) -> m a

-- | This generalizes the list-based filter function.
filterM :: Applicative m => (a -> m Bool) -> [a] -> m [a]

-- | Left-to-right composition of Kleisli arrows.
--   
--   '(bs >=> cs) a' can be understood as the
--   do expression
--   
--   
--   do b <- bs a
--      cs b
--   
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
infixr 1 >=>

-- | Right-to-left composition of Kleisli arrows.
--   (>=>), with the arguments flipped.
--   
--   Note how this operator resembles function composition
--   (.):
--   
--   
--   (.)   ::            (b ->   c) -> (a ->   b) -> a ->   c
--   (<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
--   
(<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
infixr 1 <=<

-- | The mapAndUnzipM function maps its first argument over a list,
--   returning the result as a pair of lists. This function is mainly used
--   with complicated data structures or a state monad.
mapAndUnzipM :: Applicative m => (a -> m (b, c)) -> [a] -> m ([b], [c])

-- | The zipWithM function generalizes zipWith to arbitrary
--   applicative functors.
zipWithM :: Applicative m => (a -> b -> m c) -> [a] -> [b] -> m [c]

-- | zipWithM_ is the extension of zipWithM which ignores the
--   final result.
zipWithM_ :: Applicative m => (a -> b -> m c) -> [a] -> [b] -> m ()

-- | The foldM function is analogous to foldl, except that
--   its result is encapsulated in a monad. Note that foldM works
--   from left-to-right over the list arguments. This could be an issue
--   where (>>) and the `folded function' are not
--   commutative.
--   
--   
--   foldM f a1 [x1, x2, ..., xm]
--   
--   ==
--   
--   do
--     a2 <- f a1 x1
--     a3 <- f a2 x2
--     ...
--     f am xm
--   
--   
--   If right-to-left evaluation is required, the input list should be
--   reversed.
--   
--   Note: foldM is the same as foldlM
foldM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b

-- | Like foldM, but discards the result.
foldM_ :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m ()

-- | replicateM n act performs the action act
--   n times, and then returns the list of results:
--   
--   
Examples
--   
--   
--   >>> import Control.Monad.State
--   
--   >>> runState (replicateM 3 $ state $ \s -> (s, s + 1)) 1
--   ([1,2,3],4)
--   
replicateM :: Applicative m => Int -> m a -> m [a]

-- | Like replicateM, but discards the result.
--   
--   
Examples
--   
--   
--   >>> replicateM_ 3 (putStrLn "a")
--   a
--   a
--   a
--   
replicateM_ :: Applicative m => Int -> m a -> m ()

-- | The reverse of when.
unless :: Applicative f => Bool -> f () -> f ()

-- | Strict version of <$>.
(<$!>) :: Monad m => (a -> b) -> m a -> m b
infixl 4 <$!>

-- | Direct MonadPlus equivalent of filter.
--   
--   
Examples
--   
--   The filter function is just mfilter specialized to the
--   list monad:
--   
--   
--   filter = ( mfilter :: (a -> Bool) -> [a] -> [a] )
--   
--   
--   An example using mfilter with the Maybe monad:
--   
--   
--   >>> mfilter odd (Just 1)
--   Just 1
--   
--   >>> mfilter odd (Just 2)
--   Nothing
--   
mfilter :: MonadPlus m => (a -> Bool) -> m a -> m a
fail :: MonadFail m => String -> m a

-- | Reexports Control.Monad.Compat from a globally unique
--   namespace.
module Control.Monad.Compat.Repl.Batteries

module Control.Monad.Fail.Compat

-- | Reexports Control.Monad.Fail.Compat from a globally unique
--   namespace.
module Control.Monad.Fail.Compat.Repl.Batteries

module Control.Monad.IO.Class.Compat

-- | Reexports Control.Monad.IO.Class.Compat from a globally unique
--   namespace.
module Control.Monad.IO.Class.Compat.Repl.Batteries

module Control.Monad.ST.Lazy.Unsafe.Compat

-- | Reexports Control.Monad.ST.Lazy.Unsafe.Compat from a globally
--   unique namespace.
module Control.Monad.ST.Lazy.Unsafe.Compat.Repl.Batteries

module Control.Monad.ST.Unsafe.Compat

-- | Reexports Control.Monad.ST.Unsafe.Compat from a globally unique
--   namespace.
module Control.Monad.ST.Unsafe.Compat.Repl.Batteries

module Data.Bifoldable.Compat

-- | Reexports Data.Bifoldable.Compat from a globally unique
--   namespace.
module Data.Bifoldable.Compat.Repl.Batteries

module Data.Bifoldable1.Compat

-- | Reexports Data.Bifoldable1.Compat from a globally unique
--   namespace.
module Data.Bifoldable1.Compat.Repl.Batteries

module Data.Bifunctor.Compat

-- | Reexports Data.Bifunctor.Compat from a globally unique
--   namespace.
module Data.Bifunctor.Compat.Repl.Batteries

module Data.Bitraversable.Compat

-- | Reexports Data.Bitraversable.Compat from a globally unique
--   namespace.
module Data.Bitraversable.Compat.Repl.Batteries

module Data.Bits.Compat

-- | Reexports Data.Bits.Compat from a globally unique namespace.
module Data.Bits.Compat.Repl.Batteries

module Data.Bool.Compat

-- | Reexports Data.Bool.Compat from a globally unique namespace.
module Data.Bool.Compat.Repl.Batteries

module Data.Complex.Compat

-- | Reexports Data.Complex.Compat from a globally unique namespace.
module Data.Complex.Compat.Repl.Batteries

module Data.Either.Compat

-- | Reexports Data.Either.Compat from a globally unique namespace.
module Data.Either.Compat.Repl.Batteries

module Data.Foldable.Compat

-- | Reexports Data.Foldable.Compat from a globally unique
--   namespace.
module Data.Foldable.Compat.Repl.Batteries

module Data.Foldable1.Compat

-- | Reexports Data.Foldable1.Compat from a globally unique
--   namespace.
module Data.Foldable1.Compat.Repl.Batteries

module Data.Function.Compat

-- | Reexports Data.Function.Compat from a globally unique
--   namespace.
module Data.Function.Compat.Repl.Batteries

module Data.Functor.Compat

-- | Reexports Data.Functor.Compat from a globally unique namespace.
module Data.Functor.Compat.Repl.Batteries

module Data.Functor.Compose.Compat

-- | Reexports Data.Functor.Compose.Compat from a globally unique
--   namespace.
module Data.Functor.Compose.Compat.Repl.Batteries

module Data.Functor.Const.Compat

-- | Reexports Data.Functor.Const.Compat from a globally unique
--   namespace.
module Data.Functor.Const.Compat.Repl.Batteries

module Data.Functor.Contravariant.Compat

-- | Reexports Data.Functor.Contravariant.Compat from a globally
--   unique namespace.
module Data.Functor.Contravariant.Compat.Repl.Batteries

module Data.Functor.Identity.Compat

-- | Reexports Data.Functor.Identity.Compat from a globally unique
--   namespace.
module Data.Functor.Identity.Compat.Repl.Batteries

module Data.Functor.Product.Compat

-- | Reexports Data.Functor.Product.Compat from a globally unique
--   namespace.
module Data.Functor.Product.Compat.Repl.Batteries

module Data.Functor.Sum.Compat

-- | Reexports Data.Functor.Sum.Compat from a globally unique
--   namespace.
module Data.Functor.Sum.Compat.Repl.Batteries

module Data.IORef.Compat

-- | Reexports Data.IORef.Compat from a globally unique namespace.
module Data.IORef.Compat.Repl.Batteries

module Data.List.Compat

-- | Reexports Data.List.Compat from a globally unique namespace.
module Data.List.Compat.Repl.Batteries

module Data.List.NonEmpty.Compat

-- | Non-empty (and non-strict) list type.
data () => NonEmpty a
(:|) :: a -> [a] -> NonEmpty a
infixr 5 :|

-- | Map a function over a NonEmpty stream.
map :: (a -> b) -> NonEmpty a -> NonEmpty b

-- | 'intersperse x xs' alternates elements of the list with copies of
--   x.
--   
--   
--   intersperse 0 (1 :| [2,3]) == 1 :| [0,2,0,3]
--   
intersperse :: a -> NonEmpty a -> NonEmpty a

-- | scanl is similar to foldl, but returns a stream of
--   successive reduced values from the left:
--   
--   
--   scanl f z [x1, x2, ...] == z :| [z `f` x1, (z `f` x1) `f` x2, ...]
--   
--   
--   Note that
--   
--   
--   last (scanl f z xs) == foldl f z xs.
--   
scanl :: Foldable f => (b -> a -> b) -> b -> f a -> NonEmpty b

-- | scanr is the right-to-left dual of scanl. Note that
--   
--   
--   head (scanr f z xs) == foldr f z xs.
--   
scanr :: Foldable f => (a -> b -> b) -> b -> f a -> NonEmpty b

-- | scanl1 is a variant of scanl that has no starting value
--   argument:
--   
--   
--   scanl1 f [x1, x2, ...] == x1 :| [x1 `f` x2, x1 `f` (x2 `f` x3), ...]
--   
scanl1 :: (a -> a -> a) -> NonEmpty a -> NonEmpty a

-- | scanr1 is a variant of scanr that has no starting value
--   argument.
scanr1 :: (a -> a -> a) -> NonEmpty a -> NonEmpty a

-- | transpose for NonEmpty, behaves the same as
--   transpose The rows/columns need not be the same length, in
--   which case > transpose . transpose /= id
transpose :: NonEmpty (NonEmpty a) -> NonEmpty (NonEmpty a)

-- | sortBy for NonEmpty, behaves the same as sortBy
sortBy :: (a -> a -> Ordering) -> NonEmpty a -> NonEmpty a

-- | sortWith for NonEmpty, behaves the same as:
--   
--   
--   sortBy . comparing
--   
sortWith :: Ord o => (a -> o) -> NonEmpty a -> NonEmpty a

-- | Number of elements in NonEmpty list.
length :: NonEmpty a -> Int

-- | Extract the first element of the stream.
head :: NonEmpty a -> a

-- | Extract the possibly-empty tail of the stream.
tail :: NonEmpty a -> [a]

-- | Extract the last element of the stream.
last :: NonEmpty a -> a

-- | Extract everything except the last element of the stream.
init :: NonEmpty a -> [a]

-- | Construct a NonEmpty list from a single element.
singleton :: a -> NonEmpty a

-- | Prepend an element to the stream.
(<|) :: a -> NonEmpty a -> NonEmpty a
infixr 5 <|

-- | Synonym for <|.
cons :: a -> NonEmpty a -> NonEmpty a

-- | uncons produces the first element of the stream, and a stream
--   of the remaining elements, if any.
uncons :: NonEmpty a -> (a, Maybe (NonEmpty a))

-- | The unfoldr function is analogous to Data.List's
--   unfoldr operation.
unfoldr :: (a -> (b, Maybe a)) -> a -> NonEmpty b

-- | Sort a stream.
sort :: Ord a => NonEmpty a -> NonEmpty a

-- | reverse a finite NonEmpty stream.
reverse :: NonEmpty a -> NonEmpty a

-- | The inits function takes a stream xs and returns all
--   the finite prefixes of xs, starting with the shortest. The
--   result is NonEmpty because the result always contains the empty
--   list as the first element.
--   
--   
--   inits [1,2,3] == [] :| [[1], [1,2], [1,2,3]]
--   inits [1] == [] :| [[1]]
--   inits [] == [] :| []
--   
inits :: Foldable f => f a -> NonEmpty [a]

-- | The inits1 function takes a NonEmpty stream xs
--   and returns all the NonEmpty finite prefixes of xs,
--   starting with the shortest.
--   
--   
--   inits1 (1 :| [2,3]) == (1 :| []) :| [1 :| [2], 1 :| [2,3]]
--   inits1 (1 :| []) == (1 :| []) :| []
--   
inits1 :: NonEmpty a -> NonEmpty (NonEmpty a)

-- | The tails function takes a stream xs and returns all
--   the suffixes of xs, starting with the longest. The result is
--   NonEmpty because the result always contains the empty list as
--   the last element.
--   
--   
--   tails [1,2,3] == [1,2,3] :| [[2,3], [3], []]
--   tails [1] == [1] :| [[]]
--   tails [] == [] :| []
--   
tails :: Foldable f => f a -> NonEmpty [a]

-- | The tails1 function takes a NonEmpty stream xs
--   and returns all the non-empty suffixes of xs, starting with
--   the longest.
--   
--   
--   tails1 (1 :| [2,3]) == (1 :| [2,3]) :| [2 :| [3], 3 :| []]
--   tails1 (1 :| []) == (1 :| []) :| []
--   
tails1 :: NonEmpty a -> NonEmpty (NonEmpty a)

-- | iterate f x produces the infinite sequence of repeated
--   applications of f to x.
--   
--   
--   iterate f x = x :| [f x, f (f x), ..]
--   
iterate :: (a -> a) -> a -> NonEmpty a

-- | repeat x returns a constant stream, where all elements
--   are equal to x.
repeat :: a -> NonEmpty a

-- | cycle xs returns the infinite repetition of
--   xs:
--   
--   
--   cycle (1 :| [2,3]) = 1 :| [2,3,1,2,3,...]
--   
cycle :: NonEmpty a -> NonEmpty a

-- | unfold produces a new stream by repeatedly applying the
--   unfolding function to the seed value to produce an element of type
--   b and a new seed value. When the unfolding function returns
--   Nothing instead of a new seed value, the stream ends.
unfold :: (a -> (b, Maybe a)) -> a -> NonEmpty b

-- | insert x xs inserts x into the last position
--   in xs where it is still less than or equal to the next
--   element. In particular, if the list is sorted beforehand, the result
--   will also be sorted.
insert :: (Foldable f, Ord a) => a -> f a -> NonEmpty a

-- | some1 x sequences x one or more times.
some1 :: Alternative f => f a -> f (NonEmpty a)

-- | take n xs returns the first n elements of
--   xs.
take :: Int -> NonEmpty a -> [a]

-- | drop n xs drops the first n elements off the
--   front of the sequence xs.
drop :: Int -> NonEmpty a -> [a]

-- | splitAt n xs returns a pair consisting of the prefix
--   of xs of length n and the remaining stream
--   immediately following this prefix.
--   
--   
--   'splitAt' n xs == ('take' n xs, 'drop' n xs)
--   xs == ys ++ zs where (ys, zs) = 'splitAt' n xs
--   
splitAt :: Int -> NonEmpty a -> ([a], [a])

-- | takeWhile p xs returns the longest prefix of the
--   stream xs for which the predicate p holds.
takeWhile :: (a -> Bool) -> NonEmpty a -> [a]

-- | dropWhile p xs returns the suffix remaining after
--   takeWhile p xs.
dropWhile :: (a -> Bool) -> NonEmpty a -> [a]

-- | span p xs returns the longest prefix of xs
--   that satisfies p, together with the remainder of the stream.
--   
--   
--   'span' p xs == ('takeWhile' p xs, 'dropWhile' p xs)
--   xs == ys ++ zs where (ys, zs) = 'span' p xs
--   
span :: (a -> Bool) -> NonEmpty a -> ([a], [a])

-- | The break p function is equivalent to span
--   (not . p).
break :: (a -> Bool) -> NonEmpty a -> ([a], [a])

-- | filter p xs removes any elements from xs that
--   do not satisfy p.
filter :: (a -> Bool) -> NonEmpty a -> [a]

-- | The partition function takes a predicate p and a
--   stream xs, and returns a pair of lists. The first list
--   corresponds to the elements of xs for which p holds;
--   the second corresponds to the elements of xs for which
--   p does not hold.
--   
--   
--   'partition' p xs = ('filter' p xs, 'filter' (not . p) xs)
--   
partition :: (a -> Bool) -> NonEmpty a -> ([a], [a])

-- | The group function takes a stream and returns a list of streams
--   such that flattening the resulting list is equal to the argument.
--   Moreover, each stream in the resulting list contains only equal
--   elements. For example, in list notation:
--   
--   
--   'group' $ 'cycle' "Mississippi"
--     = "M" : "i" : "ss" : "i" : "ss" : "i" : "pp" : "i" : "M" : "i" : ...
--   
group :: (Foldable f, Eq a) => f a -> [NonEmpty a]

-- | groupBy operates like group, but uses the provided
--   equality predicate instead of ==.
groupBy :: Foldable f => (a -> a -> Bool) -> f a -> [NonEmpty a]

-- | groupWith operates like group, but uses the provided
--   projection when comparing for equality
groupWith :: (Foldable f, Eq b) => (a -> b) -> f a -> [NonEmpty a]

-- | groupAllWith operates like groupWith, but sorts the list
--   first so that each equivalence class has, at most, one list in the
--   output
groupAllWith :: Ord b => (a -> b) -> [a] -> [NonEmpty a]

-- | group1 operates like group, but uses the knowledge that
--   its input is non-empty to produce guaranteed non-empty output.
group1 :: Eq a => NonEmpty a -> NonEmpty (NonEmpty a)

-- | groupBy1 is to group1 as groupBy is to
--   group.
groupBy1 :: (a -> a -> Bool) -> NonEmpty a -> NonEmpty (NonEmpty a)

-- | groupWith1 is to group1 as groupWith is to
--   group
groupWith1 :: Eq b => (a -> b) -> NonEmpty a -> NonEmpty (NonEmpty a)

-- | groupAllWith1 is to groupWith1 as groupAllWith is
--   to groupWith
groupAllWith1 :: Ord b => (a -> b) -> NonEmpty a -> NonEmpty (NonEmpty a)

-- | The isPrefixOf function returns True if the first
--   argument is a prefix of the second.
isPrefixOf :: Eq a => [a] -> NonEmpty a -> Bool

-- | The nub function removes duplicate elements from a list. In
--   particular, it keeps only the first occurrence of each element. (The
--   name nub means 'essence'.) It is a special case of
--   nubBy, which allows the programmer to supply their own
--   inequality test.
nub :: Eq a => NonEmpty a -> NonEmpty a

-- | The nubBy function behaves just like nub, except it uses
--   a user-supplied equality predicate instead of the overloaded ==
--   function.
nubBy :: (a -> a -> Bool) -> NonEmpty a -> NonEmpty a

-- | xs !! n returns the element of the stream xs at
--   index n. Note that the head of the stream has index 0.
--   
--   Beware: a negative or out-of-bounds index will cause an error.
(!!) :: HasCallStack => NonEmpty a -> Int -> a
infixl 9 !!

-- | The zip function takes two streams and returns a stream of
--   corresponding pairs.
zip :: NonEmpty a -> NonEmpty b -> NonEmpty (a, b)

-- | The zipWith function generalizes zip. Rather than
--   tupling the elements, the elements are combined using the function
--   passed as the first argument.
zipWith :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c

-- | The unzip function is the inverse of the zip function.
unzip :: Functor f => f (a, b) -> (f a, f b)

-- | Converts a normal list to a NonEmpty stream.
--   
--   Raises an error if given an empty list.
fromList :: HasCallStack => [a] -> NonEmpty a

-- | Convert a stream to a normal list efficiently.
toList :: NonEmpty a -> [a]

-- | nonEmpty efficiently turns a normal list into a NonEmpty
--   stream, producing Nothing if the input is empty.
nonEmpty :: [a] -> Maybe (NonEmpty a)

-- | Compute n-ary logic exclusive OR operation on NonEmpty list.
xor :: NonEmpty Bool -> Bool

-- | Reexports Data.List.NonEmpty.Compat from a globally unique
--   namespace.
module Data.List.NonEmpty.Compat.Repl.Batteries

module Data.Monoid.Compat

-- | Boolean monoid under disjunction (||).
--   
--   
--   Any x <> Any y = Any (x || y)
--   
--   
--   
Examples
--   
--   
--   >>> Any True <> mempty <> Any False
--   Any {getAny = True}
--   
--   
--   
--   >>> mconcat (map (\x -> Any (even x)) [2,4,6,7,8])
--   Any {getAny = True}
--   
--   
--   
--   >>> Any False <> mempty
--   Any {getAny = False}
--   
newtype () => Any
Any :: Bool -> Any
[getAny] :: Any -> Bool

-- | Monoid under addition.
--   
--   
--   Sum a <> Sum b = Sum (a + b)
--   
--   
--   
Examples
--   
--   
--   >>> Sum 1 <> Sum 2 <> mempty
--   Sum {getSum = 3}
--   
--   
--   
--   >>> mconcat [ Sum n | n <- [3 .. 9]]
--   Sum {getSum = 42}
--   
newtype () => Sum a
Sum :: a -> Sum a
[getSum] :: Sum a -> a

-- | Monoid under multiplication.
--   
--   
--   Product x <> Product y == Product (x * y)
--   
--   
--   
Examples
--   
--   
--   >>> Product 3 <> Product 4 <> mempty
--   Product {getProduct = 12}
--   
--   
--   
--   >>> mconcat [ Product n | n <- [2 .. 10]]
--   Product {getProduct = 3628800}
--   
newtype () => Product a
Product :: a -> Product a
[getProduct] :: Product a -> a

-- | Maybe monoid returning the rightmost non-Nothing value.
--   
--   Last a is isomorphic to Dual (First
--   a), and thus to Dual (Alt Maybe a)
--   
--   Data.Semigroup.Last. The former returns the last
--   non-Nothing, so x <> Data.Monoid.Last Nothing =
--   x. The latter simply returns the last value, thus x <>
--   Data.Semigroup.Last Nothing = Data.Semigroup.Last Nothing.
--   
--   
Examples
--   
--   
--   >>> Last (Just "hello") <> Last Nothing <> Last (Just "world")
--   Last {getLast = Just "world"}
--   
--   
--   
--   >>> Last Nothing <> mempty
--   Last {getLast = Nothing}
--   
newtype () => Last a
Last :: Maybe a -> Last a
[getLast] :: Last a -> Maybe a

-- | Maybe monoid returning the leftmost non-Nothing value.
--   
--   First a is isomorphic to Alt Maybe
--   a, but precedes it historically.
--   
--   Beware that Data.Monoid.First is different from
--   Data.Semigroup.First. The former returns the first
--   non-Nothing, so Data.Monoid.First Nothing <> x =
--   x. The latter simply returns the first value, thus
--   Data.Semigroup.First Nothing <> x = Data.Semigroup.First
--   Nothing.
--   
--   
Examples
--   
--   
--   >>> First (Just "hello") <> First Nothing <> First (Just "world")
--   First {getFirst = Just "hello"}
--   
--   
--   
--   >>> First Nothing <> mempty
--   First {getFirst = Nothing}
--   
newtype () => First a
First :: Maybe a -> First a
[getFirst] :: First a -> Maybe a

-- | The class of monoids (types with an associative binary operation that
--   has an identity). Instances should satisfy the following:
--   
--   
--   
- Right identity x <> mempty =
--   x
--   
- Left identity mempty <> x =
--   x
--   
- Associativity x <> (y <> z) =
--   (x <> y) <> z (Semigroup
--   law)
--   
- Concatenation mconcat = foldr
--   (<>) mempty
--   
--   
--   You can alternatively define mconcat instead of mempty,
--   in which case the laws are:
--   
--   
--   
- Unit mconcat (pure x) = x
--   
- Multiplication mconcat (join xss) =
--   mconcat (fmap mconcat xss)
--   
- Subclass mconcat (toList xs) =
--   sconcat xs
--   
--   
--   The method names refer to the monoid of lists under concatenation, but
--   there are many other instances.
--   
--   Some types can be viewed as a monoid in more than one way, e.g. both
--   addition and multiplication on numbers. In such cases we often define
--   newtypes and make those instances of Monoid, e.g.
--   Sum and Product.
--   
--   NOTE: Semigroup is a superclass of Monoid since
--   base-4.11.0.0.
class Semigroup a => Monoid a

-- | Identity of mappend
--   
--   
Examples
--   
--   
--   >>> "Hello world" <> mempty
--   "Hello world"
--   
--   
--   
--   >>> mempty <> [1, 2, 3]
--   [1,2,3]
--   
mempty :: Monoid a => a

-- | An associative operation
--   
--   NOTE: This method is redundant and has the default
--   implementation mappend = (<>) since
--   base-4.11.0.0. Should it be implemented manually, since
--   mappend is a synonym for (<>), it is expected that
--   the two functions are defined the same way. In a future GHC release
--   mappend will be removed from Monoid.
mappend :: Monoid a => a -> a -> a

-- | Fold a list using the monoid.
--   
--   For most types, the default definition for mconcat will be
--   used, but the function is included in the class definition so that an
--   optimized version can be provided for specific types.
--   
--   
--   >>> mconcat ["Hello", " ", "Haskell", "!"]
--   "Hello Haskell!"
--   
mconcat :: Monoid a => [a] -> a

-- | Monoid under <|>.
--   
--   
--   Alt l <> Alt r == Alt (l <|> r)
--   
--   
--   
Examples
--   
--   
--   >>> Alt (Just 12) <> Alt (Just 24)
--   Alt {getAlt = Just 12}
--   
--   
--   
--   >>> Alt Nothing <> Alt (Just 24)
--   Alt {getAlt = Just 24}
--   
newtype () => Alt (f :: k -> Type) (a :: k)
Alt :: f a -> Alt (f :: k -> Type) (a :: k)
[getAlt] :: Alt (f :: k -> Type) (a :: k) -> f a

-- | Boolean monoid under conjunction (&&).
--   
--   
--   All x <> All y = All (x && y)
--   
--   
--   
Examples
--   
--   
--   >>> All True <> mempty <> All False)
--   All {getAll = False}
--   
--   
--   
--   >>> mconcat (map (\x -> All (even x)) [2,4,6,7,8])
--   All {getAll = False}
--   
--   
--   
--   >>> All True <> mempty
--   All {getAll = True}
--   
newtype () => All
All :: Bool -> All
[getAll] :: All -> Bool

-- | The monoid of endomorphisms under composition.
--   
--   
--   Endo f <> Endo g == Endo (f . g)
--   
--   
--   
Examples
--   
--   
--   >>> let computation = Endo ("Hello, " ++) <> Endo (++ "!")
--   
--   >>> appEndo computation "Haskell"
--   "Hello, Haskell!"
--   
--   
--   
--   >>> let computation = Endo (*3) <> Endo (+1)
--   
--   >>> appEndo computation 1
--   6
--   
newtype () => Endo a
Endo :: (a -> a) -> Endo a
[appEndo] :: Endo a -> a -> a

-- | The dual of a Monoid, obtained by swapping the arguments of
--   mappend. | The dual of a Monoid, obtained by swapping
--   the arguments of (<>).
--   
--   
--   Dual a <> Dual b == Dual (b <> a)
--   
--   
--   
Examples
--   
--   
--   >>> Dual "Hello" <> Dual "World"
--   Dual {getDual = "WorldHello"}
--   
--   
--   
--   >>> Dual (Dual "Hello") <> Dual (Dual "World")
--   Dual {getDual = Dual {getDual = "HelloWorld"}}
--   
newtype () => Dual a
Dual :: a -> Dual a
[getDual] :: Dual a -> a

-- | This data type witnesses the lifting of a Monoid into an
--   Applicative pointwise.
--   
--   
Examples
--   
--   
--   >>> Ap (Just [1, 2, 3]) <> Ap Nothing
--   Ap {getAp = Nothing}
--   
--   
--   
--   >>> Ap [Sum 10, Sum 20] <> Ap [Sum 1, Sum 2]
--   Ap {getAp = [Sum {getSum = 11},Sum {getSum = 12},Sum {getSum = 21},Sum {getSum = 22}]}
--   
newtype () => Ap (f :: k -> Type) (a :: k)
Ap :: f a -> Ap (f :: k -> Type) (a :: k)
[getAp] :: Ap (f :: k -> Type) (a :: k) -> f a

-- | An associative operation.
--   
--   
Examples
--   
--   
--   >>> [1,2,3] <> [4,5,6]
--   [1,2,3,4,5,6]
--   
--   
--   
--   >>> Just [1, 2, 3] <> Just [4, 5, 6]
--   Just [1,2,3,4,5,6]
--   
--   
--   
--   >>> putStr "Hello, " <> putStrLn "World!"
--   Hello, World!
--   
(<>) :: Semigroup a => a -> a -> a
infixr 6 <>

-- | Reexports Data.Monoid.Compat from a globally unique namespace.
module Data.Monoid.Compat.Repl.Batteries

module Data.Proxy.Compat

-- | Reexports Data.Proxy.Compat from a globally unique namespace.
module Data.Proxy.Compat.Repl.Batteries

module Data.Ratio.Compat

-- | Reexports Data.Ratio.Compat from a globally unique namespace.
module Data.Ratio.Compat.Repl.Batteries

module Data.STRef.Compat

-- | Reexports Data.STRef.Compat from a globally unique namespace.
module Data.STRef.Compat.Repl.Batteries

module Data.Semigroup.Compat

-- | The class of semigroups (types with an associative binary operation).
--   
--   Instances should satisfy the following:
--   
--   
--   
- Associativity x <> (y <> z) =
--   (x <> y) <> z
--   
--   
--   You can alternatively define sconcat instead of
--   (<>), in which case the laws are:
--   
--   
--   
- Unit sconcat (pure x) = x
--   
- Multiplication sconcat (join xss) =
--   sconcat (fmap sconcat xss)
--   
class () => Semigroup a

-- | An associative operation.
--   
--   
Examples
--   
--   
--   >>> [1,2,3] <> [4,5,6]
--   [1,2,3,4,5,6]
--   
--   
--   
--   >>> Just [1, 2, 3] <> Just [4, 5, 6]
--   Just [1,2,3,4,5,6]
--   
--   
--   
--   >>> putStr "Hello, " <> putStrLn "World!"
--   Hello, World!
--   
(<>) :: Semigroup a => a -> a -> a

-- | Reduce a non-empty list with <>
--   
--   The default definition should be sufficient, but this can be
--   overridden for efficiency.
--   
--   
Examples
--   
--   For the following examples, we will assume that we have:
--   
--   
--   >>> import Data.List.NonEmpty (NonEmpty (..))
--   
--   
--   
--   >>> sconcat $ "Hello" :| [" ", "Haskell", "!"]
--   "Hello Haskell!"
--   
--   
--   
--   >>> sconcat $ Just [1, 2, 3] :| [Nothing, Just [4, 5, 6]]
--   Just [1,2,3,4,5,6]
--   
--   
--   
--   >>> sconcat $ Left 1 :| [Right 2, Left 3, Right 4]
--   Right 2
--   
sconcat :: Semigroup a => NonEmpty a -> a

-- | Repeat a value n times.
--   
--   The default definition will raise an exception for a multiplier that
--   is <= 0. This may be overridden with an implementation
--   that is total. For monoids it is preferred to use
--   stimesMonoid.
--   
--   By making this a member of the class, idempotent semigroups and
--   monoids can upgrade this to execute in <math> by picking
--   stimes = stimesIdempotent or stimes =
--   stimesIdempotentMonoid respectively.
--   
--   
Examples
--   
--   
--   >>> stimes 4 [1]
--   [1,1,1,1]
--   
--   
--   
--   >>> stimes 5 (putStr "hi!")
--   hi!hi!hi!hi!hi!
--   
--   
--   
--   >>> stimes 3 (Right ":)")
--   Right ":)"
--   
stimes :: (Semigroup a, Integral b) => b -> a -> a
infixr 6 <>

-- | This is a valid definition of stimes for a Monoid.
--   
--   Unlike the default definition of stimes, it is defined for 0
--   and so it should be preferred where possible.
stimesMonoid :: (Integral b, Monoid a) => b -> a -> a

-- | This is a valid definition of stimes for an idempotent
--   Semigroup.
--   
--   When x <> x = x, this definition should be preferred,
--   because it works in <math> rather than <math>.
stimesIdempotent :: Integral b => b -> a -> a

-- | This is a valid definition of stimes for an idempotent
--   Monoid.
--   
--   When x <> x = x, this definition should be preferred,
--   because it works in <math> rather than <math>
stimesIdempotentMonoid :: (Integral b, Monoid a) => b -> a -> a

-- | Repeat a value n times.
--   
--   
--   mtimesDefault n a = a <> a <> ... <> a  -- using <> (n-1) times
--   
--   
--   In many cases, stimes 0 a for a Monoid will
--   produce mempty. However, there are situations when it cannot do
--   so. In particular, the following situation is fairly common:
--   
--   
--   data T a = ...
--   
--   class Constraint1 a
--   class Constraint1 a => Constraint2 a
--   
--   
--   
--   instance Constraint1 a => Semigroup (T a)
--   instance Constraint2 a => Monoid (T a)
--   
--   
--   Since Constraint1 is insufficient to implement mempty,
--   stimes for T a cannot do so.
--   
--   When working with such a type, or when working polymorphically with
--   Semigroup instances, mtimesDefault should be used when
--   the multiplier might be zero. It is implemented using stimes
--   when the multiplier is nonzero and mempty when it is zero.
--   
--   
Examples
--   
--   
--   >>> mtimesDefault 0 "bark"
--   []
--   
--   
--   
--   >>> mtimesDefault 3 "meow"
--   "meowmeowmeow"
--   
mtimesDefault :: (Integral b, Monoid a) => b -> a -> a

-- | The Min Monoid and Semigroup always choose the
--   smaller element as by the Ord instance and min of the
--   contained type.
--   
--   
Examples
--   
--   
--   >>> Min 42 <> Min 3
--   Min 3
--   
--   
--   
--   >>> sconcat $ Min 1 :| [ Min n | n <- [2 .. 100]]
--   Min {getMin = 1}
--   
newtype () => Min a
Min :: a -> Min a
[getMin] :: Min a -> a

-- | The Max Monoid and Semigroup always choose the
--   bigger element as by the Ord instance and max of the
--   contained type.
--   
--   
Examples
--   
--   
--   >>> Max 42 <> Max 3
--   Max 42
--   
--   
--   
--   >>> sconcat $ Max 1 :| [ Max n | n <- [2 .. 100]]
--   Max {getMax = 100}
--   
newtype () => Max a
Max :: a -> Max a
[getMax] :: Max a -> a

-- | Beware that Data.Semigroup.First is different from
--   Data.Monoid.First. The former simply returns the first
--   value, so Data.Semigroup.First Nothing <> x =
--   Data.Semigroup.First Nothing. The latter returns the first
--   non-Nothing, thus Data.Monoid.First Nothing <> x =
--   x.
--   
--   
Examples
--   
--   
--   >>> First 0 <> First 10
--   First 0
--   
--   
--   
--   >>> sconcat $ First 1 :| [ First n | n <- [2 ..] ]
--   First 1
--   
newtype () => First a
First :: a -> First a
[getFirst] :: First a -> a

-- | Beware that Data.Semigroup.Last is different from
--   Data.Monoid.Last. The former simply returns the last
--   value, so x <> Data.Semigroup.Last Nothing =
--   Data.Semigroup.Last Nothing. The latter returns the last
--   non-Nothing, thus x <> Data.Monoid.Last Nothing =
--   x.
--   
--   
Examples
--   
--   
--   >>> Last 0 <> Last 10
--   Last {getLast = 10}
--   
--   
--   
--   >>> sconcat $ Last 1 :| [ Last n | n <- [2..]]
--   Last {getLast = * hangs forever *
--   
newtype () => Last a
Last :: a -> Last a
[getLast] :: Last a -> a

-- | Provide a Semigroup for an arbitrary Monoid.
--   
--   NOTE: This is not needed anymore since Semigroup became
--   a superclass of Monoid in base-4.11 and this newtype be
--   deprecated at some point in the future.
newtype () => WrappedMonoid m
WrapMonoid :: m -> WrappedMonoid m
[unwrapMonoid] :: WrappedMonoid m -> m

-- | The dual of a Monoid, obtained by swapping the arguments of
--   mappend. | The dual of a Monoid, obtained by swapping
--   the arguments of (<>).
--   
--   
--   Dual a <> Dual b == Dual (b <> a)
--   
--   
--   
Examples
--   
--   
--   >>> Dual "Hello" <> Dual "World"
--   Dual {getDual = "WorldHello"}
--   
--   
--   
--   >>> Dual (Dual "Hello") <> Dual (Dual "World")
--   Dual {getDual = Dual {getDual = "HelloWorld"}}
--   
newtype () => Dual a
Dual :: a -> Dual a
[getDual] :: Dual a -> a

-- | The monoid of endomorphisms under composition.
--   
--   
--   Endo f <> Endo g == Endo (f . g)
--   
--   
--   
Examples
--   
--   
--   >>> let computation = Endo ("Hello, " ++) <> Endo (++ "!")
--   
--   >>> appEndo computation "Haskell"
--   "Hello, Haskell!"
--   
--   
--   
--   >>> let computation = Endo (*3) <> Endo (+1)
--   
--   >>> appEndo computation 1
--   6
--   
newtype () => Endo a
Endo :: (a -> a) -> Endo a
[appEndo] :: Endo a -> a -> a

-- | Boolean monoid under conjunction (&&).
--   
--   
--   All x <> All y = All (x && y)
--   
--   
--   
Examples
--   
--   
--   >>> All True <> mempty <> All False)
--   All {getAll = False}
--   
--   
--   
--   >>> mconcat (map (\x -> All (even x)) [2,4,6,7,8])
--   All {getAll = False}
--   
--   
--   
--   >>> All True <> mempty
--   All {getAll = True}
--   
newtype () => All
All :: Bool -> All
[getAll] :: All -> Bool

-- | Boolean monoid under disjunction (||).
--   
--   
--   Any x <> Any y = Any (x || y)
--   
--   
--   
Examples
--   
--   
--   >>> Any True <> mempty <> Any False
--   Any {getAny = True}
--   
--   
--   
--   >>> mconcat (map (\x -> Any (even x)) [2,4,6,7,8])
--   Any {getAny = True}
--   
--   
--   
--   >>> Any False <> mempty
--   Any {getAny = False}
--   
newtype () => Any
Any :: Bool -> Any
[getAny] :: Any -> Bool

-- | Monoid under addition.
--   
--   
--   Sum a <> Sum b = Sum (a + b)
--   
--   
--   
Examples
--   
--   
--   >>> Sum 1 <> Sum 2 <> mempty
--   Sum {getSum = 3}
--   
--   
--   
--   >>> mconcat [ Sum n | n <- [3 .. 9]]
--   Sum {getSum = 42}
--   
newtype () => Sum a
Sum :: a -> Sum a
[getSum] :: Sum a -> a

-- | Monoid under multiplication.
--   
--   
--   Product x <> Product y == Product (x * y)
--   
--   
--   
Examples
--   
--   
--   >>> Product 3 <> Product 4 <> mempty
--   Product {getProduct = 12}
--   
--   
--   
--   >>> mconcat [ Product n | n <- [2 .. 10]]
--   Product {getProduct = 3628800}
--   
newtype () => Product a
Product :: a -> Product a
[getProduct] :: Product a -> a

-- | This lets you use a difference list of a Semigroup as a
--   Monoid.
--   
--   
Examples
--   
--   
--   let hello = diff "Hello, "
--   
--   
--   
--   >>> appEndo hello "World!"
--   "Hello, World!"
--   
--   
--   
--   >>> appEndo (hello <> mempty) "World!"
--   "Hello, World!"
--   
--   
--   
--   >>> appEndo (mempty <> hello) "World!"
--   "Hello, World!"
--   
--   
--   
--   let world = diff "World"
--   let excl = diff "!"
--   
--   
--   
--   >>> appEndo (hello <> (world <> excl)) mempty
--   "Hello, World!"
--   
--   
--   
--   >>> appEndo ((hello <> world) <> excl) mempty
--   "Hello, World!"
--   
diff :: Semigroup m => m -> Endo m

-- | A generalization of cycle to an arbitrary Semigroup. May
--   fail to terminate for some values in some semigroups.
--   
--   
Examples
--   
--   
--   >>> take 10 $ cycle1 [1, 2, 3]
--   [1,2,3,1,2,3,1,2,3,1]
--   
--   
--   
--   >>> cycle1 (Right 1)
--   Right 1
--   
--   
--   
--   >>> cycle1 (Left 1)
--   * hangs forever *
--   
cycle1 :: Semigroup m => m -> m

-- | Arg isn't itself a Semigroup in its own right, but it
--   can be placed inside Min and Max to compute an arg min
--   or arg max.
--   
--   
Examples
--   
--   
--   >>> minimum [ Arg (x * x) x | x <- [-10 .. 10] ]
--   Arg 0 0
--   
--   
--   
--   >>> maximum [ Arg (-0.2*x^2 + 1.5*x + 1) x | x <- [-10 .. 10] ]
--   Arg 3.8 4.0
--   
--   
--   
--   >>> minimum [ Arg (-0.2*x^2 + 1.5*x + 1) x | x <- [-10 .. 10] ]
--   Arg (-34.0) (-10.0)
--   
data () => Arg a b
Arg :: a -> b -> Arg a b

-- | 
Examples
--   
--   
--   >>> Min (Arg 0 ()) <> Min (Arg 1 ())
--   Min {getMin = Arg 0 ()}
--   
--   
--   
--   >>> minimum [ Arg (length name) name | name <- ["violencia", "lea", "pixie"]]
--   Arg 3 "lea"
--   
type ArgMin a b = Min Arg a b

-- | 
Examples
--   
--   
--   >>> Max (Arg 0 ()) <> Max (Arg 1 ())
--   Max {getMax = Arg 1 ()}
--   
--   
--   
--   >>> maximum [ Arg (length name) name | name <- ["violencia", "lea", "pixie"]]
--   Arg 9 "violencia"
--   
type ArgMax a b = Max Arg a b

-- | Reexports Data.Semigroup.Compat from a globally unique
--   namespace.
module Data.Semigroup.Compat.Repl.Batteries

module Data.String.Compat

-- | Reexports Data.String.Compat from a globally unique namespace.
module Data.String.Compat.Repl.Batteries

module Data.Traversable.Compat

-- | Reexports Data.Traversable.Compat from a globally unique
--   namespace.
module Data.Traversable.Compat.Repl.Batteries

-- | This uses the OneTuple compatibility library to backport
--   Solo to old versions of GHC. Note that OneTuple makes
--   use of pattern synonyms, which cannot be defined on pre-7.8 versions
--   of GHC. As such, it is not feasible to backport the Solo data
--   constructor on pre-7.8 versions of GHC, as OneTuple defines
--   this as a pattern synonym.
module Data.Tuple.Compat

-- | Solo is the canonical lifted 1-tuple, just like (,)
--   is the canonical lifted 2-tuple (pair) and (,,) is the
--   canonical lifted 3-tuple (triple).
--   
--   The most important feature of Solo is that it is possible to
--   force its "outside" (usually by pattern matching) without forcing its
--   "inside", because it is defined as a datatype rather than a newtype.
--   One situation where this can be useful is when writing a function to
--   extract a value from a data structure. Suppose you write an
--   implementation of arrays and offer only this function to index into
--   them:
--   
--   
--   index :: Array a -> Int -> a
--   
--   
--   Now imagine that someone wants to extract a value from an array and
--   store it in a lazy-valued finite map/dictionary:
--   
--   
--   insert "hello" (arr index 12) m
--   
--   
--   This can actually lead to a space leak. The value is not actually
--   extracted from the array until that value (now buried in a map) is
--   forced. That means the entire array may be kept live by just that
--   value! Often, the solution is to use a strict map, or to force the
--   value before storing it, but for some purposes that's undesirable.
--   
--   One common solution is to include an indexing function that can
--   produce its result in an arbitrary Applicative context:
--   
--   
--   indexA :: Applicative f => Array a -> Int -> f a
--   
--   
--   When using indexA in a pure context, Solo
--   serves as a handy Applicative functor to hold the result. You
--   could write a non-leaky version of the above example thus:
--   
--   
--   case arr indexA 12 of
--     Solo a -> insert "hello" a m
--   
--   
--   While such simple extraction functions are the most common uses for
--   unary tuples, they can also be useful for fine-grained control of
--   strict-spined data structure traversals, and for unifying the
--   implementations of lazy and strict mapping functions.
data () => Solo a
MkSolo :: a -> Solo a
pattern Solo :: a -> Solo a
getSolo :: Solo a -> a

-- | Extract the first component of a pair.
fst :: (a, b) -> a

-- | Extract the second component of a pair.
snd :: (a, b) -> b

-- | curry converts an uncurried function to a curried function.
--   
--   
Examples
--   
--   
--   >>> curry fst 1 2
--   1
--   
curry :: ((a, b) -> c) -> a -> b -> c

-- | uncurry converts a curried function to a function on pairs.
--   
--   
Examples
--   
--   
--   >>> uncurry (+) (1,2)
--   3
--   
--   
--   
--   >>> uncurry ($) (show, 1)
--   "1"
--   
--   
--   
--   >>> map (uncurry max) [(1,2), (3,4), (6,8)]
--   [2,4,8]
--   
uncurry :: (a -> b -> c) -> (a, b) -> c

-- | Swap the components of a pair.
swap :: (a, b) -> (b, a)

-- | Reexports Data.Tuple.Compat from a globally unique namespace.
module Data.Tuple.Compat.Repl.Batteries

module Data.Type.Coercion.Compat

-- | Reexports Data.Type.Coercion.Compat from a globally unique
--   namespace.
module Data.Type.Coercion.Compat.Repl.Batteries

module Data.Type.Equality.Compat

-- | Propositional equality. If a :~: b is inhabited by some
--   terminating value, then the type a is the same as the type
--   b. To use this equality in practice, pattern-match on the
--   a :~: b to get out the Refl constructor; in the body
--   of the pattern-match, the compiler knows that a ~ b.
data () => (a :: k) :~: (b :: k)
[Refl] :: forall {k} (a :: k). a :~: a
infix 4 :~:

-- | Lifted, heterogeneous equality. By lifted, we mean that it can be
--   bogus (deferred type error). By heterogeneous, the two types
--   a and b might have different kinds. Because
--   ~~ can appear unexpectedly in error messages to users who do
--   not care about the difference between heterogeneous equality
--   ~~ and homogeneous equality ~, this is printed as
--   ~ unless -fprint-equality-relations is set.
--   
--   In 0.7.0, the fixity was set to infix 4 to match the
--   fixity of :~~:.
class a ~# b => (a :: k0) ~~ (b :: k1)
infix 4 ~~

-- | Kind heterogeneous propositional equality. Like :~:, a :~~:
--   b is inhabited by a terminating value if and only if a
--   is the same type as b.
data () => (a :: k1) :~~: (b :: k2)
[HRefl] :: forall {k1} (a :: k1). a :~~: a
infix 4 :~~:

-- | Symmetry of equality
sym :: forall {k} (a :: k) (b :: k). (a :~: b) -> b :~: a

-- | Transitivity of equality
trans :: forall {k} (a :: k) (b :: k) (c :: k). (a :~: b) -> (b :~: c) -> a :~: c

-- | Type-safe cast, using propositional equality
castWith :: (a :~: b) -> a -> b

-- | Generalized form of type-safe cast using propositional equality
gcastWith :: forall {k} (a :: k) (b :: k) r. (a :~: b) -> (a ~ b => r) -> r

-- | Apply one equality to another, respectively
apply :: forall {k1} {k2} (f :: k1 -> k2) (g :: k1 -> k2) (a :: k1) (b :: k1). (f :~: g) -> (a :~: b) -> f a :~: g b

-- | Extract equality of the arguments from an equality of applied types
inner :: forall {k1} {k2} (f :: k1 -> k2) (a :: k1) (g :: k1 -> k2) (b :: k1). (f a :~: g b) -> a :~: b

-- | Extract equality of type constructors from an equality of applied
--   types
outer :: forall {k1} {k2} (f :: k1 -> k2) (a :: k1) (g :: k1 -> k2) (b :: k1). (f a :~: g b) -> f :~: g

-- | This class contains types where you can learn the equality of two
--   types from information contained in terms.
--   
--   The result should be Just Refl if and only if the types
--   applied to f are equal:
--   
--   
--   testEquality (x :: f a) (y :: f b) = Just Refl ⟺ a = b
--   
--   
--   Typically, only singleton types should inhabit this class. In that
--   case type argument equality coincides with term equality:
--   
--   
--   testEquality (x :: f a) (y :: f b) = Just Refl ⟺ a = b ⟺ x = y
--   
--   
--   
--   isJust (testEquality x y) = x == y
--   
--   
--   Singleton types are not required, however, and so the latter two
--   would-be laws are not in fact valid in general.
class () => TestEquality (f :: k -> Type)

-- | Conditionally prove the equality of a and b.
testEquality :: forall (a :: k) (b :: k). TestEquality f => f a -> f b -> Maybe (a :~: b)

-- | A type family to compute Boolean equality.
type family (a :: k) == (b :: k) :: Bool
infix 4 ==

-- | Reexports Data.Type.Equality.Compat from a globally unique
--   namespace.
module Data.Type.Equality.Compat.Repl.Batteries

module Data.Typeable.Compat

-- | Reexports Data.Typeable.Compat from a globally unique
--   namespace.
module Data.Typeable.Compat.Repl.Batteries

module Data.Version.Compat

-- | Reexports Data.Version.Compat from a globally unique namespace.
module Data.Version.Compat.Repl.Batteries

module Data.Void.Compat

-- | Uninhabited data type
data () => Void

-- | Since Void values logically don't exist, this witnesses the
--   logical reasoning tool of "ex falso quodlibet".
--   
--   
--   >>> let x :: Either Void Int; x = Right 5
--   
--   >>> :{
--   case x of
--       Right r -> r
--       Left l  -> absurd l
--   :}
--   5
--   
absurd :: Void -> a

-- | If Void is uninhabited then any Functor that holds only
--   values of type Void is holding no values. It is implemented in
--   terms of fmap absurd.
vacuous :: Functor f => f Void -> f a

-- | Reexports Data.Void.Compat from a globally unique namespace.
module Data.Void.Compat.Repl.Batteries

module Data.Word.Compat

-- | Reexports Data.Word.Compat from a globally unique namespace.
module Data.Word.Compat.Repl.Batteries

module Debug.Trace.Compat

-- | Reexports Debug.Trace.Compat from a globally unique namespace.
module Debug.Trace.Compat.Repl.Batteries

module Foreign.Compat

-- | Reexports Foreign.Compat from a globally unique namespace.
module Foreign.Compat.Repl.Batteries

module Foreign.ForeignPtr.Compat

-- | Reexports Foreign.ForeignPtr.Compat from a globally unique
--   namespace.
module Foreign.ForeignPtr.Compat.Repl.Batteries

module Foreign.ForeignPtr.Safe.Compat

-- | Reexports Foreign.ForeignPtr.Safe.Compat from a globally unique
--   namespace.
module Foreign.ForeignPtr.Safe.Compat.Repl.Batteries

module Foreign.ForeignPtr.Unsafe.Compat

-- | Reexports Foreign.ForeignPtr.Unsafe.Compat from a globally
--   unique namespace.
module Foreign.ForeignPtr.Unsafe.Compat.Repl.Batteries

module Foreign.Marshal.Alloc.Compat

-- | Reexports Foreign.Marshal.Alloc.Compat from a globally unique
--   namespace.
module Foreign.Marshal.Alloc.Compat.Repl.Batteries

module Foreign.Marshal.Array.Compat

-- | Reexports Foreign.Marshal.Array.Compat from a globally unique
--   namespace.
module Foreign.Marshal.Array.Compat.Repl.Batteries

module Foreign.Marshal.Compat

-- | Reexports Foreign.Marshal.Compat from a globally unique
--   namespace.
module Foreign.Marshal.Compat.Repl.Batteries

module Foreign.Marshal.Safe.Compat

-- | Reexports Foreign.Marshal.Safe.Compat from a globally unique
--   namespace.
module Foreign.Marshal.Safe.Compat.Repl.Batteries

module Foreign.Marshal.Unsafe.Compat

-- | Reexports Foreign.Marshal.Unsafe.Compat from a globally unique
--   namespace.
module Foreign.Marshal.Unsafe.Compat.Repl.Batteries

module Foreign.Marshal.Utils.Compat

-- | Reexports Foreign.Marshal.Utils.Compat from a globally unique
--   namespace.
module Foreign.Marshal.Utils.Compat.Repl.Batteries

module Numeric.Compat

-- | Reexports Numeric.Compat from a globally unique namespace.
module Numeric.Compat.Repl.Batteries

module Numeric.Natural.Compat

-- | Natural subtraction. Returns Nothings for non-positive
--   results.
minusNaturalMaybe :: Natural -> Natural -> Maybe Natural

-- | Reexports Numeric.Natural.Compat from a globally unique
--   namespace.
module Numeric.Natural.Compat.Repl.Batteries

module Prelude.Compat

-- | Reexports Prelude.Compat from a globally unique namespace.
module Prelude.Compat.Repl.Batteries

module System.Environment.Compat

-- | Reexports System.Environment.Compat from a globally unique
--   namespace.
module System.Environment.Compat.Repl.Batteries

module System.Exit.Compat

-- | Reexports System.Exit.Compat from a globally unique namespace.
module System.Exit.Compat.Repl.Batteries

module System.IO.Compat

-- | Reexports System.IO.Compat from a globally unique namespace.
module System.IO.Compat.Repl.Batteries

module System.IO.Error.Compat

-- | Reexports System.IO.Error.Compat from a globally unique
--   namespace.
module System.IO.Error.Compat.Repl.Batteries

module System.IO.Unsafe.Compat

-- | Reexports System.IO.Unsafe.Compat from a globally unique
--   namespace.
module System.IO.Unsafe.Compat.Repl.Batteries

module Text.Read.Compat

-- | Reexports Text.Read.Compat from a globally unique namespace.
module Text.Read.Compat.Repl.Batteries

module Text.Read.Lex.Compat

-- | Reexports Text.Read.Lex.Compat from a globally unique
--   namespace.
module Text.Read.Lex.Compat.Repl.Batteries

module Type.Reflection.Compat

-- | Reexports Type.Reflection.Compat from a globally unique
--   namespace.
module Type.Reflection.Compat.Repl.Batteries
