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

-- | A standard library for Haskell
--   
--   See README and Haddocks at https://www.stackage.org/package/rio
@package rio
@version 0.1.18.0

-- | Lazy ByteString partial functions. Import as:
--   
--   
--   import qualified RIO.ByteString.Lazy.Partial as BL'
--   
module RIO.ByteString.Lazy.Partial
head :: ByteString -> Word8
last :: ByteString -> Word8
tail :: ByteString -> ByteString
init :: ByteString -> ByteString
foldl1 :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8
foldl1' :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8
foldr1 :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8
maximum :: ByteString -> Word8
minimum :: ByteString -> Word8

-- | Strict ByteString partial functions. Import as:
--   
--   
--   import qualified RIO.ByteString.Partial as B'
--   
module RIO.ByteString.Partial
head :: ByteString -> Word8
last :: ByteString -> Word8
tail :: ByteString -> ByteString
init :: ByteString -> ByteString
foldl1 :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8
foldl1' :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8
foldr1 :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8
foldr1' :: (Word8 -> Word8 -> Word8) -> ByteString -> Word8
maximum :: ByteString -> Word8
minimum :: ByteString -> Word8

-- | Unicode Char. Import as:
--   
--   
--   import qualified RIO.Char as C
--   
--   
--   This module does not export any partial functions. For those, see
--   RIO.Char.Partial
module RIO.Char
data Char
isControl :: Char -> Bool
isSpace :: Char -> Bool
isLower :: Char -> Bool
isUpper :: Char -> Bool
isAlpha :: Char -> Bool
isAlphaNum :: Char -> Bool
isPrint :: Char -> Bool
isDigit :: Char -> Bool
isOctDigit :: Char -> Bool
isHexDigit :: Char -> Bool
isLetter :: Char -> Bool
isMark :: Char -> Bool
isNumber :: Char -> Bool
isPunctuation :: Char -> Bool
isSymbol :: Char -> Bool
isSeparator :: Char -> Bool
isAscii :: Char -> Bool
isLatin1 :: Char -> Bool
isAsciiUpper :: Char -> Bool
isAsciiLower :: Char -> Bool
data GeneralCategory
UppercaseLetter :: GeneralCategory
LowercaseLetter :: GeneralCategory
TitlecaseLetter :: GeneralCategory
ModifierLetter :: GeneralCategory
OtherLetter :: GeneralCategory
NonSpacingMark :: GeneralCategory
SpacingCombiningMark :: GeneralCategory
EnclosingMark :: GeneralCategory
DecimalNumber :: GeneralCategory
LetterNumber :: GeneralCategory
OtherNumber :: GeneralCategory
ConnectorPunctuation :: GeneralCategory
DashPunctuation :: GeneralCategory
OpenPunctuation :: GeneralCategory
ClosePunctuation :: GeneralCategory
InitialQuote :: GeneralCategory
FinalQuote :: GeneralCategory
OtherPunctuation :: GeneralCategory
MathSymbol :: GeneralCategory
CurrencySymbol :: GeneralCategory
ModifierSymbol :: GeneralCategory
OtherSymbol :: GeneralCategory
Space :: GeneralCategory
LineSeparator :: GeneralCategory
ParagraphSeparator :: GeneralCategory
Control :: GeneralCategory
Format :: GeneralCategory
Surrogate :: GeneralCategory
PrivateUse :: GeneralCategory
NotAssigned :: GeneralCategory
generalCategory :: Char -> GeneralCategory
toUpper :: Char -> Char
toLower :: Char -> Char
toTitle :: Char -> Char
ord :: Char -> Int
showLitChar :: Char -> ShowS
lexLitChar :: ReadS String
readLitChar :: ReadS Char

-- | Unicode Char partial functions. Import as:
--   
--   
--   import qualified RIO.Char.Partial as C'
--   
module RIO.Char.Partial
digitToInt :: Char -> Int
intToDigit :: Int -> Char
chr :: Int -> Char

module RIO.Directory

-- | 
Rationale
--   
--   This module offers functions to handle files that offer better
--   durability and/or atomicity.
--   
--   See UnliftIO.IO.File for the rationale behind this module,
--   since all of the functions were moved upstream and are now simply
--   re-exported from here.
module RIO.File

-- | Unlifted version of withBinaryFile.
withBinaryFile :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m a) -> m a

-- | Lifted version of writeFile
writeBinaryFile :: MonadIO m => FilePath -> ByteString -> m ()

-- | Perform an action on a new or existing file at the destination file
--   path. If previously the file existed at the supplied file path then:
--   
--   
--   
- in case of WriteMode it will be overwritten
--   
- upon ReadWriteMode or AppendMode files contents will
--   be copied over into a temporary file, thus making sure no corruption
--   can happen to an existing file upon any failures, even catastrophic
--   one, yet its contents are availble for modification.
--   
- There is nothing atomic about ReadMode, so no special
--   treatment there.
--   
--   
--   It is similar to withBinaryFileDurableAtomic, but without the
--   durability part. It means that all modification can still disappear
--   after it has been succesfully written due to some extreme event like
--   an abrupt power loss, but the contents will not be corrupted in case
--   when the file write did not end successfully.
--   
--   The same performance caveats apply as for
--   withBinaryFileDurableAtomic due to making a copy of the content
--   of existing files during non-truncating writes.
--   
--   Important - Do not close the handle, otherwise it will result
--   in invalid argument (Bad file descriptor) exception
--   
--   Note - on Linux operating system and only with supported file
--   systems an anonymous temporary file will be used while working on the
--   file (see O_TMPFILE in man openat). In case when
--   such feature is not available or not supported a temporary file
--   ".target-file-nameXXX.ext.tmp", where XXX is some random number, will
--   be created alongside the target file in the same directory
withBinaryFileAtomic :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m r) -> m r

-- | Same as writeBinaryFileDurableAtomic, except it does not
--   guarantee durability.
--   
--   
Cross-Platform support
--   
--   This function behaves the same as writeBinaryFile on Windows
--   platforms.
writeBinaryFileAtomic :: MonadIO m => FilePath -> ByteString -> m ()

-- | Opens a file with the following guarantees:
--   
--   
--   
- It successfully closes the file in case of an asynchronous
--   exception
--   
- It reliably saves the file in the correct directory; including
--   edge case situations like a different device being mounted to the
--   current directory, or the current directory being renamed to some
--   other name while the file is being used.
--   
- It ensures durability by executing an fsync() call before
--   closing the file handle
--   
--   
--   
Cross-Platform support
--   
--   This function behaves the same as withBinaryFile on Windows
--   platforms.
withBinaryFileDurable :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m r) -> m r

-- | Similar to writeBinaryFile, but it also ensures that changes
--   executed to the file are guaranteed to be durable. It internally uses
--   fsync() and makes sure it synchronizes the file on disk.
--   
--   
Cross-Platform support
--   
--   This function behaves the same as writeBinaryFile on Windows
--   platforms.
writeBinaryFileDurable :: MonadIO m => FilePath -> ByteString -> m ()

-- | After a file is closed, this function opens it again and executes
--   fsync() internally on both the file and the directory that
--   contains it. Note that this function is intended to work around the
--   non-durability of existing file APIs, as opposed to being necessary
--   for the API functions provided in this module.
--   
--   The effectiveness of calling this function is debatable, as it
--   relies on internal implementation details at the Kernel level that
--   might change. We argue that, despite this fact, calling this function
--   may bring benefits in terms of durability.
--   
--   This function does not provide the same guarantee as if you would open
--   and modify a file using withBinaryFileDurable or
--   writeBinaryFileDurable, since they ensure that the
--   fsync() is called before the file is closed, so if possible
--   use those instead.
--   
--   
Cross-Platform support
--   
--   This function is a noop on Windows platforms.
ensureFileDurable :: MonadIO m => FilePath -> m ()

-- | Opens a file with the following guarantees:
--   
--   
--   
- It successfully closes the file in case of an asynchronous
--   exception
--   
- It reliably saves the file in the correct directory; including
--   edge case situations like a different device being mounted to the
--   current directory, or the current directory being renamed to some
--   other name while the file is being used.
--   
- It ensures durability by executing an fsync() call before
--   closing the file handle
--   
- It keeps all changes in a temporary file, and after it is closed
--   it atomically moves the temporary file to the original filepath, in
--   case of catastrophic failure, the original file stays unaffected.
--   
--   
--   If you do not need durability but only atomicity, use
--   withBinaryFileAtomic instead, which is faster as it does not
--   perform fsync().
--   
--   Important - Make sure not to close the Handle, it will
--   be closed for you, otherwise it will result in invalid argument
--   (Bad file descriptor) exception.
--   
--   
Performance Considerations
--   
--   When using a writable but non-truncating IOMode (i.e.
--   ReadWriteMode and AppendMode), this function performs a
--   copy operation of the specified input file to guarantee the original
--   file is intact in case of a catastrophic failure (no partial writes).
--   This approach may be prohibitive in scenarios where the input file is
--   expected to be large in size.
--   
--   
Cross-Platform support
--   
--   This function behaves the same as withBinaryFile on Windows
--   platforms.
withBinaryFileDurableAtomic :: MonadUnliftIO m => FilePath -> IOMode -> (Handle -> m r) -> m r

-- | Similar to writeBinaryFile, but it also guarantes that changes
--   executed to the file are durable, also, in case of failure, the
--   modified file is never going to get corrupted. It internally uses
--   fsync() and makes sure it synchronizes the file on disk.
--   
--   
Cross-Platform support
--   
--   This function behaves the same as writeBinaryFile on Windows
--   platforms.
writeBinaryFileDurableAtomic :: MonadIO m => FilePath -> ByteString -> m ()

module RIO.FilePath
type FilePath = String
(-<.>) :: FilePath -> String -> FilePath
(<.>) :: FilePath -> String -> FilePath
(</>) :: FilePath -> FilePath -> FilePath
addExtension :: FilePath -> String -> FilePath
addTrailingPathSeparator :: FilePath -> FilePath
combine :: FilePath -> FilePath -> FilePath
dropDrive :: FilePath -> FilePath
dropExtension :: FilePath -> FilePath
dropExtensions :: FilePath -> FilePath
dropFileName :: FilePath -> FilePath
dropTrailingPathSeparator :: FilePath -> FilePath
equalFilePath :: FilePath -> FilePath -> Bool
extSeparator :: Char
hasDrive :: FilePath -> Bool
hasExtension :: FilePath -> Bool
hasTrailingPathSeparator :: FilePath -> Bool
isAbsolute :: FilePath -> Bool
isDrive :: FilePath -> Bool
isExtSeparator :: Char -> Bool
isExtensionOf :: String -> FilePath -> Bool
isPathSeparator :: Char -> Bool
isRelative :: FilePath -> Bool
isSearchPathSeparator :: Char -> Bool
isValid :: FilePath -> Bool
joinDrive :: FilePath -> FilePath -> FilePath
joinPath :: [FilePath] -> FilePath
makeRelative :: FilePath -> FilePath -> FilePath
makeValid :: FilePath -> FilePath
normalise :: FilePath -> FilePath
pathSeparator :: Char
pathSeparators :: [Char]
replaceBaseName :: FilePath -> String -> FilePath
replaceDirectory :: FilePath -> String -> FilePath
replaceExtension :: FilePath -> String -> FilePath
replaceExtensions :: FilePath -> String -> FilePath
replaceFileName :: FilePath -> String -> FilePath
searchPathSeparator :: Char
splitDirectories :: FilePath -> [FilePath]
splitDrive :: FilePath -> (FilePath, FilePath)
splitExtension :: FilePath -> (String, String)
splitExtensions :: FilePath -> (FilePath, String)
splitFileName :: FilePath -> (String, String)
splitPath :: FilePath -> [FilePath]
splitSearchPath :: String -> [FilePath]
stripExtension :: String -> FilePath -> Maybe FilePath
takeBaseName :: FilePath -> String
takeDirectory :: FilePath -> FilePath
takeDrive :: FilePath -> FilePath
takeExtension :: FilePath -> String
takeExtensions :: FilePath -> String
takeFileName :: FilePath -> FilePath

-- | Lifted version of getSearchPath
getSearchPath :: MonadIO m => m [FilePath]

-- | Strict Map with hashed keys. Import as:
--   
--   
--   import qualified RIO.HashMap as HM
--   
--   
--   This module does not export any partial functions. For those, see
--   RIO.HashMap.Partial
module RIO.HashMap

-- | A map from keys to values. A map cannot contain duplicate keys; each
--   key can map to at most one value.
data HashMap k v

-- | O(1) Construct an empty map.
empty :: HashMap k v

-- | O(1) Construct a map with a single element.
singleton :: Hashable k => k -> v -> HashMap k v

-- | O(1) Return True if this map is empty, False
--   otherwise.
null :: HashMap k v -> Bool

-- | O(n) Return the number of key-value mappings in this map.
size :: HashMap k v -> Int

-- | O(log n) Return True if the specified key is present in
--   the map, False otherwise.
member :: (Eq k, Hashable k) => k -> HashMap k a -> Bool

-- | O(log n) Return the value to which the specified key is mapped,
--   or Nothing if this map contains no mapping for the key.
lookup :: (Eq k, Hashable k) => k -> HashMap k v -> Maybe v

-- | O(log n) Return the value to which the specified key is mapped,
--   or the default value if this map contains no mapping for the key.
lookupDefault :: (Eq k, Hashable k) => v -> k -> HashMap k v -> v

-- | O(log n) Associate the specified value with the specified key
--   in this map. If this map previously contained a mapping for the key,
--   the old value is replaced.
insert :: (Eq k, Hashable k) => k -> v -> HashMap k v -> HashMap k v

-- | O(log n) Associate the value with the key in this map. If this
--   map previously contained a mapping for the key, the old value is
--   replaced by the result of applying the given function to the new and
--   old value. Example:
--   
--   
--   insertWith f k v map
--     where f new old = new + old
--   
insertWith :: (Eq k, Hashable k) => (v -> v -> v) -> k -> v -> HashMap k v -> HashMap k v

-- | O(log n) Remove the mapping for the specified key from this map
--   if present.
delete :: (Eq k, Hashable k) => k -> HashMap k v -> HashMap k v

-- | O(log n) Adjust the value tied to a given key in this map only
--   if it is present. Otherwise, leave the map alone.
adjust :: (Eq k, Hashable k) => (v -> v) -> k -> HashMap k v -> HashMap k v

-- | O(log n) The expression (update f k map)
--   updates the value x at k, (if it is in the map). If
--   (f k x) is Nothing, the element is deleted. If it is
--   (Just y), the key k is bound to the new value y.
update :: (Eq k, Hashable k) => (a -> Maybe a) -> k -> HashMap k a -> HashMap k a

-- | O(log n) The expression (alter f k map) alters
--   the value x at k, or absence thereof. alter
--   can be used to insert, delete, or update a value in a map. In short :
--   lookup k (alter f k m) = f (lookup k m).
alter :: (Eq k, Hashable k) => (Maybe v -> Maybe v) -> k -> HashMap k v -> HashMap k v

-- | O(n+m) The union of two maps. If a key occurs in both maps, the
--   mapping from the first will be the mapping in the result.
union :: (Eq k, Hashable k) => HashMap k v -> HashMap k v -> HashMap k v

-- | O(n+m) The union of two maps. If a key occurs in both maps, the
--   provided function (first argument) will be used to compute the result.
unionWith :: (Eq k, Hashable k) => (v -> v -> v) -> HashMap k v -> HashMap k v -> HashMap k v

-- | O(n+m) The union of two maps. If a key occurs in both maps, the
--   provided function (first argument) will be used to compute the result.
unionWithKey :: (Eq k, Hashable k) => (k -> v -> v -> v) -> HashMap k v -> HashMap k v -> HashMap k v

-- | Construct a set containing all elements from a list of sets.
unions :: (Eq k, Hashable k) => [HashMap k v] -> HashMap k v

-- | O(n) Transform this map by applying a function to every value.
map :: (v1 -> v2) -> HashMap k v1 -> HashMap k v2

-- | O(n) Transform this map by applying a function to every value.
mapWithKey :: (k -> v1 -> v2) -> HashMap k v1 -> HashMap k v2

-- | O(n) Perform an Applicative action for each key-value
--   pair in a HashMap and produce a HashMap of all the
--   results. Each HashMap will be strict in all its values.
--   
--   
--   traverseWithKey f = fmap (map id) . Data.HashMap.Lazy.traverseWithKey f
--   
--   
--   Note: the order in which the actions occur is unspecified. In
--   particular, when the map contains hash collisions, the order in which
--   the actions associated with the keys involved will depend in an
--   unspecified way on their insertion order.
traverseWithKey :: Applicative f => (k -> v1 -> f v2) -> HashMap k v1 -> f (HashMap k v2)

-- | O(n*log m) Difference of two maps. Return elements of the first
--   map not existing in the second.
difference :: (Eq k, Hashable k) => HashMap k v -> HashMap k w -> HashMap k v

-- | O(n*log m) Difference with a combining function. When two equal
--   keys are encountered, the combining function is applied to the values
--   of these keys. If it returns Nothing, the element is discarded
--   (proper set difference). If it returns (Just y), the
--   element is updated with a new value y.
differenceWith :: (Eq k, Hashable k) => (v -> w -> Maybe v) -> HashMap k v -> HashMap k w -> HashMap k v

-- | O(n*log m) Intersection of two maps. Return elements of the
--   first map for keys existing in the second.
intersection :: (Eq k, Hashable k) => HashMap k v -> HashMap k w -> HashMap k v

-- | O(n+m) Intersection of two maps. If a key occurs in both maps
--   the provided function is used to combine the values from the two maps.
intersectionWith :: (Eq k, Hashable k) => (v1 -> v2 -> v3) -> HashMap k v1 -> HashMap k v2 -> HashMap k v3

-- | O(n+m) Intersection of two maps. If a key occurs in both maps
--   the provided function is used to combine the values from the two maps.
intersectionWithKey :: (Eq k, Hashable k) => (k -> v1 -> v2 -> v3) -> HashMap k v1 -> HashMap k v2 -> HashMap k v3

-- | O(n) Reduce this map by applying a binary operator to all
--   elements, using the given starting value (typically the left-identity
--   of the operator). Each application of the operator is evaluated before
--   using the result in the next application. This function is strict in
--   the starting value.
foldl' :: (a -> v -> a) -> a -> HashMap k v -> a

-- | O(n) Reduce this map by applying a binary operator to all
--   elements, using the given starting value (typically the left-identity
--   of the operator). Each application of the operator is evaluated before
--   using the result in the next application. This function is strict in
--   the starting value.
foldlWithKey' :: (a -> k -> v -> a) -> a -> HashMap k v -> a

-- | O(n) Reduce this map by applying a binary operator to all
--   elements, using the given starting value (typically the right-identity
--   of the operator).
foldr :: (v -> a -> a) -> a -> HashMap k v -> a

-- | O(n) Reduce this map by applying a binary operator to all
--   elements, using the given starting value (typically the right-identity
--   of the operator).
foldrWithKey :: (k -> v -> a -> a) -> a -> HashMap k v -> a

-- | O(n) Filter this map by retaining only elements which values
--   satisfy a predicate.
filter :: (v -> Bool) -> HashMap k v -> HashMap k v

-- | O(n) Filter this map by retaining only elements satisfying a
--   predicate.
filterWithKey :: (k -> v -> Bool) -> HashMap k v -> HashMap k v

-- | O(n) Transform this map by applying a function to every value
--   and retaining only some of them.
mapMaybe :: (v1 -> Maybe v2) -> HashMap k v1 -> HashMap k v2

-- | O(n) Transform this map by applying a function to every value
--   and retaining only some of them.
mapMaybeWithKey :: (k -> v1 -> Maybe v2) -> HashMap k v1 -> HashMap k v2

-- | O(n) Return a list of this map's keys. The list is produced
--   lazily.
keys :: HashMap k v -> [k]

-- | O(n) Return a list of this map's values. The list is produced
--   lazily.
elems :: HashMap k v -> [v]

-- | O(n) Return a list of this map's elements. The list is produced
--   lazily. The order of its elements is unspecified.
toList :: HashMap k v -> [(k, v)]

-- | O(n*log n) Construct a map with the supplied mappings. If the
--   list contains duplicate mappings, the later mappings take precedence.
fromList :: (Eq k, Hashable k) => [(k, v)] -> HashMap k v

-- | O(n*log n) Construct a map from a list of elements. Uses the
--   provided function f to merge duplicate entries (f newVal oldVal).
--   
--   For example:
--   
--   
--   fromListWith (+) [ (x, 1) | x <- xs ]
--   
--   
--   will create a map with number of occurrences of each element in xs.
--   
--   
--   fromListWith (++) [ (k, [v]) | (k, v) <- xs ]
--   
--   
--   will group all values by their keys in a list 'xs :: [(k, v)]' and
--   return a 'HashMap k [v]'.
fromListWith :: (Eq k, Hashable k) => (v -> v -> v) -> [(k, v)] -> HashMap k v

-- | Strict HashMap partial functions. Import as:
--   
--   
--   import qualified RIO.HashMap.Partial as HM'
--   
module RIO.HashMap.Partial

-- | O(log n) Return the value to which the specified key is mapped.
--   Calls error if this map contains no mapping for the key.
(!) :: (Eq k, Hashable k) => HashMap k v -> k -> v
infixl 9 !

-- | Set with hashed members. Import as:
--   
--   
--   import qualified RIO.HashSet as HS
--   
module RIO.HashSet

-- | A set of values. A set cannot contain duplicate values.
data HashSet a

-- | O(1) Construct an empty set.
empty :: HashSet a

-- | O(1) Construct a set with a single element.
singleton :: Hashable a => a -> HashSet a

-- | O(n+m) Construct a set containing all elements from both sets.
--   
--   To obtain good performance, the smaller set must be presented as the
--   first argument.
union :: (Eq a, Hashable a) => HashSet a -> HashSet a -> HashSet a

-- | Construct a set containing all elements from a list of sets.
unions :: (Eq a, Hashable a) => [HashSet a] -> HashSet a

-- | O(1) Return True if this set is empty, False
--   otherwise.
null :: HashSet a -> Bool

-- | O(n) Return the number of elements in this set.
size :: HashSet a -> Int

-- | O(log n) Return True if the given value is present in
--   this set, False otherwise.
member :: (Eq a, Hashable a) => a -> HashSet a -> Bool

-- | O(log n) Add the specified value to this set.
insert :: (Eq a, Hashable a) => a -> HashSet a -> HashSet a

-- | O(log n) Remove the specified value from this set if present.
delete :: (Eq a, Hashable a) => a -> HashSet a -> HashSet a

-- | O(n) Transform this set by applying a function to every value.
--   The resulting set may be smaller than the source.
map :: (Hashable b, Eq b) => (a -> b) -> HashSet a -> HashSet b

-- | O(n) Difference of two sets. Return elements of the first set
--   not existing in the second.
difference :: (Eq a, Hashable a) => HashSet a -> HashSet a -> HashSet a

-- | O(n) Intersection of two sets. Return elements present in both
--   the first set and the second.
intersection :: (Eq a, Hashable a) => HashSet a -> HashSet a -> HashSet a

-- | O(n) Reduce this set by applying a binary operator to all
--   elements, using the given starting value (typically the left-identity
--   of the operator). Each application of the operator is evaluated before
--   before using the result in the next application. This function is
--   strict in the starting value.
foldl' :: (a -> b -> a) -> a -> HashSet b -> a

-- | O(n) Reduce this set by applying a binary operator to all
--   elements, using the given starting value (typically the right-identity
--   of the operator).
foldr :: (b -> a -> a) -> a -> HashSet b -> a

-- | O(n) Filter this set by retaining only elements satisfying a
--   predicate.
filter :: (a -> Bool) -> HashSet a -> HashSet a

-- | O(n) Return a list of this set's elements. The list is produced
--   lazily.
toList :: HashSet a -> [a]

-- | O(n*min(W, n)) Construct a set from a list of elements.
fromList :: (Eq a, Hashable a) => [a] -> HashSet a

-- | O(1) Convert to the equivalent HashMap.
toMap :: HashSet a -> HashMap a ()

-- | O(1) Convert from the equivalent HashMap.
fromMap :: HashMap a () -> HashSet a

-- | Extra utilities from microlens.
--   
--   @since: 0.1.16.0
module RIO.Lens

-- | A SimpleFold s a extracts several as from
--   s; so, it's pretty much the same thing as (s ->
--   [a]), but you can use it with lens operators.
--   
--   The actual Fold from lens is more general:
--   
--   
--   type Fold s a =
--     forall f. (Contravariant f, Applicative f) => (a -> f a) -> s -> f s
--   
--   
--   There are several functions in lens that accept lens's Fold
--   but won't accept SimpleFold; I'm aware of
--   takingWhile, droppingWhile,
--   backwards, foldByOf,
--   foldMapByOf. For this reason, try not to export
--   SimpleFolds if at all possible. microlens-contra
--   provides a fully lens-compatible Fold.
--   
--   Lens users: you can convert a SimpleFold to Fold by
--   applying folded . toListOf to it.
type SimpleFold s a = forall r. Monoid r => Getting r s a

-- | toListOf is a synonym for (^..).
toListOf :: Getting (Endo [a]) s a -> s -> [a]

-- | has checks whether a getter (any getter, including lenses,
--   traversals, and folds) returns at least 1 value.
--   
--   Checking whether a list is non-empty:
--   
--   
--   >>> has each []
--   False
--   
--   
--   You can also use it with e.g. _Left (and other 0-or-1
--   traversals) as a replacement for isNothing, isJust and
--   other isConstructorName functions:
--   
--   
--   >>> has _Left (Left 1)
--   True
--   
has :: Getting Any s a -> s -> Bool

-- | Gives access to the 1st field of a tuple (up to 5-tuples).
--   
--   Getting the 1st component:
--   
--   
--   >>> (1,2,3,4,5) ^. _1
--   1
--   
--   
--   Setting the 1st component:
--   
--   
--   >>> (1,2,3) & _1 .~ 10
--   (10,2,3)
--   
--   
--   Note that this lens is lazy, and can set fields even of
--   undefined:
--   
--   
--   >>> set _1 10 undefined :: (Int, Int)
--   (10,*** Exception: Prelude.undefined
--   
--   
--   This is done to avoid violating a lens law stating that you can get
--   back what you put:
--   
--   
--   >>> view _1 . set _1 10 $ (undefined :: (Int, Int))
--   10
--   
--   
--   The implementation (for 2-tuples) is:
--   
--   
--   _1 f t = (,) <$> f    (fst t)
--                <*> pure (snd t)
--   
--   
--   or, alternatively,
--   
--   
--   _1 f ~(a,b) = (\a' -> (a',b)) <$> f a
--   
--   
--   (where ~ means a lazy pattern).
--   
--   _2, _3, _4, and _5 are also available (see
--   below).
_1 :: Field1 s t a b => Lens s t a b
_2 :: Field2 s t a b => Lens s t a b
_3 :: Field3 s t a b => Lens s t a b
_4 :: Field4 s t a b => Lens s t a b
_5 :: Field5 s t a b => Lens s t a b

-- | This lens lets you read, write, or delete elements in
--   Map-like structures. It returns Nothing when the value
--   isn't found, just like lookup:
--   
--   
--   Data.Map.lookup k m = m ^. at k
--   
--   
--   However, it also lets you insert and delete values by setting the
--   value to Just value or Nothing:
--   
--   
--   Data.Map.insert k a m = m & at k .~ Just a
--   
--   Data.Map.delete k m = m & at k .~ Nothing
--   
--   
--   Or you could use (?~) instead of (.~):
--   
--   
--   Data.Map.insert k a m = m & at k ?~ a
--   
--   
--   Note that at doesn't work for arrays or lists. You can't delete
--   an arbitrary element from an array (what would be left in its place?),
--   and you can't set an arbitrary element in a list because if the index
--   is out of list's bounds, you'd have to somehow fill the stretch
--   between the last element and the element you just inserted (i.e.
--   [1,2,3] & at 10 .~ 5 is undefined). If you want to modify
--   an already existing value in an array or list, you should use
--   ix instead.
--   
--   at is often used with non. See the documentation of
--   non for examples.
--   
--   Note that at isn't strict for Map, even if you're
--   using Data.Map.Strict:
--   
--   
--   >>> Data.Map.Strict.size (Data.Map.Strict.empty & at 1 .~ Just undefined)
--   1
--   
--   
--   The reason for such behavior is that there's actually no “strict
--   Map” type; Data.Map.Strict just provides some strict
--   functions for ordinary Maps.
--   
--   This package doesn't actually provide any instances for at, but
--   there are instances for Map and IntMap in
--   microlens-ghc and an instance for HashMap in
--   microlens-platform.
at :: At m => Index m -> Lens' m (Maybe (IxValue m))

-- | lens creates a Lens from a getter and a setter. The
--   resulting lens isn't the most effective one (because of having to
--   traverse the structure twice when modifying), but it shouldn't matter
--   much.
--   
--   A (partial) lens for list indexing:
--   
--   
--   ix :: Int -> Lens' [a] a
--   ix i = lens (!! i)                                   -- getter
--               (\s b -> take i s ++ b : drop (i+1) s)   -- setter
--   
--   
--   Usage:
--   
--   
--   >>> [1..9] ^. ix 3
--   4
--   
--   >>> [1..9] & ix 3 %~ negate
--   [1,2,3,-4,5,6,7,8,9]
--   
--   
--   When getting, the setter is completely unused; when setting, the
--   getter is unused. Both are used only when the value is being modified.
--   For instance, here we define a lens for the 1st element of a list, but
--   instead of a legitimate getter we use undefined. Then we use
--   the resulting lens for setting and it works, which proves that
--   the getter wasn't used:
--   
--   
--   >>> [1,2,3] & lens undefined (\s b -> b : tail s) .~ 10
--   [10,2,3]
--   
lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b

-- | non lets you “relabel” a Maybe by equating
--   Nothing to an arbitrary value (which you can choose):
--   
--   
--   >>> Just 1 ^. non 0
--   1
--   
--   
--   
--   >>> Nothing ^. non 0
--   0
--   
--   
--   The most useful thing about non is that relabeling also works
--   in other direction. If you try to set the “forbidden” value,
--   it'll be turned to Nothing:
--   
--   
--   >>> Just 1 & non 0 .~ 0
--   Nothing
--   
--   
--   Setting anything else works just fine:
--   
--   
--   >>> Just 1 & non 0 .~ 5
--   Just 5
--   
--   
--   Same happens if you try to modify a value:
--   
--   
--   >>> Just 1 & non 0 %~ subtract 1
--   Nothing
--   
--   
--   
--   >>> Just 1 & non 0 %~ (+ 1)
--   Just 2
--   
--   
--   non is often useful when combined with at. For instance,
--   if you have a map of songs and their playcounts, it makes sense not to
--   store songs with 0 plays in the map; non can act as a filter
--   that wouldn't pass such entries.
--   
--   Decrease playcount of a song to 0, and it'll be gone:
--   
--   
--   >>> fromList [("Soon",1),("Yesterday",3)] & at "Soon" . non 0 %~ subtract 1
--   fromList [("Yesterday",3)]
--   
--   
--   Try to add a song with 0 plays, and it won't be added:
--   
--   
--   >>> fromList [("Yesterday",3)] & at "Soon" . non 0 .~ 0
--   fromList [("Yesterday",3)]
--   
--   
--   But it will be added if you set any other number:
--   
--   
--   >>> fromList [("Yesterday",3)] & at "Soon" . non 0 .~ 1
--   fromList [("Soon",1),("Yesterday",3)]
--   
--   
--   non is also useful when working with nested maps. Here a nested
--   map is created when it's missing:
--   
--   
--   >>> Map.empty & at "Dez Mona" . non Map.empty . at "Soon" .~ Just 1
--   fromList [("Dez Mona",fromList [("Soon",1)])]
--   
--   
--   and here it is deleted when its last entry is deleted (notice that
--   non is used twice here):
--   
--   
--   >>> fromList [("Dez Mona",fromList [("Soon",1)])] & at "Dez Mona" . non Map.empty . at "Soon" . non 0 %~ subtract 1
--   fromList []
--   
--   
--   To understand the last example better, observe the flow of values in
--   it:
--   
--   
--   
- the map goes into at "Dez Mona"
--   
- the nested map (wrapped into Just) goes into non
--   Map.empty
--   
- Just is unwrapped and the nested map goes into at
--   "Soon"
--   
- Just 1 is unwrapped by non 0
--   
--   
--   Then the final value – i.e. 1 – is modified by subtract 1 and
--   the result (which is 0) starts flowing backwards:
--   
--   
--   
- non 0 sees the 0 and produces a Nothing
--   
- at "Soon" sees Nothing and deletes the
--   corresponding value from the map
--   
- the resulting empty map is passed to non Map.empty, which
--   sees that it's empty and thus produces Nothing
--   
- at "Dez Mona" sees Nothing and removes the key
--   from the map
--   
non :: Eq a => a -> Lens' (Maybe a) a

-- | singular turns a traversal into a lens that behaves like a
--   single-element traversal:
--   
--   
--   >>> [1,2,3] ^. singular each
--   1
--   
--   
--   
--   >>> [1,2,3] & singular each %~ negate
--   [-1,2,3]
--   
--   
--   If there is nothing to return, it'll throw an error:
--   
--   
--   >>> [] ^. singular each
--   *** Exception: Lens.Micro.singular: empty traversal
--   
--   
--   However, it won't fail if you are merely setting the value:
--   
--   
--   >>> [] & singular each %~ negate
--   
singular :: HasCallStack => Traversal s t a a -> Lens s t a a

-- | failing lets you chain traversals together; if the 1st
--   traversal fails, the 2nd traversal will be used.
--   
--   
--   >>> ([1,2],[3]) & failing (_1.each) (_2.each) .~ 0
--   ([0,0],[3])
--   
--   
--   
--   >>> ([],[3]) & failing (_1.each) (_2.each) .~ 0
--   ([],[0])
--   
--   
--   Note that the resulting traversal won't be valid unless either both
--   traversals don't touch each others' elements, or both traversals
--   return exactly the same results. To see an example of how
--   failing can generate invalid traversals, see this
--   Stackoverflow question.
failing :: Traversal s t a b -> Traversal s t a b -> Traversal s t a b
infixl 5 `failing`

-- | filtered is a traversal that filters elements “passing” through
--   it:
--   
--   
--   >>> (1,2,3,4) ^.. each
--   [1,2,3,4]
--   
--   
--   
--   >>> (1,2,3,4) ^.. each . filtered even
--   [2,4]
--   
--   
--   It also can be used to modify elements selectively:
--   
--   
--   >>> (1,2,3,4) & each . filtered even %~ (*100)
--   (1,200,3,400)
--   
--   
--   The implementation of filtered is very simple. Consider this
--   traversal, which always “traverses” just the value it's given:
--   
--   
--   id :: Traversal' a a
--   id f s = f s
--   
--   
--   And this traversal, which traverses nothing (in other words,
--   doesn't traverse the value it's given):
--   
--   
--   ignored :: Traversal' a a
--   ignored f s = pure s
--   
--   
--   And now combine them into a traversal that conditionally traverses the
--   value it's given, and you get filtered:
--   
--   
--   filtered :: (a -> Bool) -> Traversal' a a
--   filtered p f s = if p s then f s else pure s
--   
--   
--   By the way, note that filtered can generate illegal traversals
--   – sometimes this can bite you. In particular, an optimisation that
--   should be safe becomes unsafe. (To the best of my knowledge, this
--   optimisation never happens automatically. If you just use
--   filtered to modify/view something, you're safe. If you don't
--   define any traversals that use filtered, you're safe too.)
--   
--   Let's use evens as an example:
--   
--   
--   evens = filtered even
--   
--   
--   If evens was a legal traversal, you'd be able to fuse several
--   applications of evens like this:
--   
--   
--   over evens f . over evens g = over evens (f . g)
--   
--   
--   Unfortunately, in case of evens this isn't a correct
--   optimisation:
--   
--   
--   
- the left-side variant applies g to all even numbers, and
--   then applies f to all even numbers that are left after
--   f (because f might've turned some even numbers into
--   odd ones)
--   
- the right-side variant applies f and g to all
--   even numbers
--   
--   
--   Of course, when you are careful and know what you're doing, you won't
--   try to make such an optimisation. However, if you export an illegal
--   traversal created with filtered and someone tries to use it,
--   they might mistakenly assume that it's legal, do the optimisation, and
--   silently get an incorrect result.
--   
--   If you are using filtered with some another traversal that
--   doesn't overlap with -whatever the predicate checks-, the resulting
--   traversal will be legal. For instance, here the predicate looks at the
--   1st element of a tuple, but the resulting traversal only gives you
--   access to the 2nd:
--   
--   
--   pairedWithEvens :: Traversal [(Int, a)] [(Int, b)] a b
--   pairedWithEvens = each . filtered (even . fst) . _2
--   
--   
--   Since you can't do anything with the 1st components through this
--   traversal, the following holds for any f and g:
--   
--   
--   over pairedWithEvens f . over pairedWithEvens g = over pairedWithEvens (f . g)
--   
filtered :: (a -> Bool) -> Traversal' a a

-- | both traverses both fields of a tuple. Unlike
--   both from lens, it only works for pairs – not for
--   triples or Either.
--   
--   
--   >>> ("str","ing") ^. both
--   "string"
--   
--   
--   
--   >>> ("str","ing") & both %~ reverse
--   ("rts","gni")
--   
both :: Traversal (a, a) (b, b) a b

-- | traversed traverses any Traversable container (list,
--   vector, Map, Maybe, you name it):
--   
--   
--   >>> Just 1 ^.. traversed
--   [1]
--   
--   
--   traversed is the same as traverse, but can be faster
--   thanks to magic rewrite rules.
traversed :: forall (f :: Type -> Type) a b. Traversable f => Traversal (f a) (f b) a b

-- | each tries to be a universal Traversal – it behaves like
--   traversed in most situations, but also adds support for e.g.
--   tuples with same-typed values:
--   
--   
--   >>> (1,2) & each %~ succ
--   (2,3)
--   
--   
--   
--   >>> ["x", "y", "z"] ^. each
--   "xyz"
--   
--   
--   However, note that each doesn't work on every instance
--   of Traversable. If you have a Traversable which isn't
--   supported by each, you can use traversed instead.
--   Personally, I like using each instead of traversed
--   whenever possible – it's shorter and more descriptive.
--   
--   You can use each with these things:
--   
--   
--   each :: Traversal [a] [b] a b
--   
--   each :: Traversal (Maybe a) (Maybe b) a b
--   each :: Traversal (Either a a) (Either b b) a b  -- since 0.4.11
--   
--   each :: Traversal (a,a) (b,b) a b
--   each :: Traversal (a,a,a) (b,b,b) a b
--   each :: Traversal (a,a,a,a) (b,b,b,b) a b
--   each :: Traversal (a,a,a,a,a) (b,b,b,b,b) a b
--   
--   each :: (RealFloat a, RealFloat b) => Traversal (Complex a) (Complex b) a b
--   
--   
--   You can also use each with types from array,
--   bytestring, and containers by using
--   microlens-ghc, or additionally with types from vector,
--   text, and unordered-containers by using
--   microlens-platform.
each :: Each s t a b => Traversal s t a b

-- | This traversal lets you access (and update) an arbitrary element in a
--   list, array, Map, etc. (If you want to insert or delete
--   elements as well, look at at.)
--   
--   An example for lists:
--   
--   
--   >>> [0..5] & ix 3 .~ 10
--   [0,1,2,10,4,5]
--   
--   
--   You can use it for getting, too:
--   
--   
--   >>> [0..5] ^? ix 3
--   Just 3
--   
--   
--   Of course, the element may not be present (which means that you can
--   use ix as a safe variant of (!!)):
--   
--   
--   >>> [0..5] ^? ix 10
--   Nothing
--   
--   
--   Another useful instance is the one for functions – it lets you modify
--   their outputs for specific inputs. For instance, here's maximum
--   that returns 0 when the list is empty (instead of throwing an
--   exception):
--   
--   
--   maximum0 = maximum & ix [] .~ 0
--   
--   
--   The following instances are provided in this package:
--   
--   
--   ix :: Int -> Traversal' [a] a
--   
--   ix :: (Eq e) => e -> Traversal' (e -> a) a
--   
--   
--   You can also use ix with types from array,
--   bytestring, and containers by using
--   microlens-ghc, or additionally with types from vector,
--   text, and unordered-containers by using
--   microlens-platform.
ix :: Ixed m => Index m -> Traversal' m (IxValue m)

-- | _head traverses the 1st element of something (usually a list,
--   but can also be a Seq, etc):
--   
--   
--   >>> [1..5] ^? _head
--   Just 1
--   
--   
--   It can be used to modify too, as in this example where the 1st letter
--   of a sentence is capitalised:
--   
--   
--   >>> "mary had a little lamb." & _head %~ toTitle
--   "Mary had a little lamb."
--   
--   
--   The reason it's a traversal and not a lens is that there's nothing to
--   traverse when the list is empty:
--   
--   
--   >>> [] ^? _head
--   Nothing
--   
--   
--   This package only lets you use _head on lists, but if you use
--   microlens-ghc you get instances for ByteString and
--   Seq, and if you use microlens-platform you
--   additionally get instances for Text and Vector.
_head :: Cons s s a a => Traversal' s a

-- | _tail gives you access to the tail of a list (or Seq,
--   etc):
--   
--   
--   >>> [1..5] ^? _tail
--   Just [2,3,4,5]
--   
--   
--   You can modify the tail as well:
--   
--   
--   >>> [4,1,2,3] & _tail %~ reverse
--   [4,3,2,1]
--   
--   
--   Since lists are monoids, you can use _tail with plain
--   (^.) (and then it'll return an empty list if you give it an
--   empty list):
--   
--   
--   >>> [1..5] ^. _tail
--   [2,3,4,5]
--   
--   
--   
--   >>> [] ^. _tail
--   []
--   
--   
--   If you want to traverse each element of the tail, use
--   _tail with each:
--   
--   
--   >>> "I HATE CAPS." & _tail.each %~ toLower
--   "I hate caps."
--   
--   
--   This package only lets you use _tail on lists, but if you use
--   microlens-ghc you get instances for ByteString and
--   Seq, and if you use microlens-platform you
--   additionally get instances for Text and Vector.
_tail :: Cons s s a a => Traversal' s s

-- | _init gives you access to all-but-the-last elements of the
--   list:
--   
--   
--   >>> "Hello." ^. _init
--   "Hello"
--   
--   
--   See documentation for _tail, as _init and _tail
--   are pretty similar.
_init :: Snoc s s a a => Traversal' s s

-- | _last gives you access to the last element of the list:
--   
--   
--   >>> "Hello." ^? _last
--   '.'
--   
--   
--   See documentation for _head, as _last and _head
--   are pretty similar.
_last :: Snoc s s a a => Traversal' s a

-- | _Left targets the value contained in an Either, provided
--   it's a Left.
--   
--   Gathering all Lefts in a structure (like the lefts
--   function, but not necessarily just for lists):
--   
--   
--   >>> [Left 1, Right 'c', Left 3] ^.. each._Left
--   [1,3]
--   
--   
--   Checking whether an Either is a Left (like
--   isLeft):
--   
--   
--   >>> has _Left (Left 1)
--   True
--   
--   
--   
--   >>> has _Left (Right 1)
--   False
--   
--   
--   Extracting a value (if you're sure it's a Left):
--   
--   
--   >>> Left 1 ^?! _Left
--   1
--   
--   
--   Mapping over all Lefts:
--   
--   
--   >>> (each._Left %~ map toUpper) [Left "foo", Right "bar"]
--   [Left "FOO",Right "bar"]
--   
--   
--   Implementation:
--   
--   
--   _Left f (Left a)  = Left <$> f a
--   _Left _ (Right b) = pure (Right b)
--   
_Left :: Traversal (Either a b) (Either a' b) a a'

-- | _Right targets the value contained in an Either,
--   provided it's a Right.
--   
--   See documentation for _Left.
_Right :: Traversal (Either a b) (Either a b') b b'

-- | _Just targets the value contained in a Maybe, provided
--   it's a Just.
--   
--   See documentation for _Left (as these 2 are pretty similar). In
--   particular, it can be used to write these:
--   
--   
--   
- Unsafely extracting a value from a Just:
--   
--   
--   
--   fromJust = (^?! _Just)
--   
--   
--   
--   
--   
- Checking whether a value is a Just:
--   
--   
--   
--   isJust = has _Just
--   
--   
--   
--   
--   
- Converting a Maybe to a list (empty or consisting of a
--   single element):
--   
--   
--   
--   maybeToList = (^.. _Just)
--   
--   
--   
--   
--   
- Gathering all Justs in a list:
--   
--   
--   
--   catMaybes = (^.. each . _Just)
--   
--   
_Just :: Traversal (Maybe a) (Maybe a') a a'

-- | _Nothing targets a () if the Maybe is a
--   Nothing, and doesn't target anything otherwise:
--   
--   
--   >>> Just 1 ^.. _Nothing
--   []
--   
--   
--   
--   >>> Nothing ^.. _Nothing
--   [()]
--   
--   
--   It's not particularly useful (unless you want to use has
--   _Nothing as a replacement for isNothing), and
--   provided mainly for consistency.
--   
--   Implementation:
--   
--   
--   _Nothing f Nothing = const Nothing <$> f ()
--   _Nothing _ j       = pure j
--   
_Nothing :: Traversal' (Maybe a) ()

-- | List. Import as:
--   
--   
--   import qualified RIO.List as L
--   
--   
--   This module does not export any partial functions. For those, see
--   RIO.List.Partial
module RIO.List
(++) :: [a] -> [a] -> [a]
uncons :: [a] -> Maybe (a, [a])
null :: Foldable t => t a -> Bool
length :: Foldable t => t a -> Int

headMaybe :: [a] -> Maybe a

lastMaybe :: [a] -> Maybe a

tailMaybe :: [a] -> Maybe [a]

initMaybe :: [a] -> Maybe [a]
map :: (a -> b) -> [a] -> [b]
reverse :: [a] -> [a]
intersperse :: a -> [a] -> [a]
intercalate :: [a] -> [[a]] -> [a]
transpose :: [[a]] -> [[a]]
subsequences :: [a] -> [[a]]
permutations :: [a] -> [[a]]
foldl :: Foldable t => (b -> a -> b) -> b -> t a -> b
foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b
foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
concat :: Foldable t => t [a] -> [a]
concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
and :: Foldable t => t Bool -> Bool
or :: Foldable t => t Bool -> Bool
any :: Foldable t => (a -> Bool) -> t a -> Bool
all :: Foldable t => (a -> Bool) -> t a -> Bool
sum :: (Foldable t, Num a) => t a -> a
product :: (Foldable t, Num a) => t a -> a

maximumMaybe :: (Ord a, Foldable t) => t a -> Maybe a

minimumMaybe :: (Ord a, Foldable t) => t a -> Maybe a

maximumByMaybe :: Foldable t => (a -> a -> Ordering) -> t a -> Maybe a

minimumByMaybe :: Foldable t => (a -> a -> Ordering) -> t a -> Maybe a
scanl :: (b -> a -> b) -> b -> [a] -> [b]
scanl' :: (b -> a -> b) -> b -> [a] -> [b]
scanr :: (a -> b -> b) -> b -> [a] -> [b]
scanl1 :: (a -> a -> a) -> [a] -> [a]
scanr1 :: (a -> a -> a) -> [a] -> [a]
mapAccumL :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c)
mapAccumR :: Traversable t => (a -> b -> (a, c)) -> a -> t b -> (a, t c)
iterate :: (a -> a) -> a -> [a]
repeat :: a -> [a]
replicate :: Int -> a -> [a]
cycle :: [a] -> [a]
unfoldr :: (b -> Maybe (a, b)) -> b -> [a]
take :: Int -> [a] -> [a]
drop :: Int -> [a] -> [a]
splitAt :: Int -> [a] -> ([a], [a])
takeWhile :: (a -> Bool) -> [a] -> [a]
dropWhile :: (a -> Bool) -> [a] -> [a]
dropWhileEnd :: (a -> Bool) -> [a] -> [a]
span :: (a -> Bool) -> [a] -> ([a], [a])
break :: (a -> Bool) -> [a] -> ([a], [a])
stripPrefix :: Eq a => [a] -> [a] -> Maybe [a]

-- | Remove the suffix from the given list, if present
stripSuffix :: Eq a => [a] -> [a] -> Maybe [a]

-- | Drop prefix if present, otherwise return original list.
dropPrefix :: Eq a => [a] -> [a] -> [a]

-- | Drop prefix if present, otherwise return original list.
dropSuffix :: Eq a => [a] -> [a] -> [a]
group :: Eq a => [a] -> [[a]]
inits :: [a] -> [[a]]
tails :: [a] -> [[a]]
isPrefixOf :: Eq a => [a] -> [a] -> Bool
isSuffixOf :: Eq a => [a] -> [a] -> Bool
isInfixOf :: Eq a => [a] -> [a] -> Bool
isSubsequenceOf :: Eq a => [a] -> [a] -> Bool
elem :: (Foldable t, Eq a) => a -> t a -> Bool
notElem :: (Foldable t, Eq a) => a -> t a -> Bool
lookup :: Eq a => a -> [(a, b)] -> Maybe b
find :: Foldable t => (a -> Bool) -> t a -> Maybe a
filter :: (a -> Bool) -> [a] -> [a]
partition :: (a -> Bool) -> [a] -> ([a], [a])
elemIndex :: Eq a => a -> [a] -> Maybe Int
elemIndices :: Eq a => a -> [a] -> [Int]
findIndex :: (a -> Bool) -> [a] -> Maybe Int
findIndices :: (a -> Bool) -> [a] -> [Int]
zip :: [a] -> [b] -> [(a, b)]
zip3 :: [a] -> [b] -> [c] -> [(a, b, c)]
zip4 :: [a] -> [b] -> [c] -> [d] -> [(a, b, c, d)]
zip5 :: [a] -> [b] -> [c] -> [d] -> [e] -> [(a, b, c, d, e)]
zip6 :: [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [(a, b, c, d, e, f)]
zip7 :: [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g] -> [(a, b, c, d, e, f, g)]
zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
zipWith4 :: (a -> b -> c -> d -> e) -> [a] -> [b] -> [c] -> [d] -> [e]
zipWith5 :: (a -> b -> c -> d -> e -> f) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f]
zipWith6 :: (a -> b -> c -> d -> e -> f -> g) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g]
zipWith7 :: (a -> b -> c -> d -> e -> f -> g -> h) -> [a] -> [b] -> [c] -> [d] -> [e] -> [f] -> [g] -> [h]
unzip :: [(a, b)] -> ([a], [b])
unzip3 :: [(a, b, c)] -> ([a], [b], [c])
unzip4 :: [(a, b, c, d)] -> ([a], [b], [c], [d])
unzip5 :: [(a, b, c, d, e)] -> ([a], [b], [c], [d], [e])
unzip6 :: [(a, b, c, d, e, f)] -> ([a], [b], [c], [d], [e], [f])
unzip7 :: [(a, b, c, d, e, f, g)] -> ([a], [b], [c], [d], [e], [f], [g])
lines :: String -> [String]

-- | linesCR breaks a String up into a list of Strings
--   at newline Chars. It is very similar to lines, but it
--   also removes any trailing 'r' Chars. The resulting
--   String values do not contain newlines or trailing 'r'
--   characters.
linesCR :: String -> [String]
words :: String -> [String]
unlines :: [String] -> String
unwords :: [String] -> String
nub :: Eq a => [a] -> [a]
delete :: Eq a => a -> [a] -> [a]
(\\) :: Eq a => [a] -> [a] -> [a]
union :: Eq a => [a] -> [a] -> [a]
intersect :: Eq a => [a] -> [a] -> [a]
sort :: Ord a => [a] -> [a]
sortOn :: Ord b => (a -> b) -> [a] -> [a]
insert :: Ord a => a -> [a] -> [a]
nubBy :: (a -> a -> Bool) -> [a] -> [a]
deleteBy :: (a -> a -> Bool) -> a -> [a] -> [a]
deleteFirstsBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]
unionBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]
intersectBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]
groupBy :: (a -> a -> Bool) -> [a] -> [[a]]
sortBy :: (a -> a -> Ordering) -> [a] -> [a]
insertBy :: (a -> a -> Ordering) -> a -> [a] -> [a]
genericLength :: Num i => [a] -> i
genericTake :: Integral i => i -> [a] -> [a]
genericDrop :: Integral i => i -> [a] -> [a]
genericSplitAt :: Integral i => i -> [a] -> ([a], [a])
genericIndex :: Integral i => [a] -> i -> a
genericReplicate :: Integral i => i -> a -> [a]

-- | List partial functions. Import as:
--   
--   
--   import qualified RIO.List.Partial as L'
--   
module RIO.List.Partial
head :: [a] -> a
last :: [a] -> a
tail :: [a] -> [a]
init :: [a] -> [a]
foldl1 :: Foldable t => (a -> a -> a) -> t a -> a
foldl1' :: (a -> a -> a) -> [a] -> a
foldr1 :: Foldable t => (a -> a -> a) -> t a -> a
maximum :: (Foldable t, Ord a) => t a -> a
minimum :: (Foldable t, Ord a) => t a -> a
maximumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
minimumBy :: Foldable t => (a -> a -> Ordering) -> t a -> a
scanl1 :: (a -> a -> a) -> [a] -> [a]
scanr1 :: (a -> a -> a) -> [a] -> [a]
(!!) :: [a] -> Int -> a

-- | Strict Map. Import as:
--   
--   
--   import qualified RIO.Map as Map
--   
--   
--   This module does not export any partial or unchecked functions. For
--   those, see RIO.Map.Partial and RIO.Map.Unchecked
module RIO.Map
data Map k a
(!?) :: Ord k => Map k a -> k -> Maybe a
(\\) :: Ord k => Map k a -> Map k b -> Map k a
null :: Map k a -> Bool
size :: Map k a -> Int
member :: Ord k => k -> Map k a -> Bool
notMember :: Ord k => k -> Map k a -> Bool
lookup :: Ord k => k -> Map k a -> Maybe a
findWithDefault :: Ord k => a -> k -> Map k a -> a
lookupLT :: Ord k => k -> Map k v -> Maybe (k, v)
lookupGT :: Ord k => k -> Map k v -> Maybe (k, v)
lookupLE :: Ord k => k -> Map k v -> Maybe (k, v)
lookupGE :: Ord k => k -> Map k v -> Maybe (k, v)
empty :: Map k a
singleton :: k -> a -> Map k a
insert :: Ord k => k -> a -> Map k a -> Map k a
insertWith :: Ord k => (a -> a -> a) -> k -> a -> Map k a -> Map k a
insertWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> Map k a
insertLookupWithKey :: Ord k => (k -> a -> a -> a) -> k -> a -> Map k a -> (Maybe a, Map k a)
delete :: Ord k => k -> Map k a -> Map k a
adjust :: Ord k => (a -> a) -> k -> Map k a -> Map k a
adjustWithKey :: Ord k => (k -> a -> a) -> k -> Map k a -> Map k a
update :: Ord k => (a -> Maybe a) -> k -> Map k a -> Map k a
updateWithKey :: Ord k => (k -> a -> Maybe a) -> k -> Map k a -> Map k a
updateLookupWithKey :: Ord k => (k -> a -> Maybe a) -> k -> Map k a -> (Maybe a, Map k a)
alter :: Ord k => (Maybe a -> Maybe a) -> k -> Map k a -> Map k a
alterF :: (Functor f, Ord k) => (Maybe a -> f (Maybe a)) -> k -> Map k a -> f (Map k a)
union :: Ord k => Map k a -> Map k a -> Map k a
unionWith :: Ord k => (a -> a -> a) -> Map k a -> Map k a -> Map k a
unionWithKey :: Ord k => (k -> a -> a -> a) -> Map k a -> Map k a -> Map k a
unions :: (Foldable f, Ord k) => f (Map k a) -> Map k a
unionsWith :: (Foldable f, Ord k) => (a -> a -> a) -> f (Map k a) -> Map k a
difference :: Ord k => Map k a -> Map k b -> Map k a
differenceWith :: Ord k => (a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a
differenceWithKey :: Ord k => (k -> a -> b -> Maybe a) -> Map k a -> Map k b -> Map k a
intersection :: Ord k => Map k a -> Map k b -> Map k a
intersectionWith :: Ord k => (a -> b -> c) -> Map k a -> Map k b -> Map k c
intersectionWithKey :: Ord k => (k -> a -> b -> c) -> Map k a -> Map k b -> Map k c
mergeWithKey :: Ord k => (k -> a -> b -> Maybe c) -> (Map k a -> Map k c) -> (Map k b -> Map k c) -> Map k a -> Map k b -> Map k c
map :: (a -> b) -> Map k a -> Map k b
mapWithKey :: (k -> a -> b) -> Map k a -> Map k b
traverseWithKey :: Applicative t => (k -> a -> t b) -> Map k a -> t (Map k b)
traverseMaybeWithKey :: Applicative f => (k -> a -> f (Maybe b)) -> Map k a -> f (Map k b)
mapAccum :: (a -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)
mapAccumWithKey :: (a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)
mapAccumRWithKey :: (a -> k -> b -> (a, c)) -> a -> Map k b -> (a, Map k c)
mapKeys :: Ord k2 => (k1 -> k2) -> Map k1 a -> Map k2 a
mapKeysWith :: Ord k2 => (a -> a -> a) -> (k1 -> k2) -> Map k1 a -> Map k2 a
foldr :: (a -> b -> b) -> b -> Map k a -> b
foldl :: (a -> b -> a) -> a -> Map k b -> a
foldrWithKey :: (k -> a -> b -> b) -> b -> Map k a -> b
foldlWithKey :: (a -> k -> b -> a) -> a -> Map k b -> a
foldMapWithKey :: Monoid m => (k -> a -> m) -> Map k a -> m
foldr' :: (a -> b -> b) -> b -> Map k a -> b
foldl' :: (a -> b -> a) -> a -> Map k b -> a
foldrWithKey' :: (k -> a -> b -> b) -> b -> Map k a -> b
foldlWithKey' :: (a -> k -> b -> a) -> a -> Map k b -> a
elems :: Map k a -> [a]
keys :: Map k a -> [k]
assocs :: Map k a -> [(k, a)]
keysSet :: Map k a -> Set k
fromSet :: (k -> a) -> Set k -> Map k a
toList :: Map k a -> [(k, a)]
fromList :: Ord k => [(k, a)] -> Map k a
fromListWith :: Ord k => (a -> a -> a) -> [(k, a)] -> Map k a
fromListWithKey :: Ord k => (k -> a -> a -> a) -> [(k, a)] -> Map k a
toAscList :: Map k a -> [(k, a)]
toDescList :: Map k a -> [(k, a)]
filter :: (a -> Bool) -> Map k a -> Map k a
filterWithKey :: (k -> a -> Bool) -> Map k a -> Map k a
restrictKeys :: Ord k => Map k a -> Set k -> Map k a
withoutKeys :: Ord k => Map k a -> Set k -> Map k a
partition :: (a -> Bool) -> Map k a -> (Map k a, Map k a)
partitionWithKey :: (k -> a -> Bool) -> Map k a -> (Map k a, Map k a)
takeWhileAntitone :: (k -> Bool) -> Map k a -> Map k a
dropWhileAntitone :: (k -> Bool) -> Map k a -> Map k a
spanAntitone :: (k -> Bool) -> Map k a -> (Map k a, Map k a)
mapMaybe :: (a -> Maybe b) -> Map k a -> Map k b
mapMaybeWithKey :: (k -> a -> Maybe b) -> Map k a -> Map k b
mapEither :: (a -> Either b c) -> Map k a -> (Map k b, Map k c)
mapEitherWithKey :: (k -> a -> Either b c) -> Map k a -> (Map k b, Map k c)
split :: Ord k => k -> Map k a -> (Map k a, Map k a)
splitLookup :: Ord k => k -> Map k a -> (Map k a, Maybe a, Map k a)
splitRoot :: Map k b -> [Map k b]
isSubmapOf :: (Ord k, Eq a) => Map k a -> Map k a -> Bool
isSubmapOfBy :: Ord k => (a -> b -> Bool) -> Map k a -> Map k b -> Bool
isProperSubmapOf :: (Ord k, Eq a) => Map k a -> Map k a -> Bool
isProperSubmapOfBy :: Ord k => (a -> b -> Bool) -> Map k a -> Map k b -> Bool
lookupIndex :: Ord k => k -> Map k a -> Maybe Int
elemAt :: Int -> Map k a -> (k, a)
deleteAt :: Int -> Map k a -> Map k a
take :: Int -> Map k a -> Map k a
drop :: Int -> Map k a -> Map k a
splitAt :: Int -> Map k a -> (Map k a, Map k a)
lookupMin :: Map k a -> Maybe (k, a)
lookupMax :: Map k a -> Maybe (k, a)
deleteMin :: Map k a -> Map k a
deleteMax :: Map k a -> Map k a
updateMin :: (a -> Maybe a) -> Map k a -> Map k a
updateMax :: (a -> Maybe a) -> Map k a -> Map k a
updateMinWithKey :: (k -> a -> Maybe a) -> Map k a -> Map k a
updateMaxWithKey :: (k -> a -> Maybe a) -> Map k a -> Map k a
minView :: Map k a -> Maybe (a, Map k a)
maxView :: Map k a -> Maybe (a, Map k a)
minViewWithKey :: Map k a -> Maybe ((k, a), Map k a)
maxViewWithKey :: Map k a -> Maybe ((k, a), Map k a)
showTree :: Whoops "showTree has moved to Data.Map.Internal.Debug.showTree." => Map k a -> String
showTreeWith :: Whoops "showTreeWith has moved to Data.Map.Internal.Debug.showTreeWith." => (k -> a -> String) -> Bool -> Bool -> Map k a -> String
valid :: Ord k => Map k a -> Bool

-- | Strict Map partial functions. Import as:
--   
--   
--   import qualified RIO.Map.Partial as Map'
--   
module RIO.Map.Partial
(!) :: Ord k => Map k a -> k -> a
elemAt :: Int -> Map k a -> (k, a)
deleteAt :: Int -> Map k a -> Map k a
findIndex :: Ord k => k -> Map k a -> Int
updateAt :: (k -> a -> Maybe a) -> Int -> Map k a -> Map k a
findMin :: Map k a -> (k, a)
findMax :: Map k a -> (k, a)
deleteFindMin :: Map k a -> ((k, a), Map k a)
deleteFindMax :: Map k a -> ((k, a), Map k a)

-- | This module contains functions from Data.Map.Strict that have
--   unchecked preconditions on their input. If these preconditions are not
--   satisfied, the data structure may end up in an invalid state and other
--   operations may misbehave. Import as:
--   
--   
--   import qualified RIO.Map.Unchecked as Map'
--   
module RIO.Map.Unchecked
mapKeysMonotonic :: (k1 -> k2) -> Map k1 a -> Map k2 a
toAscList :: Map k a -> [(k, a)]
fromAscList :: Eq k => [(k, a)] -> Map k a
fromAscListWith :: Eq k => (a -> a -> a) -> [(k, a)] -> Map k a
fromAscListWithKey :: Eq k => (k -> a -> a -> a) -> [(k, a)] -> Map k a
fromDistinctAscList :: [(k, a)] -> Map k a
toDescList :: Map k a -> [(k, a)]
fromDescList :: Eq k => [(k, a)] -> Map k a
fromDescListWith :: Eq k => (a -> a -> a) -> [(k, a)] -> Map k a
fromDescListWithKey :: Eq k => (k -> a -> a -> a) -> [(k, a)] -> Map k a
fromDistinctDescList :: [(k, a)] -> Map k a

-- | NonEmpty list. Import as:
--   
--   
--   import qualified RIO.NonEmpty as NE
--   
--   
--   This module does not export any partial functions. For those, see
--   RIO.NonEmpty.Partial
module RIO.NonEmpty
data NonEmpty a
(:|) :: a -> [a] -> NonEmpty a
map :: (a -> b) -> NonEmpty a -> NonEmpty b
intersperse :: a -> NonEmpty a -> NonEmpty a
scanl :: Foldable f => (b -> a -> b) -> b -> f a -> NonEmpty b
scanr :: Foldable f => (a -> b -> b) -> b -> f a -> NonEmpty b
scanl1 :: (a -> a -> a) -> NonEmpty a -> NonEmpty a
scanr1 :: (a -> a -> a) -> NonEmpty a -> NonEmpty a
transpose :: NonEmpty (NonEmpty a) -> NonEmpty (NonEmpty a)
sortBy :: (a -> a -> Ordering) -> NonEmpty a -> NonEmpty a
sortWith :: Ord o => (a -> o) -> NonEmpty a -> NonEmpty a
length :: NonEmpty a -> Int
head :: NonEmpty a -> a
tail :: NonEmpty a -> [a]
last :: NonEmpty a -> a
init :: NonEmpty a -> [a]
(<|) :: a -> NonEmpty a -> NonEmpty a
cons :: a -> NonEmpty a -> NonEmpty a
uncons :: NonEmpty a -> (a, Maybe (NonEmpty a))
unfoldr :: (a -> (b, Maybe a)) -> a -> NonEmpty b
sort :: Ord a => NonEmpty a -> NonEmpty a
reverse :: NonEmpty a -> NonEmpty a
inits :: Foldable f => f a -> NonEmpty [a]
tails :: Foldable f => f a -> NonEmpty [a]
iterate :: (a -> a) -> a -> NonEmpty a
repeat :: a -> NonEmpty a
cycle :: NonEmpty a -> NonEmpty a
insert :: (Foldable f, Ord a) => a -> f a -> NonEmpty a
some1 :: Alternative f => f a -> f (NonEmpty a)
take :: Int -> NonEmpty a -> [a]
drop :: Int -> NonEmpty a -> [a]
splitAt :: Int -> NonEmpty a -> ([a], [a])
takeWhile :: (a -> Bool) -> NonEmpty a -> [a]
dropWhile :: (a -> Bool) -> NonEmpty a -> [a]
span :: (a -> Bool) -> NonEmpty a -> ([a], [a])
break :: (a -> Bool) -> NonEmpty a -> ([a], [a])
filter :: (a -> Bool) -> NonEmpty a -> [a]
partition :: (a -> Bool) -> NonEmpty a -> ([a], [a])
group :: (Foldable f, Eq a) => f a -> [NonEmpty a]
groupBy :: Foldable f => (a -> a -> Bool) -> f a -> [NonEmpty a]
groupWith :: (Foldable f, Eq b) => (a -> b) -> f a -> [NonEmpty a]
groupAllWith :: Ord b => (a -> b) -> [a] -> [NonEmpty a]
group1 :: Eq a => NonEmpty a -> NonEmpty (NonEmpty a)
groupBy1 :: (a -> a -> Bool) -> NonEmpty a -> NonEmpty (NonEmpty a)
groupWith1 :: Eq b => (a -> b) -> NonEmpty a -> NonEmpty (NonEmpty a)
groupAllWith1 :: Ord b => (a -> b) -> NonEmpty a -> NonEmpty (NonEmpty a)
isPrefixOf :: Eq a => [a] -> NonEmpty a -> Bool
nub :: Eq a => NonEmpty a -> NonEmpty a
nubBy :: (a -> a -> Bool) -> NonEmpty a -> NonEmpty a
zip :: NonEmpty a -> NonEmpty b -> NonEmpty (a, b)
zipWith :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c
unzip :: Functor f => f (a, b) -> (f a, f b)
nonEmpty :: [a] -> Maybe (NonEmpty a)
toList :: NonEmpty a -> [a]
xor :: NonEmpty Bool -> Bool

-- | NonEmpty list partial functions. Import as:
--   
--   
--   import qualified RIO.NonEmpty.Partial as NE'
--   
module RIO.NonEmpty.Partial
(!!) :: NonEmpty a -> Int -> a
fromList :: [a] -> NonEmpty a

-- | Partial functions. Import as:
--   
--   
--   import qualified RIO.Partial as RIO'
--   
module RIO.Partial
fromJust :: HasCallStack => Maybe a -> a
read :: Read a => String -> a
toEnum :: Enum a => Int -> a
pred :: Enum a => a -> a
succ :: Enum a => a -> a

module RIO.Prelude.Types
data Bool
False :: Bool
True :: Bool
data Char
type String = [Char]
type FilePath = String
data Ordering
LT :: Ordering
EQ :: Ordering
GT :: Ordering
data Int
data Int8
data Int16
data Int32
data Int64
data Word
data Word8
data Word16
data Word32
data Word64
data Integer
data Natural
type Rational = Ratio Integer
data Float
data Double
data Maybe a
Nothing :: Maybe a
Just :: a -> Maybe a
data Either a b
Left :: a -> Either a b
Right :: b -> Either a b
data NonEmpty a
(:|) :: a -> [a] -> NonEmpty a
data Proxy (t :: k)
Proxy :: Proxy (t :: k)
data Void
newtype Const a (b :: k)
Const :: a -> Const a (b :: k)
[getConst] :: Const a (b :: k) -> a
newtype Identity a
Identity :: a -> Identity a
[runIdentity] :: Identity a -> a
data IO a
data ST s a
class Eq a
class Eq a => Ord a
class Bounded a
class Enum a
class Show a
class Read a
class IsString a
class Num a
class Num a => Fractional a
class Fractional a => Floating a
class (Num a, Ord a) => Real a
class (Real a, Enum a) => Integral a
class (Real a, Fractional a) => RealFrac a
class (RealFrac a, Floating a) => RealFloat a
class Functor (f :: Type -> Type)
class Bifunctor (p :: Type -> Type -> Type)
class Foldable (t :: Type -> Type)
class Bifoldable (p :: Type -> Type -> Type)
class Semigroup a
class Semigroup a => Monoid a
class Functor f => Applicative (f :: Type -> Type)
class Applicative f => Alternative (f :: Type -> Type)
class (Functor t, Foldable t) => Traversable (t :: Type -> Type)
class (Bifunctor t, Bifoldable t) => Bitraversable (t :: Type -> Type -> Type)
class Applicative m => Monad (m :: Type -> Type)
class (Alternative m, Monad m) => MonadPlus (m :: Type -> Type)
class Category (cat :: k -> k -> Type)
class Category a => Arrow (a :: Type -> Type -> Type)
class Monad m => MonadFail (m :: Type -> Type)
class Typeable (a :: k)
class Typeable a => Data a
gfoldl :: Data a => (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. () => g -> c g) -> a -> c a
gunfold :: Data a => (forall b r. Data b => c (b -> r) -> c r) -> (forall r. () => r -> c r) -> Constr -> c a
toConstr :: Data a => a -> Constr
dataTypeOf :: Data a => a -> DataType
dataCast1 :: (Data a, Typeable t) => (forall d. Data d => c (t d)) -> Maybe (c a)
dataCast2 :: (Data a, Typeable t) => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c a)
gmapT :: Data a => (forall b. Data b => b -> b) -> a -> a
gmapQl :: Data a => (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> a -> r
gmapQr :: forall r r'. Data a => (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> a -> r
gmapQ :: Data a => (forall d. Data d => d -> u) -> a -> [u]
gmapQi :: Data a => Int -> (forall d. Data d => d -> u) -> a -> u
gmapM :: (Data a, Monad m) => (forall d. Data d => d -> m d) -> a -> m a
gmapMp :: (Data a, MonadPlus m) => (forall d. Data d => d -> m d) -> a -> m a
gmapMo :: (Data a, MonadPlus m) => (forall d. Data d => d -> m d) -> a -> m a
class Generic a
class Storable a
class (Typeable e, Show e) => Exception e
type HasCallStack = ?callStack :: CallStack
class NFData a
class MonadTrans (t :: Type -> Type -> Type -> Type)
class Monad m => MonadReader r (m :: Type -> Type) | m -> r
type Reader r = ReaderT r Identity
newtype ReaderT r (m :: Type -> Type) a
ReaderT :: (r -> m a) -> ReaderT r (m :: Type -> Type) a

-- | A class for monads in which exceptions may be thrown.
--   
--   Instances should obey the following law:
--   
--   
--   throwM e >> x = throwM e
--   
--   
--   In other words, throwing an exception short-circuits the rest of the
--   monadic computation.
class Monad m => MonadThrow (m :: Type -> Type)
data ByteString
type LByteString = ByteString
data Builder
data ShortByteString
data Text
type LText = Text
data UnicodeException
DecodeError :: String -> Maybe Word8 -> UnicodeException
EncodeError :: String -> Maybe Char -> UnicodeException

-- | Boxed vectors, supporting efficient slicing.
data Vector a
type UVector = Vector
class (Vector Vector a, MVector MVector a) => Unbox a
type SVector = Vector
type GVector = Vector
data IntMap a
data Map k a
data IntSet
data Set a
data Seq a

-- | The class of types that can be converted to a hash value.
--   
--   Minimal implementation: hashWithSalt.
class Hashable a

-- | A map from keys to values. A map cannot contain duplicate keys; each
--   key can map to at most one value.
data HashMap k v

-- | A set of values. A set cannot contain duplicate values.
data HashSet a

-- | Class of monads which can perform primitive state-transformer actions
class Monad m => PrimMonad (m :: Type -> Type) where {
    
    -- | State token type
    type family PrimState (m :: Type -> Type);
}

module RIO.Prelude
(||) :: Bool -> Bool -> Bool
(&&) :: Bool -> Bool -> Bool
not :: Bool -> Bool
otherwise :: Bool
bool :: a -> a -> Bool -> a
maybe :: b -> (a -> b) -> Maybe a -> b
fromMaybe :: a -> Maybe a -> a

-- | Get a First value with a default fallback
fromFirst :: a -> First a -> a
isJust :: Maybe a -> Bool
isNothing :: Maybe a -> Bool
listToMaybe :: [a] -> Maybe a
maybeToList :: Maybe a -> [a]
catMaybes :: [Maybe a] -> [a]
mapMaybe :: (a -> Maybe b) -> [a] -> [b]

-- | Applicative mapMaybe.
mapMaybeA :: Applicative f => (a -> f (Maybe b)) -> [a] -> f [b]

-- | Monadic mapMaybe.
mapMaybeM :: Monad m => (a -> m (Maybe b)) -> [a] -> m [b]

-- | 
--   forMaybeA == flip mapMaybeA
--   
forMaybeA :: Applicative f => [a] -> (a -> f (Maybe b)) -> f [b]

-- | 
--   forMaybeM == flip mapMaybeM
--   
forMaybeM :: Monad m => [a] -> (a -> m (Maybe b)) -> m [b]
either :: (a -> c) -> (b -> c) -> Either a b -> c
isLeft :: Either a b -> Bool
isRight :: Either a b -> Bool

-- | Apply a function to a Left constructor
mapLeft :: (a1 -> a2) -> Either a1 b -> Either a2 b
lefts :: [Either a b] -> [a]
partitionEithers :: [Either a b] -> ([a], [b])
rights :: [Either a b] -> [b]
fst :: (a, b) -> a
snd :: (a, b) -> b
curry :: ((a, b) -> c) -> a -> b -> c
uncurry :: (a -> b -> c) -> (a, b) -> c
(==) :: Eq a => a -> a -> Bool
(/=) :: Eq a => a -> a -> Bool
(<) :: Ord a => a -> a -> Bool
(<=) :: Ord a => a -> a -> Bool
(>) :: Ord a => a -> a -> Bool
(>=) :: Ord a => a -> a -> Bool
max :: Ord a => a -> a -> a
min :: Ord a => a -> a -> a
compare :: Ord a => a -> a -> Ordering
comparing :: Ord a => (b -> a) -> b -> b -> Ordering
newtype Down a
Down :: a -> Down a
fromEnum :: Enum a => a -> Int
minBound :: Bounded a => a
maxBound :: Bounded a => a
(+) :: Num a => a -> a -> a
(-) :: Num a => a -> a -> a
(*) :: Num a => a -> a -> a
(^) :: (Num a, Integral b) => a -> b -> a
negate :: Num a => a -> a
abs :: Num a => a -> a
signum :: Num a => a -> a
fromInteger :: Num a => Integer -> a
subtract :: Num a => a -> a -> a
toRational :: Real a => a -> Rational
quot :: Integral a => a -> a -> a
rem :: Integral a => a -> a -> a
div :: Integral a => a -> a -> a
mod :: Integral a => a -> a -> a
quotRem :: Integral a => a -> a -> (a, a)
divMod :: Integral a => a -> a -> (a, a)
toInteger :: Integral a => a -> Integer
even :: Integral a => a -> Bool
odd :: Integral a => a -> Bool
gcd :: Integral a => a -> a -> a
lcm :: Integral a => a -> a -> a
fromIntegral :: (Integral a, Num b) => a -> b
(/) :: Fractional a => a -> a -> a
(^^) :: (Fractional a, Integral b) => a -> b -> a
recip :: Fractional a => a -> a
fromRational :: Fractional a => Rational -> a
realToFrac :: (Real a, Fractional b) => a -> b
pi :: Floating a => a
exp :: Floating a => a -> a
log :: Floating a => a -> a
sqrt :: Floating a => a -> a
(**) :: Floating a => a -> a -> a
logBase :: Floating a => a -> a -> a
sin :: Floating a => a -> a
cos :: Floating a => a -> a
tan :: Floating a => a -> a
asin :: Floating a => a -> a
acos :: Floating a => a -> a
atan :: Floating a => a -> a
sinh :: Floating a => a -> a
cosh :: Floating a => a -> a
tanh :: Floating a => a -> a
asinh :: Floating a => a -> a
acosh :: Floating a => a -> a
atanh :: Floating a => a -> a
properFraction :: (RealFrac a, Integral b) => a -> (b, a)
truncate :: (RealFrac a, Integral b) => a -> b
round :: (RealFrac a, Integral b) => a -> b
ceiling :: (RealFrac a, Integral b) => a -> b
floor :: (RealFrac a, Integral b) => a -> b
floatRadix :: RealFloat a => a -> Integer
floatDigits :: RealFloat a => a -> Int
floatRange :: RealFloat a => a -> (Int, Int)
decodeFloat :: RealFloat a => a -> (Integer, Int)
encodeFloat :: RealFloat a => Integer -> Int -> a
exponent :: RealFloat a => a -> Int
significand :: RealFloat a => a -> a
scaleFloat :: RealFloat a => Int -> a -> a
isNaN :: RealFloat a => a -> Bool
isInfinite :: RealFloat a => a -> Bool
isDenormalized :: RealFloat a => a -> Bool
isNegativeZero :: RealFloat a => a -> Bool
isIEEE :: RealFloat a => a -> Bool
atan2 :: RealFloat a => a -> a -> a
byteSwap16 :: Word16 -> Word16
byteSwap32 :: Word32 -> Word32
byteSwap64 :: Word64 -> Word64
(<>) :: Semigroup a => a -> a -> a
sappend :: Semigroup s => s -> s -> s
mempty :: Monoid a => a
mappend :: Monoid a => a -> a -> a
mconcat :: Monoid a => [a] -> a
fmap :: Functor f => (a -> b) -> f a -> f b
(<$>) :: Functor f => (a -> b) -> f a -> f b
(<$) :: Functor f => a -> f b -> f a
($>) :: Functor f => f a -> b -> f b
void :: Functor f => f a -> f ()
(<&>) :: Functor f => f a -> (a -> b) -> f b
pure :: Applicative f => a -> f a
(<*>) :: Applicative f => f (a -> b) -> f a -> f b
(<*) :: Applicative f => f a -> f b -> f a
(*>) :: Applicative f => f a -> f b -> f b
liftA :: Applicative f => (a -> b) -> f a -> f b
liftA2 :: Applicative f => (a -> b -> c) -> f a -> f b -> f c
liftA3 :: Applicative f => (a -> b -> c -> d) -> f a -> f b -> f c -> f d
forever :: Applicative f => f a -> f b
traverse_ :: (Foldable t, Applicative f) => (a -> f b) -> t a -> f ()
for_ :: (Foldable t, Applicative f) => t a -> (a -> f b) -> f ()
sequenceA_ :: (Foldable t, Applicative f) => t (f a) -> f ()
filterM :: Applicative m => (a -> m Bool) -> [a] -> m [a]
replicateM_ :: Applicative m => Int -> m a -> m ()
zipWithM :: Applicative m => (a -> b -> m c) -> [a] -> [b] -> m [c]
zipWithM_ :: Applicative m => (a -> b -> m c) -> [a] -> [b] -> m ()
return :: Monad m => a -> m a
join :: Monad m => m (m a) -> m a
fail :: MonadFail m => String -> m a
(>>=) :: Monad m => m a -> (a -> m b) -> m b
(>>) :: Monad m => m a -> m b -> m b
(=<<) :: Monad m => (a -> m b) -> m a -> m b
(>=>) :: Monad m => (a -> m b) -> (b -> m c) -> a -> m c
(<=<) :: Monad m => (b -> m c) -> (a -> m b) -> a -> m c
(<$!>) :: Monad m => (a -> b) -> m a -> m b
liftM :: Monad m => (a1 -> r) -> m a1 -> m r
liftM2 :: Monad m => (a1 -> a2 -> r) -> m a1 -> m a2 -> m r

-- | Run the second value if the first value returns True
whenM :: Monad m => m Bool -> m () -> m ()

-- | Run the second value if the first value returns False
unlessM :: Monad m => m Bool -> m () -> m ()
mapM_ :: (Foldable t, Monad m) => (a -> m b) -> t a -> m ()
forM_ :: (Foldable t, Monad m) => t a -> (a -> m b) -> m ()
sequence_ :: (Foldable t, Monad m) => t (m a) -> m ()
foldM :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m b
foldM_ :: (Foldable t, Monad m) => (b -> a -> m b) -> b -> t a -> m ()
foldr :: Foldable t => (a -> b -> b) -> b -> t a -> b
foldl' :: Foldable t => (b -> a -> b) -> b -> t a -> b
fold :: (Foldable t, Monoid m) => t m -> m
foldMap :: (Foldable t, Monoid m) => (a -> m) -> t a -> m

-- | Extend foldMap to allow side effects.
--   
--   Internally, this is implemented using a strict left fold. This is used
--   for performance reasons. It also necessitates that this function has a
--   Monad constraint and not just an Applicative
--   constraint. For more information, see
--   https://github.com/commercialhaskell/rio/pull/99#issuecomment-394179757.
foldMapM :: (Monad m, Monoid w, Foldable t) => (a -> m w) -> t a -> m w
elem :: (Foldable t, Eq a) => a -> t a -> Bool
notElem :: (Foldable t, Eq a) => a -> t a -> Bool
null :: Foldable t => t a -> Bool
length :: Foldable t => t a -> Int
sum :: (Foldable t, Num a) => t a -> a
product :: (Foldable t, Num a) => t a -> a
all :: Foldable t => (a -> Bool) -> t a -> Bool
any :: Foldable t => (a -> Bool) -> t a -> Bool
and :: Foldable t => t Bool -> Bool
or :: Foldable t => t Bool -> Bool
toList :: Foldable t => t a -> [a]
concat :: Foldable t => t [a] -> [a]
concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
traverse :: (Traversable t, Applicative f) => (a -> f b) -> t a -> f (t b)
for :: (Traversable t, Applicative f) => t a -> (a -> f b) -> f (t b)
sequenceA :: (Traversable t, Applicative f) => t (f a) -> f (t a)
mapM :: (Traversable t, Monad m) => (a -> m b) -> t a -> m (t b)
forM :: (Traversable t, Monad m) => t a -> (a -> m b) -> m (t b)
sequence :: (Traversable t, Monad m) => t (m a) -> m (t a)
(<|>) :: Alternative f => f a -> f a -> f a
some :: Alternative f => f a -> f [a]
many :: Alternative f => f a -> f [a]
optional :: Alternative f => f a -> f (Maybe a)
asum :: (Foldable t, Alternative f) => t (f a) -> f a
guard :: Alternative f => Bool -> f ()
when :: Applicative f => Bool -> f () -> f ()
unless :: Applicative f => Bool -> f () -> f ()
bimap :: Bifunctor p => (a -> b) -> (c -> d) -> p a c -> p b d
first :: Bifunctor p => (a -> b) -> p a c -> p b c
second :: Bifunctor p => (b -> c) -> p a b -> p a c
bifold :: (Bifoldable p, Monoid m) => p m m -> m
bifoldMap :: (Bifoldable p, Monoid m) => (a -> m) -> (b -> m) -> p a b -> m
bifoldr :: Bifoldable p => (a -> c -> c) -> (b -> c -> c) -> c -> p a b -> c
bifoldl :: Bifoldable p => (c -> a -> c) -> (c -> b -> c) -> c -> p a b -> c
bifoldr' :: Bifoldable t => (a -> c -> c) -> (b -> c -> c) -> c -> t a b -> c
bifoldr1 :: Bifoldable t => (a -> a -> a) -> t a a -> a
bifoldrM :: (Bifoldable t, Monad m) => (a -> c -> m c) -> (b -> c -> m c) -> c -> t a b -> m c
bifoldl' :: Bifoldable t => (a -> b -> a) -> (a -> c -> a) -> a -> t b c -> a
bifoldl1 :: Bifoldable t => (a -> a -> a) -> t a a -> a
bifoldlM :: (Bifoldable t, Monad m) => (a -> b -> m a) -> (a -> c -> m a) -> a -> t b c -> m a
bitraverse_ :: (Bifoldable t, Applicative f) => (a -> f c) -> (b -> f d) -> t a b -> f ()
bifor_ :: (Bifoldable t, Applicative f) => t a b -> (a -> f c) -> (b -> f d) -> f ()
bisequence_ :: (Bifoldable t, Applicative f) => t (f a) (f b) -> f ()
biasum :: (Bifoldable t, Alternative f) => t (f a) (f a) -> f a
biList :: Bifoldable t => t a a -> [a]
binull :: Bifoldable t => t a b -> Bool
bilength :: Bifoldable t => t a b -> Int
bielem :: (Bifoldable t, Eq a) => a -> t a a -> Bool
bimaximum :: (Bifoldable t, Ord a) => t a a -> a
biminimum :: (Bifoldable t, Ord a) => t a a -> a
bisum :: (Bifoldable t, Num a) => t a a -> a
biproduct :: (Bifoldable t, Num a) => t a a -> a
biconcat :: Bifoldable t => t [a] [a] -> [a]
biconcatMap :: Bifoldable t => (a -> [c]) -> (b -> [c]) -> t a b -> [c]
biand :: Bifoldable t => t Bool Bool -> Bool
bior :: Bifoldable t => t Bool Bool -> Bool
biany :: Bifoldable t => (a -> Bool) -> (b -> Bool) -> t a b -> Bool
biall :: Bifoldable t => (a -> Bool) -> (b -> Bool) -> t a b -> Bool
bimaximumBy :: Bifoldable t => (a -> a -> Ordering) -> t a a -> a
biminimumBy :: Bifoldable t => (a -> a -> Ordering) -> t a a -> a
binotElem :: (Bifoldable t, Eq a) => a -> t a a -> Bool
bifind :: Bifoldable t => (a -> Bool) -> t a a -> Maybe a
bitraverse :: (Bitraversable t, Applicative f) => (a -> f c) -> (b -> f d) -> t a b -> f (t c d)
bisequence :: (Bitraversable t, Applicative f) => t (f a) (f b) -> f (t a b)
bifor :: (Bitraversable t, Applicative f) => t a b -> (a -> f c) -> (b -> f d) -> f (t c d)
bimapAccumL :: Bitraversable t => (a -> b -> (a, c)) -> (a -> d -> (a, e)) -> a -> t b d -> (a, t c e)
bimapAccumR :: Bitraversable t => (a -> b -> (a, c)) -> (a -> d -> (a, e)) -> a -> t b d -> (a, t c e)
mzero :: MonadPlus m => m a
mplus :: MonadPlus m => m a -> m a -> m a
msum :: (Foldable t, MonadPlus m) => t (m a) -> m a
mfilter :: MonadPlus m => (a -> Bool) -> m a -> m a
(&&&) :: Arrow a => a b c -> a b c' -> a b (c, c')
(***) :: Arrow a => a b c -> a b' c' -> a (b, b') (c, c')
(>>>) :: forall k cat (a :: k) (b :: k) (c :: k). Category cat => cat a b -> cat b c -> cat a c
id :: a -> a
const :: a -> b -> a
(.) :: (b -> c) -> (a -> b) -> a -> c
($) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
(&) :: a -> (a -> b) -> b
flip :: (a -> b -> c) -> b -> a -> c
fix :: (a -> a) -> a
on :: (b -> b -> c) -> (a -> b) -> a -> a -> c
($!) :: forall (r :: RuntimeRep) a (b :: TYPE r). (a -> b) -> a -> b
seq :: a -> b -> b
error :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => [Char] -> a
undefined :: forall (r :: RuntimeRep) (a :: TYPE r). HasCallStack => a
asTypeOf :: a -> a -> a

-- | Helper function to force an action to run in IO. Especially
--   useful for overly general contexts, like hspec tests.
asIO :: IO a -> IO a
(++) :: [a] -> [a] -> [a]
break :: (a -> Bool) -> [a] -> ([a], [a])
drop :: Int -> [a] -> [a]
dropWhile :: (a -> Bool) -> [a] -> [a]
filter :: (a -> Bool) -> [a] -> [a]
lookup :: Eq a => a -> [(a, b)] -> Maybe b
map :: (a -> b) -> [a] -> [b]
replicate :: Int -> a -> [a]
reverse :: [a] -> [a]
span :: (a -> Bool) -> [a] -> ([a], [a])
take :: Int -> [a] -> [a]
takeWhile :: (a -> Bool) -> [a] -> [a]
zip :: [a] -> [b] -> [(a, b)]
zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]

-- | Strip out duplicates
nubOrd :: Ord a => [a] -> [a]
fromString :: IsString a => String -> a
lines :: String -> [String]
unlines :: [String] -> String
unwords :: [String] -> String
words :: String -> [String]
show :: Show a => a -> String
readMaybe :: Read a => String -> Maybe a
($!!) :: NFData a => (a -> b) -> a -> b
rnf :: NFData a => a -> ()
deepseq :: NFData a => a -> b -> b
force :: NFData a => a -> a
absurd :: Void -> a
lift :: (MonadTrans t, Monad m) => m a -> t m a
ask :: MonadReader r m => m r
asks :: MonadReader r m => (r -> a) -> m a
local :: MonadReader r m => (r -> r) -> m a -> m a
runReader :: Reader r a -> r -> a
runReaderT :: ReaderT r m a -> r -> m a
toStrictBytes :: LByteString -> ByteString
fromStrictBytes :: ByteString -> LByteString
toShort :: ByteString -> ShortByteString
fromShort :: ShortByteString -> ByteString
tshow :: Show a => a -> Text
decodeUtf8Lenient :: ByteString -> Text
decodeUtf8' :: ByteString -> Either UnicodeException Text
decodeUtf8With :: OnDecodeError -> ByteString -> Text
encodeUtf8 :: Text -> ByteString
encodeUtf8Builder :: Text -> Builder
lenientDecode :: OnDecodeError

-- | Execute a primitive operation
primitive :: PrimMonad m => (State# (PrimState m) -> (# State# (PrimState m), a #)) -> m a
runST :: (forall s. () => ST s a) -> a

module RIO.Deque

-- | A double-ended queue supporting any underlying vector type and any
--   monad.
--   
--   This implements a circular double-ended queue with exponential growth.
data Deque v s a

-- | A Deque specialized to unboxed vectors.
type UDeque = Deque MVector

-- | A Deque specialized to storable vectors.
type SDeque = Deque MVector

-- | A Deque specialized to boxed vectors.
type BDeque = Deque MVector

-- | Create a new, empty Deque
newDeque :: (MVector v a, PrimMonad m) => m (Deque v (PrimState m) a)

-- | O(1) - Get the number of elements that is currently in the
--   Deque
getDequeSize :: PrimMonad m => Deque v (PrimState m) a -> m Int

-- | Pop the first value from the beginning of the Deque
popFrontDeque :: (MVector v a, PrimMonad m) => Deque v (PrimState m) a -> m (Maybe a)

-- | Pop the first value from the end of the Deque
popBackDeque :: (MVector v a, PrimMonad m) => Deque v (PrimState m) a -> m (Maybe a)

-- | Push a new value to the beginning of the Deque
pushFrontDeque :: (MVector v a, PrimMonad m) => Deque v (PrimState m) a -> a -> m ()

-- | Push a new value to the end of the Deque
pushBackDeque :: (MVector v a, PrimMonad m) => Deque v (PrimState m) a -> a -> m ()

-- | Fold over a Deque, starting at the beginning. Does not modify
--   the Deque.
foldlDeque :: (MVector v a, PrimMonad m) => (acc -> a -> m acc) -> acc -> Deque v (PrimState m) a -> m acc

-- | Fold over a Deque, starting at the end. Does not modify the
--   Deque.
foldrDeque :: (MVector v a, PrimMonad m) => (a -> acc -> m acc) -> acc -> Deque v (PrimState m) a -> m acc

-- | Convert a Deque into a list. Does not modify the Deque.
dequeToList :: (MVector v a, PrimMonad m) => Deque v (PrimState m) a -> m [a]

-- | Convert to an immutable vector of any type. If resulting pure vector
--   corresponds to the mutable one used by the Deque, it will be
--   more efficient to use freezeDeque instead.
--   
--   
Example
--   
--   
--   >>> :set -XTypeApplications
--   
--   >>> import qualified RIO.Vector.Unboxed as U
--   
--   >>> import qualified RIO.Vector.Storable as S
--   
--   >>> d <- newDeque @U.MVector @Int
--   
--   >>> mapM_ (pushFrontDeque d) [0..10]
--   
--   >>> dequeToVector @S.Vector d
--   [10,9,8,7,6,5,4,3,2,1,0]
--   
dequeToVector :: (Vector v' a, MVector v a, PrimMonad m) => Deque v (PrimState m) a -> m (v' a)

-- | Yield an immutable copy of the underlying mutable vector. The
--   difference from dequeToVector is that the the copy will be
--   performed with a more efficient memcpy, rather than element
--   by element. The downside is that the resulting vector type must be the
--   one that corresponds to the mutable one that is used in the
--   Deque.
--   
--   
Example
--   
--   
--   >>> :set -XTypeApplications
--   
--   >>> import qualified RIO.Vector.Unboxed as U
--   
--   >>> d <- newDeque @U.MVector @Int
--   
--   >>> mapM_ (pushFrontDeque d) [0..10]
--   
--   >>> freezeDeque @U.Vector d
--   [10,9,8,7,6,5,4,3,2,1,0]
--   
freezeDeque :: (Vector v a, PrimMonad m) => Deque (Mutable v) (PrimState m) a -> m (v a)

-- | Helper function to assist with type inference, forcing usage of an
--   unboxed vector.
asUDeque :: UDeque s a -> UDeque s a

-- | Helper function to assist with type inference, forcing usage of a
--   storable vector.
asSDeque :: SDeque s a -> SDeque s a

-- | Helper function to assist with type inference, forcing usage of a
--   boxed vector.
asBDeque :: BDeque s a -> BDeque s a

-- | Interacting with external processes.
--   
--   This module provides a layer on top of System.Process.Typed,
--   with the following additions:
--   
--   
--   
- For efficiency, it will cache PATH lookups.
--   
- For convenience, you can set the working directory and env vars
--   overrides in a RIO environment instead of on the individual
--   calls to the process.
--   
- Built-in support for logging at the debug level.
--   
--   
--   In order to switch over to this API, the main idea is:
--   
--   
--   
- Like most of the rio library, you need to create an environment
--   value (this time ProcessContext), and include it in your
--   RIO environment. See mkProcessContext.
--   
- Instead of using the proc function from
--   System.Process.Typed for creating a ProcessConfig, use
--   the locally defined proc function, which will handle overriding
--   environment variables, looking up paths, performing logging, etc.
--   
--   
--   Once you have your ProcessConfig, use the standard functions
--   from Typed (reexported here for convenient) for running the
--   ProcessConfig.
module RIO.Process

-- | Context in which to run processes.
data ProcessContext

-- | Get the ProcessContext from the environment.
class HasProcessContext env
processContextL :: HasProcessContext env => Lens' env ProcessContext

-- | The environment variable map
type EnvVars = Map Text Text

-- | Create a new ProcessContext from the given environment variable
--   map.
mkProcessContext :: MonadIO m => EnvVars -> m ProcessContext

-- | Same as mkProcessContext but uses the system environment (from
--   getEnvironment).
mkDefaultProcessContext :: MonadIO m => m ProcessContext

-- | Modify the environment variables of a ProcessContext. This will
--   not change the working directory.
--   
--   Note that this requires MonadIO, as it will create a new
--   IORef for the cache.
modifyEnvVars :: MonadIO m => ProcessContext -> (EnvVars -> EnvVars) -> m ProcessContext

-- | Use modifyEnvVars to create a new ProcessContext, and
--   then use it in the provided action.
withModifyEnvVars :: (HasProcessContext env, MonadReader env m, MonadIO m) => (EnvVars -> EnvVars) -> m a -> m a

-- | Look into the ProcessContext and return the specified
--   environmet variable if one is available.
lookupEnvFromContext :: (MonadReader env m, HasProcessContext env) => Text -> m (Maybe Text)

-- | Set the working directory to be used by child processes.
withWorkingDir :: (HasProcessContext env, MonadReader env m, MonadIO m) => FilePath -> m a -> m a

-- | Override the working directory processes run in. Nothing
--   means the current process's working directory.
workingDirL :: HasProcessContext env => Lens' env (Maybe FilePath)

-- | Get the environment variables. We cannot provide a Lens here,
--   since updating the environment variables requires an IO
--   action to allocate a new IORef for holding the executable
--   path cache.
envVarsL :: HasProcessContext env => SimpleGetter env EnvVars

-- | Get the EnvVars as an associated list of Strings.
--   
--   Useful for interacting with other libraries.
envVarsStringsL :: HasProcessContext env => SimpleGetter env [(String, String)]

-- | Get the list of directories searched for executables (the
--   PATH).
--   
--   Similar to envVarMapL, this cannot be a full Lens.
exeSearchPathL :: HasProcessContext env => SimpleGetter env [FilePath]

-- | Reset the executable cache.
resetExeCache :: (MonadIO m, MonadReader env m, HasProcessContext env) => m ()

-- | Provide a ProcessConfig based on the ProcessContext in
--   scope. Deals with resolving the full path, setting the child process's
--   environment variables, setting the working directory, and wrapping the
--   call with withProcessTimeLog for debugging output.
--   
--   This is intended to be analogous to the proc function
--   provided by the System.Process.Typed module, but has a
--   different type signature to (1) allow it to perform IO
--   actions for looking up paths, and (2) allow logging and timing of the
--   running action.
proc :: (HasProcessContext env, HasLogFunc env, MonadReader env m, MonadIO m, HasCallStack) => FilePath -> [String] -> (ProcessConfig () () () -> m a) -> m a

-- | Same as withProcess, but generalized to MonadUnliftIO.

-- | Deprecated: Please consider using withProcessWait, or instead use
--   withProcessTerm
withProcess :: MonadUnliftIO m => ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> m a) -> m a

-- | Same as withProcess_, but generalized to MonadUnliftIO.

-- | Deprecated: Please consider using withProcessWait, or instead use
--   withProcessTerm
withProcess_ :: MonadUnliftIO m => ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> m a) -> m a

-- | Same as withProcessWait, but generalized to
--   MonadUnliftIO.
withProcessWait :: MonadUnliftIO m => ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> m a) -> m a

-- | Same as withProcessWait_, but generalized to
--   MonadUnliftIO.
withProcessWait_ :: MonadUnliftIO m => ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> m a) -> m a

-- | Same as withProcessTerm, but generalized to
--   MonadUnliftIO.
withProcessTerm :: MonadUnliftIO m => ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> m a) -> m a

-- | Same as withProcessTerm_, but generalized to
--   MonadUnliftIO.
withProcessTerm_ :: MonadUnliftIO m => ProcessConfig stdin stdout stderr -> (Process stdin stdout stderr -> m a) -> m a

-- | Execute a process within the configured environment.
--   
--   Execution will not return, because either:
--   
--   1) On non-windows, execution is taken over by execv of the
--   sub-process. This allows signals to be propagated (#527)
--   
--   2) On windows, an ExitCode exception will be thrown.
exec :: (HasProcessContext env, HasLogFunc env) => String -> [String] -> RIO env b

-- | Like exec, but does not use execv on non-windows. This
--   way, there is a sub-process, which is helpful in some cases
--   (https://github.com/commercialhaskell/stack/issues/1306).
--   
--   This function only exits by throwing ExitCode.
execSpawn :: (HasProcessContext env, HasLogFunc env) => String -> [String] -> RIO env a

-- | A convenience environment combining a LogFunc and a
--   ProcessContext
data LoggedProcessContext
LoggedProcessContext :: ProcessContext -> LogFunc -> LoggedProcessContext

-- | Run an action using a LoggedProcessContext with default
--   settings and no logging.
withProcessContextNoLogging :: MonadIO m => RIO LoggedProcessContext a -> m a

-- | Exception type which may be generated in this module.
--   
--   NOTE Other exceptions may be thrown by underlying libraries!
data ProcessException
NoPathFound :: ProcessException
ExecutableNotFound :: String -> [FilePath] -> ProcessException
ExecutableNotFoundAt :: FilePath -> ProcessException
PathsInvalidInPath :: [FilePath] -> ProcessException

-- | Check if the given executable exists on the given PATH.
doesExecutableExist :: (MonadIO m, MonadReader env m, HasProcessContext env) => String -> m Bool

-- | Find the complete path for the given executable name.
--   
--   On POSIX systems, filenames that match but are not exectuables are
--   excluded.
--   
--   On Windows systems, the executable names tried, in turn, are the
--   supplied name (only if it has an extension) and that name extended by
--   each of the exeExtensions. Also, this function may behave
--   differently from findExecutable. The latter excludes as
--   executables filenames without a .bat, .cmd,
--   .com or .exe extension (case-insensitive).
findExecutable :: (MonadIO m, MonadReader env m, HasProcessContext env) => String -> m (Either ProcessException FilePath)

-- | Get the filename extensions for executable files, including the dot
--   (if any).
--   
--   On POSIX systems, this is [""].
--   
--   On Windows systems, the list is determined by the value of the
--   PATHEXT environment variable, if it present in the
--   environment. If the variable is absent, this is its default value on a
--   Windows system. This function may, therefore, behave differently from
--   exeExtension, which returns only ".exe".
exeExtensions :: (MonadIO m, MonadReader env m, HasProcessContext env) => m [String]

-- | Augment the PATH environment variable with the given extra paths.
augmentPath :: [FilePath] -> Maybe Text -> Either ProcessException Text

-- | Apply augmentPath on the PATH value in the given
--   EnvVars.
augmentPathMap :: [FilePath] -> EnvVars -> Either ProcessException EnvVars

-- | Show a process arg including speechmarks when necessary. Just for
--   debugging purposes, not functionally important.
showProcessArgDebug :: String -> Text

-- | An abstract configuration for a process, which can then be launched
--   into an actual running Process. Takes three type parameters,
--   providing the types of standard input, standard output, and standard
--   error, respectively.
--   
--   There are three ways to construct a value of this type:
--   
--   
--   
- With the proc smart constructor, which takes a command name
--   and a list of arguments.
--   
- With the shell smart constructor, which takes a shell
--   string
--   
- With the IsString instance via OverloadedStrings. If you
--   provide it a string with no spaces (e.g., "date"), it will
--   treat it as a raw command with no arguments (e.g., proc "date"
--   []). If it has spaces, it will use shell.
--   
--   
--   In all cases, the default for all three streams is to inherit the
--   streams from the parent process. For other settings, see the setters
--   below for default values.
data ProcessConfig stdin stdout stderr

-- | A specification for how to create one of the three standard child
--   streams. See examples below.
data StreamSpec (streamType :: StreamType) a

-- | Whether a stream is an input stream or output stream. Note that this
--   is from the perspective of the child process, so that a child's
--   standard input stream is an STInput, even though the parent
--   process will be writing to it.
data StreamType
STInput :: StreamType
STOutput :: StreamType

-- | A running process. The three type parameters provide the type of the
--   standard input, standard output, and standard error streams.
data Process stdin stdout stderr

-- | Set the child's standard input stream to the given StreamSpec.
--   
--   Default: inherit
setStdin :: StreamSpec 'STInput stdin -> ProcessConfig stdin0 stdout stderr -> ProcessConfig stdin stdout stderr

-- | Set the child's standard output stream to the given StreamSpec.
--   
--   Default: inherit
setStdout :: StreamSpec 'STOutput stdout -> ProcessConfig stdin stdout0 stderr -> ProcessConfig stdin stdout stderr

-- | Set the child's standard error stream to the given StreamSpec.
--   
--   Default: inherit
setStderr :: StreamSpec 'STOutput stderr -> ProcessConfig stdin stdout stderr0 -> ProcessConfig stdin stdout stderr

-- | Should we close all file descriptors besides stdin, stdout, and
--   stderr? See close_fds for more information.
--   
--   Default: False
setCloseFds :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr

-- | Should we create a new process group?
--   
--   Default: False
setCreateGroup :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr

-- | Delegate handling of Ctrl-C to the child. For more information, see
--   delegate_ctlc.
--   
--   Default: False
setDelegateCtlc :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr

-- | Detach console on Windows, see detach_console.
--   
--   Default: False
setDetachConsole :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr

-- | Create new console on Windows, see create_new_console.
--   
--   Default: False
setCreateNewConsole :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr

-- | Set a new session with the POSIX setsid syscall, does nothing
--   on non-POSIX. See new_session.
--   
--   Default: False
setNewSession :: Bool -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr

-- | Set the child process's group ID with the POSIX setgid
--   syscall, does nothing on non-POSIX. See child_group.
--   
--   Default: False
setChildGroup :: GroupID -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr

-- | Set the child process's user ID with the POSIX setuid
--   syscall, does nothing on non-POSIX. See child_user.
--   
--   Default: False
setChildUser :: UserID -> ProcessConfig stdin stdout stderr -> ProcessConfig stdin stdout stderr

-- | Create a new StreamSpec from the given StdStream and a
--   helper function. This function:
--   
--   
--   
- Takes as input the raw Maybe Handle returned by the
--   createProcess function. This will be determined by the
--   StdStream argument.
--   
- Returns the actual stream value a, as well as a
--   cleanup
--   
- function to be run when calling stopProcess.
--   
mkStreamSpec :: forall a (streamType :: StreamType). StdStream -> (ProcessConfig () () () -> Maybe Handle -> IO (a, IO ())) -> StreamSpec streamType a

-- | A stream spec which simply inherits the stream of the parent process.
inherit :: forall (anyStreamType :: StreamType). StreamSpec anyStreamType ()

-- | A stream spec which will close the stream for the child process. You
--   usually do not want to use this, as it will leave the corresponding
--   file descriptor unassigned and hence available for re-use in the child
--   process. Prefer nullStream unless you're certain you want this
--   behavior.
closed :: forall (anyStreamType :: StreamType). StreamSpec anyStreamType ()

-- | An input stream spec which sets the input to the given
--   ByteString. A separate thread will be forked to write the
--   contents to the child process.
byteStringInput :: ByteString -> StreamSpec 'STInput ()

-- | Capture the output of a process in a ByteString.
--   
--   This function will fork a separate thread to consume all input from
--   the process, and will only make the results available when the
--   underlying Handle is closed. As this is provided as an
--   STM action, you can either check if the result is available, or
--   block until it's ready.
--   
--   In the event of any exception occurring when reading from the
--   Handle, the STM action will throw a
--   ByteStringOutputException.
byteStringOutput :: StreamSpec 'STOutput (STM ByteString)

-- | Create a new pipe between this process and the child, and return a
--   Handle to communicate with the child.
createPipe :: forall (anyStreamType :: StreamType). StreamSpec anyStreamType Handle

-- | Use the provided Handle for the child process, and when the
--   process exits, do not close it. This is useful if, for example,
--   you want to have multiple processes write to the same log file
--   sequentially.
useHandleOpen :: forall (anyStreamType :: StreamType). Handle -> StreamSpec anyStreamType ()

-- | Use the provided Handle for the child process, and when the
--   process exits, close it. If you have no reason to keep the
--   Handle open, you should use this over useHandleOpen.
useHandleClose :: forall (anyStreamType :: StreamType). Handle -> StreamSpec anyStreamType ()

-- | Launch a process based on the given ProcessConfig. You should
--   ensure that you close stopProcess on the result. It's usually
--   better to use one of the functions in this module which ensures
--   stopProcess is called, such as withProcess.
startProcess :: MonadIO m => ProcessConfig stdin stdout stderr -> m (Process stdin stdout stderr)

-- | Close a process and release any resources acquired. This will ensure
--   terminateProcess is called, wait for the process to actually
--   exit, and then close out resources allocated for the streams. In the
--   event of any cleanup exceptions being thrown this will throw an
--   exception.
stopProcess :: MonadIO m => Process stdin stdout stderr -> m ()

-- | Run a process, capture its standard output and error as a
--   ByteString, wait for it to complete, and then return its exit
--   code, output, and error.
--   
--   Note that any previously used setStdout or setStderr
--   will be overridden.
readProcess :: MonadIO m => ProcessConfig stdin stdoutIgnored stderrIgnored -> m (ExitCode, ByteString, ByteString)

-- | Same as readProcess, but instead of returning the
--   ExitCode, checks it with checkExitCode.
--   
--   Exceptions thrown by this function will include stdout and stderr.
readProcess_ :: MonadIO m => ProcessConfig stdin stdoutIgnored stderrIgnored -> m (ByteString, ByteString)

-- | Run the given process, wait for it to exit, and returns its
--   ExitCode.
runProcess :: MonadIO m => ProcessConfig stdin stdout stderr -> m ExitCode

-- | Same as runProcess, but instead of returning the
--   ExitCode, checks it with checkExitCode.
runProcess_ :: MonadIO m => ProcessConfig stdin stdout stderr -> m ()

-- | Same as readProcess, but only read the stdout of the process.
--   Original settings for stderr remain.
readProcessStdout :: MonadIO m => ProcessConfig stdin stdoutIgnored stderr -> m (ExitCode, ByteString)

-- | Same as readProcessStdout, but instead of returning the
--   ExitCode, checks it with checkExitCode.
--   
--   Exceptions thrown by this function will include stdout.
readProcessStdout_ :: MonadIO m => ProcessConfig stdin stdoutIgnored stderr -> m ByteString

-- | Same as readProcess, but only read the stderr of the process.
--   Original settings for stdout remain.
readProcessStderr :: MonadIO m => ProcessConfig stdin stdout stderrIgnored -> m (ExitCode, ByteString)

-- | Same as readProcessStderr, but instead of returning the
--   ExitCode, checks it with checkExitCode.
--   
--   Exceptions thrown by this function will include stderr.
readProcessStderr_ :: MonadIO m => ProcessConfig stdin stdout stderrIgnored -> m ByteString

-- | Wait for the process to exit and then return its ExitCode.
waitExitCode :: MonadIO m => Process stdin stdout stderr -> m ExitCode

-- | Same as waitExitCode, but in STM.
waitExitCodeSTM :: Process stdin stdout stderr -> STM ExitCode

-- | Check if a process has exited and, if so, return its ExitCode.
getExitCode :: MonadIO m => Process stdin stdout stderr -> m (Maybe ExitCode)

-- | Same as getExitCode, but in STM.
getExitCodeSTM :: Process stdin stdout stderr -> STM (Maybe ExitCode)

-- | Wait for a process to exit, and ensure that it exited successfully. If
--   not, throws an ExitCodeException.
--   
--   Exceptions thrown by this function will not include stdout or stderr
--   (This prevents unbounded memory usage from reading them into memory).
--   However, some callers such as readProcess_ catch the exception,
--   add the stdout and stderr, and rethrow.
checkExitCode :: MonadIO m => Process stdin stdout stderr -> m ()

-- | Same as checkExitCode, but in STM.
checkExitCodeSTM :: Process stdin stdout stderr -> STM ()

-- | Get the child's standard input stream value.
getStdin :: Process stdin stdout stderr -> stdin

-- | Get the child's standard output stream value.
getStdout :: Process stdin stdout stderr -> stdout

-- | Get the child's standard error stream value.
getStderr :: Process stdin stdout stderr -> stderr

-- | Exception thrown by checkExitCode in the event of a non-success
--   exit code. Note that checkExitCode is called by other functions
--   as well, like runProcess_ or readProcess_.
--   
--   Note that several functions that throw an ExitCodeException
--   intentionally do not populate eceStdout or eceStderr.
--   This prevents unbounded memory usage for large stdout and stderrs.
data ExitCodeException
ExitCodeException :: ExitCode -> ProcessConfig () () () -> ByteString -> ByteString -> ExitCodeException
[eceExitCode] :: ExitCodeException -> ExitCode
[eceProcessConfig] :: ExitCodeException -> ProcessConfig () () ()
[eceStdout] :: ExitCodeException -> ByteString
[eceStderr] :: ExitCodeException -> ByteString

-- | Wrapper for when an exception is thrown when reading from a child
--   process, used by byteStringOutput.
data ByteStringOutputException
ByteStringOutputException :: SomeException -> ProcessConfig () () () -> ByteStringOutputException

-- | Take ProcessHandle out of the Process. This method is
--   needed in cases one need to use low level functions from the
--   process package. Use cases for this method are:
--   
--   
--   
- Send a special signal to the process.
--   
- Terminate the process group instead of terminating single
--   process.
--   
- Use platform specific API on the underlying process.
--   
--   
--   This method is considered unsafe because the actions it performs on
--   the underlying process may overlap with the functionality that
--   typed-process provides. For example the user should not call
--   waitForProcess on the process handle as eiter
--   waitForProcess or stopProcess will lock. Additionally,
--   even if process was terminated by the terminateProcess or by
--   sending signal, stopProcess should be called either way in
--   order to cleanup resources allocated by the typed-process.
unsafeProcessHandle :: Process stdin stdout stderr -> ProcessHandle
instance RIO.Prelude.Logger.HasLogFunc RIO.Process.LoggedProcessContext
instance RIO.Process.HasProcessContext RIO.Process.LoggedProcessContext
instance RIO.Process.HasProcessContext RIO.Process.ProcessContext
instance GHC.Show.Show RIO.Process.ProcessException
instance GHC.Exception.Type.Exception RIO.Process.ProcessException

-- | Provide a SimpleApp datatype, for providing a basic
--   App-like environment with common functionality built in. This
--   is intended to make it easier to, e.g., use rio's logging and process
--   code from within short scripts.
module RIO.Prelude.Simple

-- | A simple, non-customizable environment type for RIO, which
--   provides common functionality. If it's insufficient for your needs,
--   define your own, custom App data type.
data SimpleApp

-- | Constructor for SimpleApp. In case when ProcessContext
--   is not supplied mkDefaultProcessContext will be used to create
--   it.
mkSimpleApp :: MonadIO m => LogFunc -> Maybe ProcessContext -> m SimpleApp

-- | Run with a default configured SimpleApp, consisting of:
--   
--   
--   
- Logging to stderr
--   
- If the RIO_VERBOSE environment variable is set, turns on
--   verbose logging
--   
- Default process context
--   
runSimpleApp :: MonadIO m => RIO SimpleApp a -> m a
instance RIO.Prelude.Logger.HasLogFunc RIO.Prelude.Simple.SimpleApp
instance RIO.Process.HasProcessContext RIO.Prelude.Simple.SimpleApp

-- | Seq. Import as:
--   
--   
--   import qualified RIO.Seq as Seq
--   
module RIO.Seq
data Seq a
pattern Empty :: Seq a
pattern (:<|) :: a -> Seq a -> Seq a
pattern (:|>) :: Seq a -> a -> Seq a
empty :: Seq a
singleton :: a -> Seq a
(<|) :: a -> Seq a -> Seq a
(|>) :: Seq a -> a -> Seq a
(><) :: Seq a -> Seq a -> Seq a
fromList :: [a] -> Seq a
fromFunction :: Int -> (Int -> a) -> Seq a
fromArray :: Ix i => Array i a -> Seq a
replicate :: Int -> a -> Seq a
replicateA :: Applicative f => Int -> f a -> f (Seq a)
replicateM :: Applicative m => Int -> m a -> m (Seq a)
cycleTaking :: Int -> Seq a -> Seq a
iterateN :: Int -> (a -> a) -> a -> Seq a
unfoldr :: (b -> Maybe (a, b)) -> b -> Seq a
unfoldl :: (b -> Maybe (b, a)) -> b -> Seq a
null :: Seq a -> Bool
length :: Seq a -> Int
data ViewL a
EmptyL :: ViewL a
(:<) :: a -> Seq a -> ViewL a
viewl :: Seq a -> ViewL a
data ViewR a
EmptyR :: ViewR a
(:>) :: Seq a -> a -> ViewR a
viewr :: Seq a -> ViewR a
scanl :: (a -> b -> a) -> a -> Seq b -> Seq a
scanl1 :: (a -> a -> a) -> Seq a -> Seq a
scanr :: (a -> b -> b) -> b -> Seq a -> Seq b
scanr1 :: (a -> a -> a) -> Seq a -> Seq a
tails :: Seq a -> Seq (Seq a)
inits :: Seq a -> Seq (Seq a)
chunksOf :: Int -> Seq a -> Seq (Seq a)
takeWhileL :: (a -> Bool) -> Seq a -> Seq a
takeWhileR :: (a -> Bool) -> Seq a -> Seq a
dropWhileL :: (a -> Bool) -> Seq a -> Seq a
dropWhileR :: (a -> Bool) -> Seq a -> Seq a
spanl :: (a -> Bool) -> Seq a -> (Seq a, Seq a)
spanr :: (a -> Bool) -> Seq a -> (Seq a, Seq a)
breakl :: (a -> Bool) -> Seq a -> (Seq a, Seq a)
breakr :: (a -> Bool) -> Seq a -> (Seq a, Seq a)
partition :: (a -> Bool) -> Seq a -> (Seq a, Seq a)
filter :: (a -> Bool) -> Seq a -> Seq a
sort :: Ord a => Seq a -> Seq a
sortBy :: (a -> a -> Ordering) -> Seq a -> Seq a
unstableSort :: Ord a => Seq a -> Seq a
unstableSortBy :: (a -> a -> Ordering) -> Seq a -> Seq a
lookup :: Int -> Seq a -> Maybe a
(!?) :: Seq a -> Int -> Maybe a
index :: Seq a -> Int -> a
adjust :: (a -> a) -> Int -> Seq a -> Seq a
adjust' :: (a -> a) -> Int -> Seq a -> Seq a
update :: Int -> a -> Seq a -> Seq a
take :: Int -> Seq a -> Seq a
drop :: Int -> Seq a -> Seq a
insertAt :: Int -> a -> Seq a -> Seq a
deleteAt :: Int -> Seq a -> Seq a
splitAt :: Int -> Seq a -> (Seq a, Seq a)
elemIndexL :: Eq a => a -> Seq a -> Maybe Int
elemIndicesL :: Eq a => a -> Seq a -> [Int]
elemIndexR :: Eq a => a -> Seq a -> Maybe Int
elemIndicesR :: Eq a => a -> Seq a -> [Int]
findIndexL :: (a -> Bool) -> Seq a -> Maybe Int
findIndicesL :: (a -> Bool) -> Seq a -> [Int]
findIndexR :: (a -> Bool) -> Seq a -> Maybe Int
findIndicesR :: (a -> Bool) -> Seq a -> [Int]
foldMapWithIndex :: Monoid m => (Int -> a -> m) -> Seq a -> m
foldlWithIndex :: (b -> Int -> a -> b) -> b -> Seq a -> b
foldrWithIndex :: (Int -> a -> b -> b) -> b -> Seq a -> b
mapWithIndex :: (Int -> a -> b) -> Seq a -> Seq b
traverseWithIndex :: Applicative f => (Int -> a -> f b) -> Seq a -> f (Seq b)
reverse :: Seq a -> Seq a
intersperse :: a -> Seq a -> Seq a
zip :: Seq a -> Seq b -> Seq (a, b)
zipWith :: (a -> b -> c) -> Seq a -> Seq b -> Seq c
zip3 :: Seq a -> Seq b -> Seq c -> Seq (a, b, c)
zipWith3 :: (a -> b -> c -> d) -> Seq a -> Seq b -> Seq c -> Seq d
zip4 :: Seq a -> Seq b -> Seq c -> Seq d -> Seq (a, b, c, d)
zipWith4 :: (a -> b -> c -> d -> e) -> Seq a -> Seq b -> Seq c -> Seq d -> Seq e

-- | Set. Import as:
--   
--   
--   import qualified RIO.Set as Set
--   
--   
--   This module does not export any partial or unchecked functions. For
--   those, see RIO.Set.Partial and RIO.Set.Unchecked
module RIO.Set
data Set a
(\\) :: Ord a => Set a -> Set a -> Set a
null :: Set a -> Bool
size :: Set a -> Int
member :: Ord a => a -> Set a -> Bool
notMember :: Ord a => a -> Set a -> Bool
lookupLT :: Ord a => a -> Set a -> Maybe a
lookupGT :: Ord a => a -> Set a -> Maybe a
lookupLE :: Ord a => a -> Set a -> Maybe a
lookupGE :: Ord a => a -> Set a -> Maybe a
isSubsetOf :: Ord a => Set a -> Set a -> Bool
isProperSubsetOf :: Ord a => Set a -> Set a -> Bool
empty :: Set a
singleton :: a -> Set a
insert :: Ord a => a -> Set a -> Set a
delete :: Ord a => a -> Set a -> Set a
union :: Ord a => Set a -> Set a -> Set a
unions :: (Foldable f, Ord a) => f (Set a) -> Set a
difference :: Ord a => Set a -> Set a -> Set a
intersection :: Ord a => Set a -> Set a -> Set a
filter :: (a -> Bool) -> Set a -> Set a
takeWhileAntitone :: (a -> Bool) -> Set a -> Set a
dropWhileAntitone :: (a -> Bool) -> Set a -> Set a
spanAntitone :: (a -> Bool) -> Set a -> (Set a, Set a)
partition :: (a -> Bool) -> Set a -> (Set a, Set a)
split :: Ord a => a -> Set a -> (Set a, Set a)
splitMember :: Ord a => a -> Set a -> (Set a, Bool, Set a)
splitRoot :: Set a -> [Set a]
lookupIndex :: Ord a => a -> Set a -> Maybe Int
take :: Int -> Set a -> Set a
drop :: Int -> Set a -> Set a
splitAt :: Int -> Set a -> (Set a, Set a)
map :: Ord b => (a -> b) -> Set a -> Set b
foldr :: (a -> b -> b) -> b -> Set a -> b
foldl :: (a -> b -> a) -> a -> Set b -> a
foldr' :: (a -> b -> b) -> b -> Set a -> b
foldl' :: (a -> b -> a) -> a -> Set b -> a
lookupMin :: Set a -> Maybe a
lookupMax :: Set a -> Maybe a
deleteMin :: Set a -> Set a
deleteMax :: Set a -> Set a
maxView :: Set a -> Maybe (a, Set a)
minView :: Set a -> Maybe (a, Set a)
elems :: Set a -> [a]
toList :: Set a -> [a]
fromList :: Ord a => [a] -> Set a
toAscList :: Set a -> [a]
toDescList :: Set a -> [a]
showTree :: Show a => Set a -> String
showTreeWith :: Show a => Bool -> Bool -> Set a -> String
valid :: Ord a => Set a -> Bool

-- | Set partial functions. Import as:
--   
--   
--   import qualified RIO.Set.Partial as Set'
--   
module RIO.Set.Partial
findIndex :: Ord a => a -> Set a -> Int
elemAt :: Int -> Set a -> a
deleteAt :: Int -> Set a -> Set a
findMin :: Set a -> a
findMax :: Set a -> a
deleteFindMin :: Set a -> (a, Set a)
deleteFindMax :: Set a -> (a, Set a)

-- | This module contains functions from Data.Set that have
--   unchecked preconditions on their input. If these preconditions are not
--   satisfied, the data structure may end up in an invalid state and other
--   operations may misbehave. Import as:
--   
--   
--   import qualified RIO.Set.Unchecked as Set'
--   
module RIO.Set.Unchecked
mapMonotonic :: (a -> b) -> Set a -> Set b
fromAscList :: Eq a => [a] -> Set a
fromDescList :: Eq a => [a] -> Set a
fromDistinctAscList :: [a] -> Set a
fromDistinctDescList :: [a] -> Set a

-- | Provides reexports of MonadState and related helpers.
module RIO.State
class Monad m => MonadState s (m :: Type -> Type) | m -> s
get :: MonadState s m => m s
put :: MonadState s m => s -> m ()
state :: MonadState s m => (s -> (a, s)) -> m a
gets :: MonadState s m => (s -> a) -> m a
modify :: MonadState s m => (s -> s) -> m ()
modify' :: MonadState s m => (s -> s) -> m ()
type State s = StateT s Identity
runState :: State s a -> s -> (a, s)
evalState :: State s a -> s -> a
execState :: State s a -> s -> s
mapState :: ((a, s) -> (b, s)) -> State s a -> State s b
withState :: (s -> s) -> State s a -> State s a
newtype StateT s (m :: Type -> Type) a
StateT :: (s -> m (a, s)) -> StateT s (m :: Type -> Type) a
[runStateT] :: StateT s (m :: Type -> Type) a -> s -> m (a, s)
evalStateT :: Monad m => StateT s m a -> s -> m a
execStateT :: Monad m => StateT s m a -> s -> m s
mapStateT :: (m (a, s) -> n (b, s)) -> StateT s m a -> StateT s n b
withStateT :: forall s (m :: Type -> Type) a. (s -> s) -> StateT s m a -> StateT s m a

-- | Strict Text. Import as:
--   
--   
--   import qualified RIO.Text as T
--   
--   
--   This module does not export any partial functions. For those, see
--   RIO.Text.Partial
module RIO.Text
data Text
pack :: String -> Text
unpack :: Text -> String
singleton :: Char -> Text
empty :: Text
cons :: Char -> Text -> Text
snoc :: Text -> Char -> Text
append :: Text -> Text -> Text
uncons :: Text -> Maybe (Char, Text)
null :: Text -> Bool
length :: Text -> Int
compareLength :: Text -> Int -> Ordering
map :: (Char -> Char) -> Text -> Text
intercalate :: Text -> [Text] -> Text
intersperse :: Char -> Text -> Text
transpose :: [Text] -> [Text]
reverse :: Text -> Text
toCaseFold :: Text -> Text
toLower :: Text -> Text
toUpper :: Text -> Text
toTitle :: Text -> Text
justifyLeft :: Int -> Char -> Text -> Text
justifyRight :: Int -> Char -> Text -> Text
center :: Int -> Char -> Text -> Text
foldl :: (a -> Char -> a) -> a -> Text -> a
foldl' :: (a -> Char -> a) -> a -> Text -> a
foldr :: (Char -> a -> a) -> a -> Text -> a
concat :: [Text] -> Text
concatMap :: (Char -> Text) -> Text -> Text
any :: (Char -> Bool) -> Text -> Bool
all :: (Char -> Bool) -> Text -> Bool
scanl :: (Char -> Char -> Char) -> Char -> Text -> Text
scanl1 :: (Char -> Char -> Char) -> Text -> Text
scanr :: (Char -> Char -> Char) -> Char -> Text -> Text
scanr1 :: (Char -> Char -> Char) -> Text -> Text
mapAccumL :: (a -> Char -> (a, Char)) -> a -> Text -> (a, Text)
mapAccumR :: (a -> Char -> (a, Char)) -> a -> Text -> (a, Text)
replicate :: Int -> Text -> Text
unfoldr :: (a -> Maybe (Char, a)) -> a -> Text
unfoldrN :: Int -> (a -> Maybe (Char, a)) -> a -> Text
take :: Int -> Text -> Text
takeEnd :: Int -> Text -> Text
drop :: Int -> Text -> Text
dropEnd :: Int -> Text -> Text
takeWhile :: (Char -> Bool) -> Text -> Text
takeWhileEnd :: (Char -> Bool) -> Text -> Text
dropWhile :: (Char -> Bool) -> Text -> Text
dropWhileEnd :: (Char -> Bool) -> Text -> Text
dropAround :: (Char -> Bool) -> Text -> Text
strip :: Text -> Text
stripStart :: Text -> Text
stripEnd :: Text -> Text
splitAt :: Int -> Text -> (Text, Text)
break :: (Char -> Bool) -> Text -> (Text, Text)
span :: (Char -> Bool) -> Text -> (Text, Text)
group :: Text -> [Text]
groupBy :: (Char -> Char -> Bool) -> Text -> [Text]
inits :: Text -> [Text]
tails :: Text -> [Text]
split :: (Char -> Bool) -> Text -> [Text]
chunksOf :: Int -> Text -> [Text]
lines :: Text -> [Text]

-- | linesCR breaks a Text up into a list of Texts at
--   newline Chars. It is very similar to lines, but it also
--   removes any trailing 'r' characters. The resulting
--   Text values do not contain newlines or trailing 'r'
--   characters.
linesCR :: Text -> [Text]
words :: Text -> [Text]
unlines :: [Text] -> Text
unwords :: [Text] -> Text
isPrefixOf :: Text -> Text -> Bool
isSuffixOf :: Text -> Text -> Bool
isInfixOf :: Text -> Text -> Bool
stripPrefix :: Text -> Text -> Maybe Text
stripSuffix :: Text -> Text -> Maybe Text

-- | Drop prefix if present, otherwise return original Text.
dropPrefix :: Text -> Text -> Text

-- | Drop prefix if present, otherwise return original Text.
dropSuffix :: Text -> Text -> Text
commonPrefixes :: Text -> Text -> Maybe (Text, Text, Text)
filter :: (Char -> Bool) -> Text -> Text
find :: (Char -> Bool) -> Text -> Maybe Char
partition :: (Char -> Bool) -> Text -> (Text, Text)
index :: Text -> Int -> Char
findIndex :: (Char -> Bool) -> Text -> Maybe Int
zip :: Text -> Text -> [(Char, Char)]
zipWith :: (Char -> Char -> Char) -> Text -> Text -> Text
copy :: Text -> Text
unpackCString# :: Addr# -> Text
encodeUtf8 :: Text -> ByteString
decodeUtf8With :: OnDecodeError -> ByteString -> Text
decodeUtf8' :: ByteString -> Either UnicodeException Text
lenientDecode :: OnDecodeError

module RIO

-- | The Reader+IO monad. This is different from a ReaderT because:
--   
--   
--   
- It's not a transformer, it hardcodes IO for simpler usage and
--   error messages.
--   
- Instances of typeclasses like MonadLogger are implemented
--   using classes defined on the environment, instead of using an
--   underlying monad.
--   
newtype RIO env a
RIO :: ReaderT env IO a -> RIO env a
[unRIO] :: RIO env a -> ReaderT env IO a

-- | Using the environment run in IO the action that requires that
--   environment.
runRIO :: MonadIO m => env -> RIO env a -> m a

-- | Abstract RIO to an arbitrary MonadReader instance, which
--   can handle IO.
liftRIO :: (MonadIO m, MonadReader env m) => RIO env a -> m a

-- | Given a LogOptions value, run the given function with the
--   specified LogFunc. A common way to use this function is:
--   
--   
--   let isVerbose = False -- get from the command line instead
--   logOptions' <- logOptionsHandle stderr isVerbose
--   let logOptions = setLogUseTime True logOptions'
--   withLogFunc logOptions $ \lf -> do
--     let app = App -- application specific environment
--           { appLogFunc = lf
--           , appOtherStuff = ...
--           }
--     runRIO app $ do
--       logInfo "Starting app"
--       myApp
--   
withLogFunc :: MonadUnliftIO m => LogOptions -> (LogFunc -> m a) -> m a

-- | Given a LogOptions value, returns both a new LogFunc and
--   a sub-routine that disposes it.
--   
--   Intended for use if you want to deal with the teardown of
--   LogFunc yourself, otherwise prefer the withLogFunc
--   function instead.
newLogFunc :: (MonadIO n, MonadIO m) => LogOptions -> n (LogFunc, m ())

-- | A logging function, wrapped in a newtype for better error messages.
--   
--   An implementation may choose any behavior of this value it wishes,
--   including printing to standard output or no action at all.
data LogFunc

-- | Environment values with a logging function.
class HasLogFunc env
logFuncL :: HasLogFunc env => Lens' env LogFunc

-- | Create a LogOptions value from the given Handle and
--   whether to perform verbose logging or not. Individiual settings can be
--   overridden using appropriate set functions.
--   
--   When Verbose Flag is True, the following happens:
--   
--   
--   
- setLogVerboseFormat is called with True
--   
- setLogUseColor is called with True (except on
--   Windows)
--   
- setLogUseLoc is called with True
--   
- setLogUseTime is called with True
--   
- setLogMinLevel is called with Debug log
--   level
--   
logOptionsHandle :: MonadIO m => Handle -> Bool -> m LogOptions

-- | Configuration for how to create a LogFunc. Intended to be used
--   with the withLogFunc function.
data LogOptions

-- | Set the minimum log level. Messages below this level will not be
--   printed.
--   
--   Default: in verbose mode, LevelDebug. Otherwise,
--   LevelInfo.
setLogMinLevel :: LogLevel -> LogOptions -> LogOptions

-- | Refer to setLogMinLevel. This modifier allows to alter the
--   verbose format value dynamically at runtime.
--   
--   Default: in verbose mode, LevelDebug. Otherwise,
--   LevelInfo.
setLogMinLevelIO :: IO LogLevel -> LogOptions -> LogOptions

-- | Use the verbose format for printing log messages.
--   
--   Default: follows the value of the verbose flag.
setLogVerboseFormat :: Bool -> LogOptions -> LogOptions

-- | Refer to setLogVerboseFormat. This modifier allows to alter the
--   verbose format value dynamically at runtime.
--   
--   Default: follows the value of the verbose flag.
setLogVerboseFormatIO :: IO Bool -> LogOptions -> LogOptions

-- | Do we treat output as a terminal. If True, we will enabled
--   sticky logging functionality.
--   
--   Default: checks if the Handle provided to
--   logOptionsHandle is a terminal with hIsTerminalDevice.
setLogTerminal :: Bool -> LogOptions -> LogOptions

-- | Include the time when printing log messages.
--   
--   Default: True in debug mode, False otherwise.
setLogUseTime :: Bool -> LogOptions -> LogOptions

-- | Use ANSI color codes in the log output.
--   
--   Default: True if in verbose mode and the Handle
--   is a terminal device.
setLogUseColor :: Bool -> LogOptions -> LogOptions

-- | Use code location in the log output.
--   
--   Default: True if in verbose mode, False otherwise.
setLogUseLoc :: Bool -> LogOptions -> LogOptions

-- | Set format method for messages
--   
--   Default: id
setLogFormat :: (Utf8Builder -> Utf8Builder) -> LogOptions -> LogOptions

-- | ANSI color codes for LogLevel in the log output.
--   
--   Default: LevelDebug = "\ESC[32m" -- Green LevelInfo =
--   "\ESC[34m" -- Blue LevelWarn = "\ESC[33m" -- Yellow
--   LevelError = "\ESC[31m" -- Red LevelOther _ = "\ESC[35m"
--   -- Magenta
setLogLevelColors :: (LogLevel -> Utf8Builder) -> LogOptions -> LogOptions

-- | ANSI color codes for secondary content in the log output.
--   
--   Default: "\ESC[90m" -- Bright black (gray)
setLogSecondaryColor :: Utf8Builder -> LogOptions -> LogOptions

-- | ANSI color codes for accents in the log output. Accent colors are
--   indexed by Int.
--   
--   Default: const "\ESC[92m" -- Bright green, for all indicies
setLogAccentColors :: (Int -> Utf8Builder) -> LogOptions -> LogOptions

-- | Log a debug level message with no source.
logDebug :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m ()

-- | Log an info level message with no source.
logInfo :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m ()

-- | Log a warn level message with no source.
logWarn :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m ()

-- | Log an error level message with no source.
logError :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Utf8Builder -> m ()

-- | Log a message with the specified textual level and no source.
logOther :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Text -> Utf8Builder -> m ()

-- | Write a "sticky" line to the terminal. Any subsequent lines will
--   overwrite this one, and that same line will be repeated below again.
--   In other words, the line sticks at the bottom of the output forever.
--   Running this function again will replace the sticky line with a new
--   sticky line. When you want to get rid of the sticky line, run
--   logStickyDone.
--   
--   Note that not all LogFunc implementations will support sticky
--   messages as described. However, the withLogFunc implementation
--   provided by this module does.
logSticky :: (MonadIO m, HasCallStack, MonadReader env m, HasLogFunc env) => Utf8Builder -> m ()

-- | This will print out the given message with a newline and disable any
--   further stickiness of the line until a new call to logSticky
--   happens.
logStickyDone :: (MonadIO m, HasCallStack, MonadReader env m, HasLogFunc env) => Utf8Builder -> m ()

-- | Log a debug level message with the given source.
logDebugS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> Utf8Builder -> m ()

-- | Log an info level message with the given source.
logInfoS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> Utf8Builder -> m ()

-- | Log a warn level message with the given source.
logWarnS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> Utf8Builder -> m ()

-- | Log an error level message with the given source.
logErrorS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> Utf8Builder -> m ()

-- | Log a message with the specified textual level and the given source.
logOtherS :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => Text -> LogSource -> Utf8Builder -> m ()

-- | Generic, basic function for creating other logging functions.
logGeneric :: (MonadIO m, MonadReader env m, HasLogFunc env, HasCallStack) => LogSource -> LogLevel -> Utf8Builder -> m ()

-- | Create a LogFunc from the given function.
mkLogFunc :: (CallStack -> LogSource -> LogLevel -> Utf8Builder -> IO ()) -> LogFunc

-- | Create a LogOptions value which will store its data in memory.
--   This is primarily intended for testing purposes. This will return both
--   a LogOptions value and an IORef containing the resulting
--   Builder value.
--   
--   This will default to non-verbose settings and assume there is a
--   terminal attached. These assumptions can be overridden using the
--   appropriate set functions.
logOptionsMemory :: MonadIO m => m (IORef Builder, LogOptions)

-- | The log level of a message.
data LogLevel
LevelDebug :: LogLevel
LevelInfo :: LogLevel
LevelWarn :: LogLevel
LevelError :: LogLevel
LevelOther :: !Text -> LogLevel

-- | Where in the application a log message came from. Used for display
--   purposes only.
type LogSource = Text
data CallStack

-- | Convert a CallStack value into a Utf8Builder indicating
--   the first source location.
--   
--   TODO Consider showing the entire call stack instead.
displayCallStack :: CallStack -> Utf8Builder

-- | Disable logging capabilities in a given sub-routine
--   
--   Intended to skip logging in general purpose implementations, where
--   secrets might be logged accidently.
noLogging :: (HasLogFunc env, MonadReader env m) => m a -> m a

-- | Is the log func configured to use color output?
--   
--   Intended for use by code which wants to optionally add additional
--   color to its log messages.
logFuncUseColorL :: HasLogFunc env => SimpleGetter env Bool

-- | What color is the log func configured to use for each LogLevel?
--   
--   Intended for use by code which wants to optionally add additional
--   color to its log messages.
logFuncLogLevelColorsL :: HasLogFunc env => SimpleGetter env (LogLevel -> Utf8Builder)

-- | What color is the log func configured to use for secondary content?
--   
--   Intended for use by code which wants to optionally add additional
--   color to its log messages.
logFuncSecondaryColorL :: HasLogFunc env => SimpleGetter env Utf8Builder

-- | What accent colors, indexed by Int, is the log func configured
--   to use?
--   
--   Intended for use by code which wants to optionally add additional
--   color to its log messages.
logFuncAccentColorsL :: HasLogFunc env => SimpleGetter env (Int -> Utf8Builder)

-- | Log a value generically.
glog :: (MonadIO m, HasCallStack, HasGLogFunc env, MonadReader env m) => GMsg env -> m ()

-- | A generic logger of some type msg.
--   
--   Your GLocFunc can re-use the existing classical logging
--   framework of RIO, and/or implement additional transforms, filters.
--   Alternatively, you may log to a JSON source in a database, or anywhere
--   else as needed. You can decide how to log levels or severities based
--   on the constructors in your type. You will normally determine this in
--   your main app entry point.
data GLogFunc msg

-- | Make a GLogFunc via classic LogFunc. Use this if you'd
--   like to log your generic data type via the classic RIO terminal
--   logger.
gLogFuncClassic :: (HasLogLevel msg, HasLogSource msg, Display msg) => LogFunc -> GLogFunc msg

-- | Make a custom generic logger. With this you could, for example, write
--   to a database or a log digestion service. For example:
--   
--   
--   mkGLogFunc (\stack msg -> send (Data.Aeson.encode (JsonLog stack msg)))
--   
mkGLogFunc :: (CallStack -> msg -> IO ()) -> GLogFunc msg

-- | A vesion of contramapMaybeGLogFunc which supports filering.
contramapMaybeGLogFunc :: (a -> Maybe b) -> GLogFunc b -> GLogFunc a

-- | A contramap. Use this to wrap sub-loggers via mapRIO.
--   
--   If you are on base > 4.12.0, you can just use contramap.
contramapGLogFunc :: (a -> b) -> GLogFunc b -> GLogFunc a

-- | An app is capable of generic logging if it implements this.
class HasGLogFunc env where {
    type family GMsg env;
}
gLogFuncL :: HasGLogFunc env => Lens' env (GLogFunc (GMsg env))

-- | Level, if any, of your logs. If unknown, use LogOther. Use
--   for your generic log data types that want to sit inside the classic
--   log framework.
class HasLogLevel msg
getLogLevel :: HasLogLevel msg => msg -> LogLevel

-- | Source of a log. This can be whatever you want. Use for your generic
--   log data types that want to sit inside the classic log framework.
class HasLogSource msg
getLogSource :: HasLogSource msg => msg -> LogSource

-- | A builder of binary data, with the invariant that the underlying data
--   is supposed to be UTF-8 encoded.
newtype Utf8Builder
Utf8Builder :: Builder -> Utf8Builder
[getUtf8Builder] :: Utf8Builder -> Builder

-- | A typeclass for values which can be converted to a Utf8Builder.
--   The intention of this typeclass is to provide a human-friendly display
--   of the data.
class Display a
display :: Display a => a -> Utf8Builder

-- | Display data as Text, which will also be used for
--   display if it is not overriden.
textDisplay :: Display a => a -> Text

-- | Use the Show instance for a value to convert it to a
--   Utf8Builder.
displayShow :: Show a => a -> Utf8Builder

-- | Convert a Utf8Builder value into a strict Text.
utf8BuilderToText :: Utf8Builder -> Text

-- | Convert a Utf8Builder value into a lazy Text.
utf8BuilderToLazyText :: Utf8Builder -> Text

-- | Convert a ByteString into a Utf8Builder.
--   
--   NOTE This function performs no checks to ensure that the data
--   is, in fact, UTF8 encoded. If you provide non-UTF8 data, later
--   functions may fail.
displayBytesUtf8 :: ByteString -> Utf8Builder

-- | Write the given Utf8Builder value to a file.
writeFileUtf8Builder :: MonadIO m => FilePath -> Utf8Builder -> m ()

-- | view is a synonym for (^.), generalised for
--   MonadReader (we are able to use it instead of (^.) since
--   functions are instances of the MonadReader class):
--   
--   
--   >>> view _1 (1, 2)
--   1
--   
--   
--   When you're using Reader for config and your config type has
--   lenses generated for it, most of the time you'll be using view
--   instead of asks:
--   
--   
--   doSomething :: (MonadReader Config m) => m Int
--   doSomething = do
--     thingy        <- view setting1  -- same as “asks (^. setting1)”
--     anotherThingy <- view setting2
--     ...
--   
view :: MonadReader s m => Getting a s a -> m a

-- | preview is a synonym for (^?), generalised for
--   MonadReader (just like view, which is a synonym for
--   (^.)).
--   
--   
--   >>> preview each [1..5]
--   Just 1
--   
preview :: MonadReader s m => Getting (First a) s a -> m (Maybe a)

-- | ASetter s t a b is something that turns a function modifying
--   a value into a function modifying a structure. If you ignore
--   Identity (as Identity a is the same thing as
--   a), the type is:
--   
--   
--   type ASetter s t a b = (a -> b) -> s -> t
--   
--   
--   The reason Identity is used here is for ASetter to be
--   composable with other types, such as Lens.
--   
--   Technically, if you're writing a library, you shouldn't use this type
--   for setters you are exporting from your library; the right type to use
--   is Setter, but it is not provided by this package
--   (because then it'd have to depend on distributive). It's
--   completely alright, however, to export functions which take an
--   ASetter as an argument.
type ASetter s t a b = a -> Identity b -> s -> Identity t

-- | This is a type alias for monomorphic setters which don't change the
--   type of the container (or of the value inside). It's useful more often
--   than the same type in lens, because we can't provide real setters and
--   so it does the job of both ASetter' and
--   Setter'.
type ASetter' s a = ASetter s s a a

-- | Functions that operate on getters and folds – such as (^.),
--   (^..), (^?) – use Getter r s a (with different
--   values of r) to describe what kind of result they need. For
--   instance, (^.) needs the getter to be able to return a single
--   value, and so it accepts a getter of type Getting a s a.
--   (^..) wants the getter to gather values together, so it uses
--   Getting (Endo [a]) s a (it could've used Getting [a] s
--   a instead, but it's faster with Endo). The choice of
--   r depends on what you want to do with elements you're
--   extracting from s.
type Getting r s a = a -> Const r a -> s -> Const r s

-- | Lens s t a b is the lowest common denominator of a setter and
--   a getter, something that has the power of both; it has a
--   Functor constraint, and since both Const and
--   Identity are functors, it can be used whenever a getter or a
--   setter is needed.
--   
--   
--   
- a is the type of the value inside of structure
--   
- b is the type of the replaced value
--   
- s is the type of the whole structure
--   
- t is the type of the structure after replacing a
--   in it with b
--   
type Lens s t a b = forall (f :: Type -> Type). Functor f => a -> f b -> s -> f t

-- | This is a type alias for monomorphic lenses which don't change the
--   type of the container (or of the value inside).
type Lens' s a = Lens s s a a

-- | A SimpleGetter s a extracts a from s; so,
--   it's the same thing as (s -> a), but you can use it in
--   lens chains because its type looks like this:
--   
--   
--   type SimpleGetter s a =
--     forall r. (a -> Const r a) -> s -> Const r s
--   
--   
--   Since Const r is a functor, SimpleGetter has the same
--   shape as other lens types and can be composed with them. To get (s
--   -> a) out of a SimpleGetter, choose r ~ a and
--   feed Const :: a -> Const a a to the getter:
--   
--   
--   -- the actual signature is more permissive:
--   -- view :: Getting a s a -> s -> a
--   view :: SimpleGetter s a -> s -> a
--   view getter = getConst . getter Const
--   
--   
--   The actual Getter from lens is more general:
--   
--   
--   type Getter s a =
--     forall f. (Contravariant f, Functor f) => (a -> f a) -> s -> f s
--   
--   
--   I'm not currently aware of any functions that take lens's
--   Getter but won't accept SimpleGetter, but you should
--   try to avoid exporting SimpleGetters anyway to minimise
--   confusion. Alternatively, look at microlens-contra, which
--   provides a fully lens-compatible Getter.
--   
--   Lens users: you can convert a SimpleGetter to Getter
--   by applying to . view to it.
type SimpleGetter s a = forall r. () => Getting r s a

-- | lens creates a Lens from a getter and a setter. The
--   resulting lens isn't the most effective one (because of having to
--   traverse the structure twice when modifying), but it shouldn't matter
--   much.
--   
--   A (partial) lens for list indexing:
--   
--   
--   ix :: Int -> Lens' [a] a
--   ix i = lens (!! i)                                   -- getter
--               (\s b -> take i s ++ b : drop (i+1) s)   -- setter
--   
--   
--   Usage:
--   
--   
--   >>> [1..9] ^. ix 3
--   4
--   
--   >>> [1..9] & ix 3 %~ negate
--   [1,2,3,-4,5,6,7,8,9]
--   
--   
--   When getting, the setter is completely unused; when setting, the
--   getter is unused. Both are used only when the value is being modified.
--   For instance, here we define a lens for the 1st element of a list, but
--   instead of a legitimate getter we use undefined. Then we use
--   the resulting lens for setting and it works, which proves that
--   the getter wasn't used:
--   
--   
--   >>> [1,2,3] & lens undefined (\s b -> b : tail s) .~ 10
--   [10,2,3]
--   
lens :: (s -> a) -> (s -> b -> t) -> Lens s t a b

-- | over is a synonym for (%~).
--   
--   Getting fmap in a roundabout way:
--   
--   
--   over mapped :: Functor f => (a -> b) -> f a -> f b
--   over mapped = fmap
--   
--   
--   Applying a function to both components of a pair:
--   
--   
--   over both :: (a -> b) -> (a, a) -> (b, b)
--   over both = \f t -> (f (fst t), f (snd t))
--   
--   
--   Using over _2 as a replacement for
--   second:
--   
--   
--   >>> over _2 show (10,20)
--   (10,"20")
--   
over :: ASetter s t a b -> (a -> b) -> s -> t

-- | set is a synonym for (.~).
--   
--   Setting the 1st component of a pair:
--   
--   
--   set _1 :: x -> (a, b) -> (x, b)
--   set _1 = \x t -> (x, snd t)
--   
--   
--   Using it to rewrite (<$):
--   
--   
--   set mapped :: Functor f => a -> f b -> f a
--   set mapped = (<$)
--   
set :: ASetter s t a b -> b -> s -> t

-- | sets creates an ASetter from an ordinary function. (The
--   only thing it does is wrapping and unwrapping Identity.)
sets :: ((a -> b) -> s -> t) -> ASetter s t a b

-- | to creates a getter from any function:
--   
--   
--   a ^. to f = f a
--   
--   
--   It's most useful in chains, because it lets you mix lenses and
--   ordinary functions. Suppose you have a record which comes from some
--   third-party library and doesn't have any lens accessors. You want to
--   do something like this:
--   
--   
--   value ^. _1 . field . at 2
--   
--   
--   However, field isn't a getter, and you have to do this
--   instead:
--   
--   
--   field (value ^. _1) ^. at 2
--   
--   
--   but now value is in the middle and it's hard to read the
--   resulting code. A variant with to is prettier and more
--   readable:
--   
--   
--   value ^. _1 . to field . at 2
--   
to :: (s -> a) -> SimpleGetter s a

-- | (^.) applies a getter to a value; in other words, it gets a
--   value out of a structure using a getter (which can be a lens,
--   traversal, fold, etc.).
--   
--   Getting 1st field of a tuple:
--   
--   
--   (^. _1) :: (a, b) -> a
--   (^. _1) = fst
--   
--   
--   When (^.) is used with a traversal, it combines all results
--   using the Monoid instance for the resulting type. For instance,
--   for lists it would be simple concatenation:
--   
--   
--   >>> ("str","ing") ^. each
--   "string"
--   
--   
--   The reason for this is that traversals use Applicative, and the
--   Applicative instance for Const uses monoid concatenation
--   to combine “effects” of Const.
--   
--   A non-operator version of (^.) is called view, and
--   it's a bit more general than (^.) (it works in
--   MonadReader). If you need the general version, you can get it
--   from microlens-mtl; otherwise there's view available in
--   Lens.Micro.Extras.
(^.) :: s -> Getting a s a -> a
infixl 8 ^.

-- | s ^? t returns the 1st element t returns, or
--   Nothing if t doesn't return anything. It's trivially
--   implemented by passing the First monoid to the getter.
--   
--   Safe head:
--   
--   
--   >>> [] ^? each
--   Nothing
--   
--   
--   
--   >>> [1..3] ^? each
--   Just 1
--   
--   
--   Converting Either to Maybe:
--   
--   
--   >>> Left 1 ^? _Right
--   Nothing
--   
--   
--   
--   >>> Right 1 ^? _Right
--   Just 1
--   
--   
--   A non-operator version of (^?) is called preview, and
--   – like view – it's a bit more general than (^?) (it
--   works in MonadReader). If you need the general version, you
--   can get it from microlens-mtl; otherwise there's preview
--   available in Lens.Micro.Extras.
(^?) :: s -> Getting (First a) s a -> Maybe a
infixl 8 ^?

-- | s ^.. t returns the list of all values that t gets
--   from s.
--   
--   A Maybe contains either 0 or 1 values:
--   
--   
--   >>> Just 3 ^.. _Just
--   [3]
--   
--   
--   Gathering all values in a list of tuples:
--   
--   
--   >>> [(1,2),(3,4)] ^.. each.each
--   [1,2,3,4]
--   
(^..) :: s -> Getting (Endo [a]) s a -> [a]
infixl 8 ^..

-- | (%~) applies a function to the target; an alternative
--   explanation is that it is an inverse of sets, which turns a
--   setter into an ordinary function. mapped %~
--   reverse is the same thing as fmap
--   reverse.
--   
--   See over if you want a non-operator synonym.
--   
--   Negating the 1st element of a pair:
--   
--   
--   >>> (1,2) & _1 %~ negate
--   (-1,2)
--   
--   
--   Turning all Lefts in a list to upper case:
--   
--   
--   >>> (mapped._Left.mapped %~ toUpper) [Left "foo", Right "bar"]
--   [Left "FOO",Right "bar"]
--   
(%~) :: ASetter s t a b -> (a -> b) -> s -> t
infixr 4 %~

-- | (.~) assigns a value to the target. It's the same thing as
--   using (%~) with const:
--   
--   
--   l .~ x = l %~ const x
--   
--   
--   See set if you want a non-operator synonym.
--   
--   Here it is used to change 2 fields of a 3-tuple:
--   
--   
--   >>> (0,0,0) & _1 .~ 1 & _3 .~ 3
--   (1,0,3)
--   
(.~) :: ASetter s t a b -> b -> s -> t
infixr 4 .~
data ThreadId

-- | Lifted version of myThreadId.
myThreadId :: MonadIO m => m ThreadId

-- | Lifted version of isCurrentThreadBound.
isCurrentThreadBound :: MonadIO m => m Bool

-- | Lifted version of threadWaitRead.
threadWaitRead :: MonadIO m => Fd -> m ()

-- | Lifted version of threadWaitWrite.
threadWaitWrite :: MonadIO m => Fd -> m ()

-- | Lifted version of threadDelay.
threadDelay :: MonadIO m => Int -> m ()
yieldThread :: MonadIO m => m ()

-- | Throw an exception. Note that this throws when this action is run in
--   the monad m, not when it is applied. It is a generalization
--   of Control.Exception's throwIO.
--   
--   Should satisfy the law:
--   
--   
--   throwM e >> f = throwM e
--   
throwM :: (MonadThrow m, Exception e) => e -> m a

-- | Lazily get the contents of a file. Unlike readFile, this
--   ensures that if an exception is thrown, the file handle is closed
--   immediately.
withLazyFile :: MonadUnliftIO m => FilePath -> (ByteString -> m a) -> m a

-- | Lazily read a file in UTF8 encoding.
withLazyFileUtf8 :: MonadUnliftIO m => FilePath -> (Text -> m a) -> m a

-- | Same as readFile, but generalized to MonadIO
readFileBinary :: MonadIO m => FilePath -> m ByteString

-- | Same as writeFile, but generalized to MonadIO
writeFileBinary :: MonadIO m => FilePath -> ByteString -> m ()

-- | Read a file in UTF8 encoding, throwing an exception on invalid
--   character encoding.
--   
--   This function will use OS-specific line ending handling.
readFileUtf8 :: MonadIO m => FilePath -> m Text

-- | Write a file in UTF8 encoding
--   
--   This function will use OS-specific line ending handling.
writeFileUtf8 :: MonadIO m => FilePath -> Text -> m ()
hPutBuilder :: MonadIO m => Handle -> Builder -> m ()

-- | Lifted version of "System.Exit.exitFailure".
--   
--   @since 0.1.9.0.
exitFailure :: MonadIO m => m a

-- | Lifted version of "System.Exit.exitSuccess".
--   
--   @since 0.1.9.0.
exitSuccess :: MonadIO m => m a

-- | Lifted version of "System.Exit.exitWith".
--   
--   @since 0.1.9.0.
exitWith :: MonadIO m => ExitCode -> m a
data ExitCode
ExitSuccess :: ExitCode
ExitFailure :: Int -> ExitCode

-- | Environment values with writing capabilities to SomeRef
class HasWriteRef w env | env -> w
writeRefL :: HasWriteRef w env => Lens' env (SomeRef w)

-- | Environment values with stateful capabilities to SomeRef
class HasStateRef s env | env -> s
stateRefL :: HasStateRef s env => Lens' env (SomeRef s)

-- | Abstraction over how to read from and write to a mutable reference
data SomeRef a

-- | Lift one RIO env to another.
mapRIO :: (outer -> inner) -> RIO inner a -> RIO outer a

-- | Read from a SomeRef
readSomeRef :: MonadIO m => SomeRef a -> m a

-- | Write to a SomeRef
writeSomeRef :: MonadIO m => SomeRef a -> a -> m ()

-- | Modify a SomeRef This function is subject to change due to the lack of
--   atomic operations
modifySomeRef :: MonadIO m => SomeRef a -> (a -> a) -> m ()

-- | create a new boxed SomeRef
newSomeRef :: MonadIO m => a -> m (SomeRef a)

-- | create a new unboxed SomeRef
newUnboxedSomeRef :: (MonadIO m, Unbox a) => a -> m (SomeRef a)

-- | An unboxed reference. This works like an IORef, but the data is
--   stored in a bytearray instead of a heap object, avoiding significant
--   allocation overhead in some cases. For a concrete example, see this
--   Stack Overflow question:
--   https://stackoverflow.com/questions/27261813/why-is-my-little-stref-int-require-allocating-gigabytes.
--   
--   The first parameter is the state token type, the same as would be used
--   for the ST monad. If you're using an IO-based monad, you
--   can use the convenience IOURef type synonym instead.
data URef s a

-- | Helpful type synonym for using a URef from an IO-based
--   stack.
type IOURef = URef (PrimState IO)

-- | Create a new URef
newURef :: (PrimMonad m, Unbox a) => a -> m (URef (PrimState m) a)

-- | Read the value in a URef
readURef :: (PrimMonad m, Unbox a) => URef (PrimState m) a -> m a

-- | Write a value into a URef. Note that this action is strict, and
--   will force evalution of the value.
writeURef :: (PrimMonad m, Unbox a) => URef (PrimState m) a -> a -> m ()

-- | Modify a value in a URef. Note that this action is strict, and
--   will force evaluation of the result value.
modifyURef :: (PrimMonad m, Unbox a) => URef (PrimState m) a -> (a -> a) -> m ()

-- | Warning: Trace statement left in code
trace :: Text -> a -> a

-- | Warning: Trace statement left in code
traceId :: Text -> Text

-- | Warning: Trace statement left in code
traceIO :: MonadIO m => Text -> m ()

-- | Warning: Trace statement left in code
traceM :: Applicative f => Text -> f ()

-- | Warning: Trace statement left in code
traceEvent :: Text -> a -> a

-- | Warning: Trace statement left in code
traceEventIO :: MonadIO m => Text -> m ()

-- | Warning: Trace statement left in code
traceMarker :: Text -> a -> a

-- | Warning: Trace statement left in code
traceMarkerIO :: MonadIO m => Text -> m ()

-- | Warning: Trace statement left in code
traceStack :: Text -> a -> a

-- | Warning: Trace statement left in code
traceShow :: Show a => a -> b -> b

-- | Warning: Trace statement left in code
traceShowId :: Show a => a -> a

-- | Warning: Trace statement left in code
traceShowIO :: (Show a, MonadIO m) => a -> m ()

-- | Warning: Trace statement left in code
traceShowM :: (Show a, Applicative f) => a -> f ()

-- | Warning: Trace statement left in code
traceShowEvent :: Show a => a -> b -> b

-- | Warning: Trace statement left in code
traceShowEventIO :: (Show a, MonadIO m) => a -> m ()

-- | Warning: Trace statement left in code
traceShowMarker :: Show a => a -> b -> b

-- | Warning: Trace statement left in code
traceShowMarkerIO :: (Show a, MonadIO m) => a -> m ()

-- | Warning: Trace statement left in code
traceShowStack :: Show a => a -> b -> b

-- | Warning: Trace statement left in code
traceDisplay :: Display a => a -> b -> b

-- | Warning: Trace statement left in code
traceDisplayId :: Display a => a -> a

-- | Warning: Trace statement left in code
traceDisplayIO :: (Display a, MonadIO m) => a -> m ()

-- | Warning: Trace statement left in code
traceDisplayM :: (Display a, Applicative f) => a -> f ()

-- | Warning: Trace statement left in code
traceDisplayEvent :: Display a => a -> b -> b

-- | Warning: Trace statement left in code
traceDisplayEventIO :: (Display a, MonadIO m) => a -> m ()

-- | Warning: Trace statement left in code
traceDisplayMarker :: Display a => a -> b -> b

-- | Warning: Trace statement left in code
traceDisplayMarkerIO :: (Display a, MonadIO m) => a -> m ()

-- | Warning: Trace statement left in code
traceDisplayStack :: Display a => a -> b -> b

-- | Lazy ByteString. Import as:
--   
--   
--   import qualified RIO.ByteString.Lazy as BL
--   
--   
--   This module does not export any partial functions. For those, see
--   RIO.ByteString.Lazy.Partial
module RIO.ByteString.Lazy
data ByteString
empty :: ByteString
singleton :: Word8 -> ByteString
pack :: [Word8] -> ByteString
unpack :: ByteString -> [Word8]
fromStrict :: ByteString -> ByteString
toStrict :: ByteString -> ByteString
fromChunks :: [ByteString] -> ByteString
toChunks :: ByteString -> [ByteString]
foldrChunks :: (ByteString -> a -> a) -> a -> ByteString -> a
foldlChunks :: (a -> ByteString -> a) -> a -> ByteString -> a
cons :: Word8 -> ByteString -> ByteString
cons' :: Word8 -> ByteString -> ByteString
snoc :: ByteString -> Word8 -> ByteString
append :: ByteString -> ByteString -> ByteString
uncons :: ByteString -> Maybe (Word8, ByteString)
unsnoc :: ByteString -> Maybe (ByteString, Word8)
null :: ByteString -> Bool
length :: ByteString -> Int64
map :: (Word8 -> Word8) -> ByteString -> ByteString
reverse :: ByteString -> ByteString
intersperse :: Word8 -> ByteString -> ByteString
intercalate :: ByteString -> [ByteString] -> ByteString
transpose :: [ByteString] -> [ByteString]
foldl :: (a -> Word8 -> a) -> a -> ByteString -> a
foldl' :: (a -> Word8 -> a) -> a -> ByteString -> a
foldr :: (Word8 -> a -> a) -> a -> ByteString -> a
concat :: [ByteString] -> ByteString
concatMap :: (Word8 -> ByteString) -> ByteString -> ByteString
any :: (Word8 -> Bool) -> ByteString -> Bool
all :: (Word8 -> Bool) -> ByteString -> Bool
scanl :: (Word8 -> Word8 -> Word8) -> Word8 -> ByteString -> ByteString
mapAccumL :: (acc -> Word8 -> (acc, Word8)) -> acc -> ByteString -> (acc, ByteString)
mapAccumR :: (acc -> Word8 -> (acc, Word8)) -> acc -> ByteString -> (acc, ByteString)
repeat :: Word8 -> ByteString
replicate :: Int64 -> Word8 -> ByteString
cycle :: ByteString -> ByteString
iterate :: (Word8 -> Word8) -> Word8 -> ByteString
unfoldr :: (a -> Maybe (Word8, a)) -> a -> ByteString
take :: Int64 -> ByteString -> ByteString
drop :: Int64 -> ByteString -> ByteString
splitAt :: Int64 -> ByteString -> (ByteString, ByteString)
takeWhile :: (Word8 -> Bool) -> ByteString -> ByteString
dropWhile :: (Word8 -> Bool) -> ByteString -> ByteString
span :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString)
break :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString)
group :: ByteString -> [ByteString]
groupBy :: (Word8 -> Word8 -> Bool) -> ByteString -> [ByteString]
inits :: ByteString -> [ByteString]
tails :: ByteString -> [ByteString]
stripPrefix :: ByteString -> ByteString -> Maybe ByteString
stripSuffix :: ByteString -> ByteString -> Maybe ByteString
split :: Word8 -> ByteString -> [ByteString]
splitWith :: (Word8 -> Bool) -> ByteString -> [ByteString]
isPrefixOf :: ByteString -> ByteString -> Bool
isSuffixOf :: ByteString -> ByteString -> Bool
elem :: Word8 -> ByteString -> Bool
notElem :: Word8 -> ByteString -> Bool
find :: (Word8 -> Bool) -> ByteString -> Maybe Word8
filter :: (Word8 -> Bool) -> ByteString -> ByteString
partition :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString)
index :: ByteString -> Int64 -> Word8
elemIndex :: Word8 -> ByteString -> Maybe Int64
elemIndexEnd :: Word8 -> ByteString -> Maybe Int64
elemIndices :: Word8 -> ByteString -> [Int64]
findIndex :: (Word8 -> Bool) -> ByteString -> Maybe Int64
findIndices :: (Word8 -> Bool) -> ByteString -> [Int64]
count :: Word8 -> ByteString -> Int64
zip :: ByteString -> ByteString -> [(Word8, Word8)]
zipWith :: (Word8 -> Word8 -> a) -> ByteString -> ByteString -> [a]
unzip :: [(Word8, Word8)] -> (ByteString, ByteString)
copy :: ByteString -> ByteString

-- | Lifted getContents
getContents :: MonadIO m => m LByteString

-- | Lifted putStr
putStr :: MonadIO m => LByteString -> m ()

-- | Lifted putStrLn
putStrLn :: MonadIO m => LByteString -> m ()

-- | Lifted interact
interact :: MonadIO m => (LByteString -> LByteString) -> m ()

-- | Lifted readFile
readFile :: MonadIO m => FilePath -> m LByteString

-- | Lifted writeFile
writeFile :: MonadIO m => FilePath -> LByteString -> m ()

-- | Lifted appendFile
appendFile :: MonadIO m => FilePath -> LByteString -> m ()

-- | Lifted hGetContents
hGetContents :: MonadIO m => Handle -> m LByteString

-- | Lifted hGet
hGet :: MonadIO m => Handle -> Int -> m LByteString

-- | Lifted hGetNonBlocking
hGetNonBlocking :: MonadIO m => Handle -> Int -> m LByteString

-- | Lifted hPut
hPut :: MonadIO m => Handle -> LByteString -> m ()

-- | Lifted hPutNonBlocking
hPutNonBlocking :: MonadIO m => Handle -> LByteString -> m LByteString

-- | Lifted hPutStr
hPutStr :: MonadIO m => Handle -> LByteString -> m ()

-- | Strict ByteString. Import as:
--   
--   
--   import qualified RIO.ByteString as B
--   
--   
--   This module does not export any partial functions. For those, see
--   RIO.ByteString.Partial
module RIO.ByteString
data ByteString
singleton :: Word8 -> ByteString
reverse :: ByteString -> ByteString
all :: (Word8 -> Bool) -> ByteString -> Bool
any :: (Word8 -> Bool) -> ByteString -> Bool
append :: ByteString -> ByteString -> ByteString
break :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString)
breakEnd :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString)
breakSubstring :: ByteString -> ByteString -> (ByteString, ByteString)
concat :: [ByteString] -> ByteString
concatMap :: (Word8 -> ByteString) -> ByteString -> ByteString
cons :: Word8 -> ByteString -> ByteString
copy :: ByteString -> ByteString
count :: Word8 -> ByteString -> Int
drop :: Int -> ByteString -> ByteString
dropWhile :: (Word8 -> Bool) -> ByteString -> ByteString
elem :: Word8 -> ByteString -> Bool
elemIndex :: Word8 -> ByteString -> Maybe Int
elemIndexEnd :: Word8 -> ByteString -> Maybe Int
elemIndices :: Word8 -> ByteString -> [Int]
empty :: ByteString
filter :: (Word8 -> Bool) -> ByteString -> ByteString
find :: (Word8 -> Bool) -> ByteString -> Maybe Word8
findIndex :: (Word8 -> Bool) -> ByteString -> Maybe Int
findIndices :: (Word8 -> Bool) -> ByteString -> [Int]
foldl :: (a -> Word8 -> a) -> a -> ByteString -> a
foldl' :: (a -> Word8 -> a) -> a -> ByteString -> a
foldr :: (Word8 -> a -> a) -> a -> ByteString -> a
foldr' :: (Word8 -> a -> a) -> a -> ByteString -> a
group :: ByteString -> [ByteString]
groupBy :: (Word8 -> Word8 -> Bool) -> ByteString -> [ByteString]
index :: ByteString -> Int -> Word8
inits :: ByteString -> [ByteString]
intercalate :: ByteString -> [ByteString] -> ByteString
intersperse :: Word8 -> ByteString -> ByteString
isInfixOf :: ByteString -> ByteString -> Bool
isPrefixOf :: ByteString -> ByteString -> Bool
isSuffixOf :: ByteString -> ByteString -> Bool
length :: ByteString -> Int
map :: (Word8 -> Word8) -> ByteString -> ByteString
mapAccumL :: (acc -> Word8 -> (acc, Word8)) -> acc -> ByteString -> (acc, ByteString)
mapAccumR :: (acc -> Word8 -> (acc, Word8)) -> acc -> ByteString -> (acc, ByteString)
notElem :: Word8 -> ByteString -> Bool
null :: ByteString -> Bool
pack :: [Word8] -> ByteString
partition :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString)
replicate :: Int -> Word8 -> ByteString
scanl :: (Word8 -> Word8 -> Word8) -> Word8 -> ByteString -> ByteString
scanl1 :: (Word8 -> Word8 -> Word8) -> ByteString -> ByteString
scanr :: (Word8 -> Word8 -> Word8) -> Word8 -> ByteString -> ByteString
scanr1 :: (Word8 -> Word8 -> Word8) -> ByteString -> ByteString
snoc :: ByteString -> Word8 -> ByteString
sort :: ByteString -> ByteString
span :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString)
spanEnd :: (Word8 -> Bool) -> ByteString -> (ByteString, ByteString)
split :: Word8 -> ByteString -> [ByteString]
splitAt :: Int -> ByteString -> (ByteString, ByteString)
splitWith :: (Word8 -> Bool) -> ByteString -> [ByteString]
stripPrefix :: ByteString -> ByteString -> Maybe ByteString
stripSuffix :: ByteString -> ByteString -> Maybe ByteString
tails :: ByteString -> [ByteString]
take :: Int -> ByteString -> ByteString
takeWhile :: (Word8 -> Bool) -> ByteString -> ByteString
transpose :: [ByteString] -> [ByteString]
uncons :: ByteString -> Maybe (Word8, ByteString)
unfoldr :: (a -> Maybe (Word8, a)) -> a -> ByteString
unfoldrN :: Int -> (a -> Maybe (Word8, a)) -> a -> (ByteString, Maybe a)
unpack :: ByteString -> [Word8]
unsnoc :: ByteString -> Maybe (ByteString, Word8)
unzip :: [(Word8, Word8)] -> (ByteString, ByteString)
zip :: ByteString -> ByteString -> [(Word8, Word8)]
zipWith :: (Word8 -> Word8 -> a) -> ByteString -> ByteString -> [a]

-- | Lifted packCString
packCString :: MonadIO m => CString -> m ByteString

-- | Lifted packCStringLen
packCStringLen :: MonadIO m => CStringLen -> m ByteString

-- | Unlifted useAsCString
useAsCString :: MonadUnliftIO m => ByteString -> (CString -> m a) -> m a

-- | Unlifted useAsCStringLen
useAsCStringLen :: MonadUnliftIO m => ByteString -> (CStringLen -> m a) -> m a

-- | Lifted getLine
getLine :: MonadIO m => m ByteString

-- | Lifted getContents
getContents :: MonadIO m => m ByteString

-- | Lifted putStr
putStr :: MonadIO m => ByteString -> m ()

-- | Lifted interact
interact :: MonadIO m => (ByteString -> ByteString) -> m ()

-- | Lifted readFile
readFile :: MonadIO m => FilePath -> m ByteString

-- | Lifted writeFile
writeFile :: MonadIO m => FilePath -> ByteString -> m ()

-- | Lifted appendFile
appendFile :: MonadIO m => FilePath -> ByteString -> m ()

-- | Lifted hGetLine
hGetLine :: MonadIO m => Handle -> m ByteString

-- | Lifted hGetContents
hGetContents :: MonadIO m => Handle -> m ByteString

-- | Lifted hGet
hGet :: MonadIO m => Handle -> Int -> m ByteString

-- | Lifted hGetSome
hGetSome :: MonadIO m => Handle -> Int -> m ByteString

-- | Lifted hGetNonBlocking
hGetNonBlocking :: MonadIO m => Handle -> Int -> m ByteString

-- | Lifted hPut
hPut :: MonadIO m => Handle -> ByteString -> m ()

-- | Lifted hPutNonBlocking
hPutNonBlocking :: MonadIO m => Handle -> ByteString -> m ByteString

-- | Lifted hPutStr
hPutStr :: MonadIO m => Handle -> ByteString -> m ()

-- | Lazy Text. Import as:
--   
--   
--   import qualified RIO.Text.Lazy as TL
--   
--   
--   This module does not export any partial functions. For those, see
--   RIO.Text.Lazy.Partial
module RIO.Text.Lazy
data Text
pack :: String -> Text
unpack :: Text -> String
singleton :: Char -> Text
empty :: Text
fromChunks :: [Text] -> Text
toChunks :: Text -> [Text]
toStrict :: Text -> Text
fromStrict :: Text -> Text
foldrChunks :: (Text -> a -> a) -> a -> Text -> a
foldlChunks :: (a -> Text -> a) -> a -> Text -> a
cons :: Char -> Text -> Text
snoc :: Text -> Char -> Text
append :: Text -> Text -> Text
uncons :: Text -> Maybe (Char, Text)
null :: Text -> Bool
length :: Text -> Int64
compareLength :: Text -> Int64 -> Ordering
map :: (Char -> Char) -> Text -> Text
intercalate :: Text -> [Text] -> Text
intersperse :: Char -> Text -> Text
transpose :: [Text] -> [Text]
reverse :: Text -> Text
toCaseFold :: Text -> Text
toLower :: Text -> Text
toUpper :: Text -> Text
toTitle :: Text -> Text
justifyLeft :: Int64 -> Char -> Text -> Text
justifyRight :: Int64 -> Char -> Text -> Text
center :: Int64 -> Char -> Text -> Text
foldl :: (a -> Char -> a) -> a -> Text -> a
foldl' :: (a -> Char -> a) -> a -> Text -> a
foldr :: (Char -> a -> a) -> a -> Text -> a
concat :: [Text] -> Text
concatMap :: (Char -> Text) -> Text -> Text
any :: (Char -> Bool) -> Text -> Bool
all :: (Char -> Bool) -> Text -> Bool
scanl :: (Char -> Char -> Char) -> Char -> Text -> Text
scanl1 :: (Char -> Char -> Char) -> Text -> Text
scanr :: (Char -> Char -> Char) -> Char -> Text -> Text
scanr1 :: (Char -> Char -> Char) -> Text -> Text
mapAccumL :: (a -> Char -> (a, Char)) -> a -> Text -> (a, Text)
mapAccumR :: (a -> Char -> (a, Char)) -> a -> Text -> (a, Text)
repeat :: Char -> Text
replicate :: Int64 -> Text -> Text
cycle :: Text -> Text
iterate :: (Char -> Char) -> Char -> Text
unfoldr :: (a -> Maybe (Char, a)) -> a -> Text
unfoldrN :: Int64 -> (a -> Maybe (Char, a)) -> a -> Text
take :: Int64 -> Text -> Text
takeEnd :: Int64 -> Text -> Text
drop :: Int64 -> Text -> Text
dropEnd :: Int64 -> Text -> Text
takeWhile :: (Char -> Bool) -> Text -> Text
takeWhileEnd :: (Char -> Bool) -> Text -> Text
dropWhile :: (Char -> Bool) -> Text -> Text
dropWhileEnd :: (Char -> Bool) -> Text -> Text
dropAround :: (Char -> Bool) -> Text -> Text
strip :: Text -> Text
stripStart :: Text -> Text
stripEnd :: Text -> Text
splitAt :: Int64 -> Text -> (Text, Text)
span :: (Char -> Bool) -> Text -> (Text, Text)
break :: (Char -> Bool) -> Text -> (Text, Text)
group :: Text -> [Text]
groupBy :: (Char -> Char -> Bool) -> Text -> [Text]
inits :: Text -> [Text]
tails :: Text -> [Text]
split :: (Char -> Bool) -> Text -> [Text]
chunksOf :: Int64 -> Text -> [Text]
lines :: Text -> [Text]
words :: Text -> [Text]
unlines :: [Text] -> Text
unwords :: [Text] -> Text
isPrefixOf :: Text -> Text -> Bool
isSuffixOf :: Text -> Text -> Bool
isInfixOf :: Text -> Text -> Bool
stripPrefix :: Text -> Text -> Maybe Text
stripSuffix :: Text -> Text -> Maybe Text
commonPrefixes :: Text -> Text -> Maybe (Text, Text, Text)
filter :: (Char -> Bool) -> Text -> Text
find :: (Char -> Bool) -> Text -> Maybe Char
partition :: (Char -> Bool) -> Text -> (Text, Text)
index :: Text -> Int64 -> Char
count :: Text -> Text -> Int64
zip :: Text -> Text -> [(Char, Char)]
zipWith :: (Char -> Char -> Char) -> Text -> Text -> Text

-- | Lazy Text partial functions. Import as:
--   
--   
--   import qualified RIO.Text.Lazy.Partial as TL'
--   
module RIO.Text.Lazy.Partial
head :: Text -> Char
last :: Text -> Char
tail :: Text -> Text
init :: Text -> Text
replace :: Text -> Text -> Text -> Text
foldl1 :: (Char -> Char -> Char) -> Text -> Char
foldl1' :: (Char -> Char -> Char) -> Text -> Char
foldr1 :: (Char -> Char -> Char) -> Text -> Char
maximum :: Text -> Char
minimum :: Text -> Char
breakOn :: Text -> Text -> (Text, Text)
breakOnEnd :: Text -> Text -> (Text, Text)
splitOn :: Text -> Text -> [Text]
breakOnAll :: Text -> Text -> [(Text, Text)]

-- | Strict Text partial functions. Import as:
--   
--   
--   import qualified RIO.Text.Partial as T'
--   
module RIO.Text.Partial
head :: Text -> Char
last :: Text -> Char
tail :: Text -> Text
init :: Text -> Text
replace :: Text -> Text -> Text -> Text
foldl1 :: (Char -> Char -> Char) -> Text -> Char
foldl1' :: (Char -> Char -> Char) -> Text -> Char
foldr1 :: (Char -> Char -> Char) -> Text -> Char
maximum :: Text -> Char
minimum :: Text -> Char
breakOn :: Text -> Text -> (Text, Text)
breakOnEnd :: Text -> Text -> (Text, Text)
splitOn :: Text -> Text -> [Text]
breakOnAll :: Text -> Text -> [(Text, Text)]
count :: Text -> Text -> Int

module RIO.Time
data UTCTime
UTCTime :: Day -> DiffTime -> UTCTime
[utctDay] :: UTCTime -> Day
[utctDayTime] :: UTCTime -> DiffTime
class FormatTime t
data CalendarDiffDays
CalendarDiffDays :: Integer -> Integer -> CalendarDiffDays
[cdMonths] :: CalendarDiffDays -> Integer
[cdDays] :: CalendarDiffDays -> Integer
data CalendarDiffTime
CalendarDiffTime :: Integer -> NominalDiffTime -> CalendarDiffTime
[ctMonths] :: CalendarDiffTime -> Integer
[ctTime] :: CalendarDiffTime -> NominalDiffTime
newtype Day
ModifiedJulianDay :: Integer -> Day
[toModifiedJulianDay] :: Day -> Integer
data DayOfWeek
Monday :: DayOfWeek
Tuesday :: DayOfWeek
Wednesday :: DayOfWeek
Thursday :: DayOfWeek
Friday :: DayOfWeek
Saturday :: DayOfWeek
Sunday :: DayOfWeek
data TimeLocale
TimeLocale :: [(String, String)] -> [(String, String)] -> (String, String) -> String -> String -> String -> String -> [TimeZone] -> TimeLocale
[wDays] :: TimeLocale -> [(String, String)]
[months] :: TimeLocale -> [(String, String)]
[amPm] :: TimeLocale -> (String, String)
[dateTimeFmt] :: TimeLocale -> String
[dateFmt] :: TimeLocale -> String
[timeFmt] :: TimeLocale -> String
[time12Fmt] :: TimeLocale -> String
[knownTimeZones] :: TimeLocale -> [TimeZone]
data DiffTime
data LocalTime
LocalTime :: Day -> TimeOfDay -> LocalTime
[localDay] :: LocalTime -> Day
[localTimeOfDay] :: LocalTime -> TimeOfDay
data NominalDiffTime
data TimeOfDay
TimeOfDay :: Int -> Int -> Pico -> TimeOfDay
[todHour] :: TimeOfDay -> Int
[todMin] :: TimeOfDay -> Int
[todSec] :: TimeOfDay -> Pico
data TimeZone
TimeZone :: Int -> Bool -> String -> TimeZone
[timeZoneMinutes] :: TimeZone -> Int
[timeZoneSummerOnly] :: TimeZone -> Bool
[timeZoneName] :: TimeZone -> String
newtype UniversalTime
ModJulianDate :: Rational -> UniversalTime
[getModJulianDate] :: UniversalTime -> Rational
data ZonedTime
ZonedTime :: LocalTime -> TimeZone -> ZonedTime
[zonedTimeToLocalTime] :: ZonedTime -> LocalTime
[zonedTimeZone] :: ZonedTime -> TimeZone
utc :: TimeZone
defaultTimeLocale :: TimeLocale
iso8601DateFormat :: Maybe String -> String
rfc822DateFormat :: String
parseTime :: ParseTime t => TimeLocale -> String -> String -> Maybe t
parseTimeM :: (MonadFail m, ParseTime t) => Bool -> TimeLocale -> String -> String -> m t
parseTimeOrError :: ParseTime t => Bool -> TimeLocale -> String -> String -> t
readPTime :: ParseTime t => Bool -> TimeLocale -> String -> ReadP t
readSTime :: ParseTime t => Bool -> TimeLocale -> String -> ReadS t
readTime :: ParseTime t => TimeLocale -> String -> String -> t
readsTime :: ParseTime t => TimeLocale -> String -> ReadS t
class ParseTime t
zonedTimeToUTC :: ZonedTime -> UTCTime
utcToZonedTime :: TimeZone -> UTCTime -> ZonedTime
utcToLocalTime :: TimeZone -> UTCTime -> LocalTime
localTimeToUTC :: TimeZone -> LocalTime -> UTCTime
addLocalTime :: NominalDiffTime -> LocalTime -> LocalTime
diffLocalTime :: LocalTime -> LocalTime -> NominalDiffTime
localTimeToUT1 :: Rational -> LocalTime -> UniversalTime
ut1ToLocalTime :: Rational -> UniversalTime -> LocalTime
showGregorian :: Day -> String
addGregorianDurationClip :: CalendarDiffDays -> Day -> Day
addGregorianDurationRollOver :: CalendarDiffDays -> Day -> Day
addGregorianMonthsClip :: Integer -> Day -> Day
addGregorianMonthsRollOver :: Integer -> Day -> Day
addGregorianYearsClip :: Integer -> Day -> Day
addGregorianYearsRollOver :: Integer -> Day -> Day
diffGregorianDurationClip :: Day -> Day -> CalendarDiffDays
diffGregorianDurationRollOver :: Day -> Day -> CalendarDiffDays
fromGregorian :: Integer -> Int -> Int -> Day
fromGregorianValid :: Integer -> Int -> Int -> Maybe Day
gregorianMonthLength :: Integer -> Int -> Int
toGregorian :: Day -> (Integer, Int, Int)
isLeapYear :: Integer -> Bool
addDays :: Integer -> Day -> Day
diffDays :: Day -> Day -> Integer
calendarDay :: CalendarDiffDays
calendarMonth :: CalendarDiffDays
calendarWeek :: CalendarDiffDays
calendarYear :: CalendarDiffDays
scaleCalendarDiffDays :: Integer -> CalendarDiffDays -> CalendarDiffDays
dayOfWeek :: Day -> DayOfWeek
diffTimeToPicoseconds :: DiffTime -> Integer
picosecondsToDiffTime :: Integer -> DiffTime
secondsToDiffTime :: Integer -> DiffTime
nominalDay :: NominalDiffTime
nominalDiffTimeToSeconds :: NominalDiffTime -> Pico
secondsToNominalDiffTime :: Pico -> NominalDiffTime
getTime_resolution :: DiffTime
addUTCTime :: NominalDiffTime -> UTCTime -> UTCTime
diffUTCTime :: UTCTime -> UTCTime -> NominalDiffTime
formatTime :: FormatTime t => TimeLocale -> String -> t -> String
calendarTimeDays :: CalendarDiffDays -> CalendarDiffTime
calendarTimeTime :: NominalDiffTime -> CalendarDiffTime
scaleCalendarDiffTime :: Integer -> CalendarDiffTime -> CalendarDiffTime
dayFractionToTimeOfDay :: Rational -> TimeOfDay
daysAndTimeOfDayToTime :: Integer -> TimeOfDay -> NominalDiffTime
localToUTCTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay)
makeTimeOfDayValid :: Int -> Int -> Pico -> Maybe TimeOfDay
midday :: TimeOfDay
midnight :: TimeOfDay
timeOfDayToDayFraction :: TimeOfDay -> Rational
timeOfDayToTime :: TimeOfDay -> DiffTime
timeToDaysAndTimeOfDay :: NominalDiffTime -> (Integer, TimeOfDay)
timeToTimeOfDay :: DiffTime -> TimeOfDay
utcToLocalTimeOfDay :: TimeZone -> TimeOfDay -> (Integer, TimeOfDay)
hoursToTimeZone :: Int -> TimeZone
minutesToTimeZone :: Int -> TimeZone
timeZoneOffsetString :: TimeZone -> String
timeZoneOffsetString' :: Maybe Char -> TimeZone -> String
getCurrentTime :: MonadIO m => m UTCTime
getTimeZone :: MonadIO m => UTCTime -> m TimeZone
getCurrentTimeZone :: MonadIO m => m TimeZone
getZonedTime :: MonadIO m => m ZonedTime
utcToLocalZonedTime :: MonadIO m => UTCTime -> m ZonedTime

-- | Generic Vector interface. Import as:
--   
--   
--   import qualified RIO.Vector as V
--   
--   
--   This module does not export any partial or unsafe functions. For
--   those, see RIO.Vector.Partial and RIO.Vector.Unsafe
module RIO.Vector

-- | Class of immutable vectors. Every immutable vector is associated with
--   its mutable version through the Mutable type family. Methods of
--   this class should not be used directly. Instead,
--   Data.Vector.Generic and other Data.Vector modules provide safe
--   and fusible wrappers.
--   
--   Minimum complete implementation:
--   
--   
--   
- basicUnsafeFreeze
--   
- basicUnsafeThaw
--   
- basicLength
--   
- basicUnsafeSlice
--   
- basicUnsafeIndexM
--   
class MVector Mutable v a => Vector (v :: Type -> Type) a

-- | O(1) Yield the length of the vector
length :: Vector v a => v a -> Int

-- | O(1) Test whether a vector is empty
null :: Vector v a => v a -> Bool

-- | O(1) Safe indexing
(!?) :: Vector v a => v a -> Int -> Maybe a
infixl 9 !?

-- | O(1) Yield a slice of the vector without copying it. The vector
--   must contain at least i+n elements.
slice :: Vector v a => Int -> Int -> v a -> v a

-- | O(1) Yield the first n elements without copying. The
--   vector may contain less than n elements in which case it is
--   returned unchanged.
take :: Vector v a => Int -> v a -> v a

-- | O(1) Yield all but the first n elements without
--   copying. The vector may contain less than n elements in which
--   case an empty vector is returned.
drop :: Vector v a => Int -> v a -> v a

-- | O(1) Yield the first n elements paired with the
--   remainder without copying.
--   
--   Note that splitAt n v is equivalent to
--   (take n v, drop n v) but slightly more
--   efficient.
splitAt :: Vector v a => Int -> v a -> (v a, v a)

-- | O(1) Empty vector
empty :: Vector v a => v a

-- | O(1) Vector with exactly one element
singleton :: Vector v a => a -> v a

-- | O(n) Vector of the given length with the same value in each
--   position
replicate :: Vector v a => Int -> a -> v a

-- | O(n) Construct a vector of the given length by applying the
--   function to each index
generate :: Vector v a => Int -> (Int -> a) -> v a

-- | O(n) Apply function n times to value. Zeroth element is
--   original value.
iterateN :: Vector v a => Int -> (a -> a) -> a -> v a

-- | O(n) Execute the monadic action the given number of times and
--   store the results in a vector.
replicateM :: (Monad m, Vector v a) => Int -> m a -> m (v a)

-- | O(n) Construct a vector of the given length by applying the
--   monadic action to each index
generateM :: (Monad m, Vector v a) => Int -> (Int -> m a) -> m (v a)

-- | O(n) Apply monadic function n times to value. Zeroth element is
--   original value.
iterateNM :: (Monad m, Vector v a) => Int -> (a -> m a) -> a -> m (v a)

-- | Execute the monadic action and freeze the resulting vector.
--   
--   
--   create (do { v <- new 2; write v 0 'a'; write v 1 'b'; return v }) = <a,b>
--   
create :: Vector v a => (forall s. () => ST s (Mutable v s a)) -> v a

-- | Execute the monadic action and freeze the resulting vectors.
createT :: (Traversable f, Vector v a) => (forall s. () => ST s (f (Mutable v s a))) -> f (v a)

-- | O(n) Construct a vector by repeatedly applying the generator
--   function to a seed. The generator function yields Just the next
--   element and the new seed or Nothing if there are no more
--   elements.
--   
--   
--   unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10
--    = <10,9,8,7,6,5,4,3,2,1>
--   
unfoldr :: Vector v a => (b -> Maybe (a, b)) -> b -> v a

-- | O(n) Construct a vector with at most n elements by
--   repeatedly applying the generator function to a seed. The generator
--   function yields Just the next element and the new seed or
--   Nothing if there are no more elements.
--   
--   
--   unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>
--   
unfoldrN :: Vector v a => Int -> (b -> Maybe (a, b)) -> b -> v a

-- | O(n) Construct a vector by repeatedly applying the monadic
--   generator function to a seed. The generator function yields
--   Just the next element and the new seed or Nothing if
--   there are no more elements.
unfoldrM :: (Monad m, Vector v a) => (b -> m (Maybe (a, b))) -> b -> m (v a)

-- | O(n) Construct a vector by repeatedly applying the monadic
--   generator function to a seed. The generator function yields
--   Just the next element and the new seed or Nothing if
--   there are no more elements.
unfoldrNM :: (Monad m, Vector v a) => Int -> (b -> m (Maybe (a, b))) -> b -> m (v a)

-- | O(n) Construct a vector with n elements by repeatedly
--   applying the generator function to the already constructed part of the
--   vector.
--   
--   
--   constructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in <a,b,c>
--   
constructN :: Vector v a => Int -> (v a -> a) -> v a

-- | O(n) Construct a vector with n elements from right to
--   left by repeatedly applying the generator function to the already
--   constructed part of the vector.
--   
--   
--   constructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in <c,b,a>
--   
constructrN :: Vector v a => Int -> (v a -> a) -> v a

-- | O(n) Yield a vector of the given length containing the values
--   x, x+1 etc. This operation is usually more efficient
--   than enumFromTo.
--   
--   
--   enumFromN 5 3 = <5,6,7>
--   
enumFromN :: (Vector v a, Num a) => a -> Int -> v a

-- | O(n) Yield a vector of the given length containing the values
--   x, x+y, x+y+y etc. This operations is
--   usually more efficient than enumFromThenTo.
--   
--   
--   enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>
--   
enumFromStepN :: (Vector v a, Num a) => a -> a -> Int -> v a

-- | O(n) Enumerate values from x to y.
--   
--   WARNING: This operation can be very inefficient. If at all
--   possible, use enumFromN instead.
enumFromTo :: (Vector v a, Enum a) => a -> a -> v a

-- | O(n) Enumerate values from x to y with a
--   specific step z.
--   
--   WARNING: This operation can be very inefficient. If at all
--   possible, use enumFromStepN instead.
enumFromThenTo :: (Vector v a, Enum a) => a -> a -> a -> v a

-- | O(n) Prepend an element
cons :: Vector v a => a -> v a -> v a

-- | O(n) Append an element
snoc :: Vector v a => v a -> a -> v a

-- | O(m+n) Concatenate two vectors
(++) :: Vector v a => v a -> v a -> v a
infixr 5 ++

-- | O(n) Concatenate all vectors in the list
concat :: Vector v a => [v a] -> v a

-- | O(n) Concatenate all vectors in the non-empty list
concatNE :: Vector v a => NonEmpty (v a) -> v a

-- | O(n) Yield the argument but force it not to retain any extra
--   memory, possibly by copying it.
--   
--   This is especially useful when dealing with slices. For example:
--   
--   
--   force (slice 0 2 <huge vector>)
--   
--   
--   Here, the slice retains a reference to the huge vector. Forcing it
--   creates a copy of just the elements that belong to the slice and
--   allows the huge vector to be garbage collected.
force :: Vector v a => v a -> v a

-- | O(n) Reverse a vector
reverse :: Vector v a => v a -> v a

-- | Apply a destructive operation to a vector. The operation will be
--   performed in place if it is safe to do so and will modify a copy of
--   the vector otherwise.
--   
--   
--   modify (\v -> write v 0 'x') (replicate 3 'a') = <'x','a','a'>
--   
modify :: Vector v a => (forall s. () => Mutable v s a -> ST s ()) -> v a -> v a

-- | O(n) Pair each element in a vector with its index
indexed :: (Vector v a, Vector v (Int, a)) => v a -> v (Int, a)

-- | O(n) Map a function over a vector
map :: (Vector v a, Vector v b) => (a -> b) -> v a -> v b

-- | O(n) Apply a function to every element of a vector and its
--   index
imap :: (Vector v a, Vector v b) => (Int -> a -> b) -> v a -> v b

-- | Map a function over a vector and concatenate the results.
concatMap :: (Vector v a, Vector v b) => (a -> v b) -> v a -> v b

-- | O(n) Apply the monadic action to all elements of the vector,
--   yielding a vector of results
mapM :: (Monad m, Vector v a, Vector v b) => (a -> m b) -> v a -> m (v b)

-- | O(n) Apply the monadic action to every element of a vector and
--   its index, yielding a vector of results
imapM :: (Monad m, Vector v a, Vector v b) => (Int -> a -> m b) -> v a -> m (v b)

-- | O(n) Apply the monadic action to all elements of a vector and
--   ignore the results
mapM_ :: (Monad m, Vector v a) => (a -> m b) -> v a -> m ()

-- | O(n) Apply the monadic action to every element of a vector and
--   its index, ignoring the results
imapM_ :: (Monad m, Vector v a) => (Int -> a -> m b) -> v a -> m ()

-- | O(n) Apply the monadic action to all elements of the vector,
--   yielding a vector of results. Equivalent to flip mapM.
forM :: (Monad m, Vector v a, Vector v b) => v a -> (a -> m b) -> m (v b)

-- | O(n) Apply the monadic action to all elements of a vector and
--   ignore the results. Equivalent to flip mapM_.
forM_ :: (Monad m, Vector v a) => v a -> (a -> m b) -> m ()

-- | O(min(m,n)) Zip two vectors with the given function.
zipWith :: (Vector v a, Vector v b, Vector v c) => (a -> b -> c) -> v a -> v b -> v c

-- | Zip three vectors with the given function.
zipWith3 :: (Vector v a, Vector v b, Vector v c, Vector v d) => (a -> b -> c -> d) -> v a -> v b -> v c -> v d
zipWith4 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e) => (a -> b -> c -> d -> e) -> v a -> v b -> v c -> v d -> v e
zipWith5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f) => (a -> b -> c -> d -> e -> f) -> v a -> v b -> v c -> v d -> v e -> v f
zipWith6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f, Vector v g) => (a -> b -> c -> d -> e -> f -> g) -> v a -> v b -> v c -> v d -> v e -> v f -> v g

-- | O(min(m,n)) Zip two vectors with a function that also takes the
--   elements' indices.
izipWith :: (Vector v a, Vector v b, Vector v c) => (Int -> a -> b -> c) -> v a -> v b -> v c
izipWith3 :: (Vector v a, Vector v b, Vector v c, Vector v d) => (Int -> a -> b -> c -> d) -> v a -> v b -> v c -> v d
izipWith4 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e) => (Int -> a -> b -> c -> d -> e) -> v a -> v b -> v c -> v d -> v e
izipWith5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f) => (Int -> a -> b -> c -> d -> e -> f) -> v a -> v b -> v c -> v d -> v e -> v f
izipWith6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f, Vector v g) => (Int -> a -> b -> c -> d -> e -> f -> g) -> v a -> v b -> v c -> v d -> v e -> v f -> v g

-- | O(min(m,n)) Zip two vectors
zip :: (Vector v a, Vector v b, Vector v (a, b)) => v a -> v b -> v (a, b)
zip3 :: (Vector v a, Vector v b, Vector v c, Vector v (a, b, c)) => v a -> v b -> v c -> v (a, b, c)
zip4 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v (a, b, c, d)) => v a -> v b -> v c -> v d -> v (a, b, c, d)
zip5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v (a, b, c, d, e)) => v a -> v b -> v c -> v d -> v e -> v (a, b, c, d, e)
zip6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f, Vector v (a, b, c, d, e, f)) => v a -> v b -> v c -> v d -> v e -> v f -> v (a, b, c, d, e, f)

-- | O(min(m,n)) Zip the two vectors with the monadic action and
--   yield a vector of results
zipWithM :: (Monad m, Vector v a, Vector v b, Vector v c) => (a -> b -> m c) -> v a -> v b -> m (v c)

-- | O(min(m,n)) Zip the two vectors with a monadic action that also
--   takes the element index and yield a vector of results
izipWithM :: (Monad m, Vector v a, Vector v b, Vector v c) => (Int -> a -> b -> m c) -> v a -> v b -> m (v c)

-- | O(min(m,n)) Zip the two vectors with the monadic action and
--   ignore the results
zipWithM_ :: (Monad m, Vector v a, Vector v b) => (a -> b -> m c) -> v a -> v b -> m ()

-- | O(min(m,n)) Zip the two vectors with a monadic action that also
--   takes the element index and ignore the results
izipWithM_ :: (Monad m, Vector v a, Vector v b) => (Int -> a -> b -> m c) -> v a -> v b -> m ()

-- | O(min(m,n)) Unzip a vector of pairs.
unzip :: (Vector v a, Vector v b, Vector v (a, b)) => v (a, b) -> (v a, v b)
unzip3 :: (Vector v a, Vector v b, Vector v c, Vector v (a, b, c)) => v (a, b, c) -> (v a, v b, v c)
unzip4 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v (a, b, c, d)) => v (a, b, c, d) -> (v a, v b, v c, v d)
unzip5 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v (a, b, c, d, e)) => v (a, b, c, d, e) -> (v a, v b, v c, v d, v e)
unzip6 :: (Vector v a, Vector v b, Vector v c, Vector v d, Vector v e, Vector v f, Vector v (a, b, c, d, e, f)) => v (a, b, c, d, e, f) -> (v a, v b, v c, v d, v e, v f)

-- | O(n) Drop elements that do not satisfy the predicate
filter :: Vector v a => (a -> Bool) -> v a -> v a

-- | O(n) Drop elements that do not satisfy the predicate which is
--   applied to values and their indices
ifilter :: Vector v a => (Int -> a -> Bool) -> v a -> v a

-- | O(n) Drop repeated adjacent elements.
uniq :: (Vector v a, Eq a) => v a -> v a

-- | O(n) Drop elements when predicate returns Nothing
mapMaybe :: (Vector v a, Vector v b) => (a -> Maybe b) -> v a -> v b

-- | O(n) Drop elements when predicate, applied to index and value,
--   returns Nothing
imapMaybe :: (Vector v a, Vector v b) => (Int -> a -> Maybe b) -> v a -> v b

-- | O(n) Drop elements that do not satisfy the monadic predicate
filterM :: (Monad m, Vector v a) => (a -> m Bool) -> v a -> m (v a)

-- | O(n) Yield the longest prefix of elements satisfying the
--   predicate without copying.
takeWhile :: Vector v a => (a -> Bool) -> v a -> v a

-- | O(n) Drop the longest prefix of elements that satisfy the
--   predicate without copying.
dropWhile :: Vector v a => (a -> Bool) -> v a -> v a

-- | O(n) Split the vector in two parts, the first one containing
--   those elements that satisfy the predicate and the second one those
--   that don't. The relative order of the elements is preserved at the
--   cost of a sometimes reduced performance compared to
--   unstablePartition.
partition :: Vector v a => (a -> Bool) -> v a -> (v a, v a)

-- | O(n) Split the vector in two parts, the first one containing
--   those elements that satisfy the predicate and the second one those
--   that don't. The order of the elements is not preserved but the
--   operation is often faster than partition.
unstablePartition :: Vector v a => (a -> Bool) -> v a -> (v a, v a)

-- | O(n) Split the vector into the longest prefix of elements that
--   satisfy the predicate and the rest without copying.
span :: Vector v a => (a -> Bool) -> v a -> (v a, v a)

-- | O(n) Split the vector into the longest prefix of elements that
--   do not satisfy the predicate and the rest without copying.
break :: Vector v a => (a -> Bool) -> v a -> (v a, v a)

-- | O(n) Check if the vector contains an element
elem :: (Vector v a, Eq a) => a -> v a -> Bool
infix 4 `elem`

-- | O(n) Check if the vector does not contain an element (inverse
--   of elem)
notElem :: (Vector v a, Eq a) => a -> v a -> Bool
infix 4 `notElem`

-- | O(n) Yield Just the first element matching the predicate
--   or Nothing if no such element exists.
find :: Vector v a => (a -> Bool) -> v a -> Maybe a

-- | O(n) Yield Just the index of the first element matching
--   the predicate or Nothing if no such element exists.
findIndex :: Vector v a => (a -> Bool) -> v a -> Maybe Int

-- | O(n) Yield the indices of elements satisfying the predicate in
--   ascending order.
findIndices :: (Vector v a, Vector v Int) => (a -> Bool) -> v a -> v Int

-- | O(n) Yield Just the index of the first occurence of the
--   given element or Nothing if the vector does not contain the
--   element. This is a specialised version of findIndex.
elemIndex :: (Vector v a, Eq a) => a -> v a -> Maybe Int

-- | O(n) Yield the indices of all occurences of the given element
--   in ascending order. This is a specialised version of
--   findIndices.
elemIndices :: (Vector v a, Vector v Int, Eq a) => a -> v a -> v Int

-- | O(n) Left fold
foldl :: Vector v b => (a -> b -> a) -> a -> v b -> a

-- | O(n) Left fold with strict accumulator
foldl' :: Vector v b => (a -> b -> a) -> a -> v b -> a

-- | O(n) Right fold
foldr :: Vector v a => (a -> b -> b) -> b -> v a -> b

-- | O(n) Right fold with a strict accumulator
foldr' :: Vector v a => (a -> b -> b) -> b -> v a -> b

-- | O(n) Left fold (function applied to each element and its index)
ifoldl :: Vector v b => (a -> Int -> b -> a) -> a -> v b -> a

-- | O(n) Left fold with strict accumulator (function applied to
--   each element and its index)
ifoldl' :: Vector v b => (a -> Int -> b -> a) -> a -> v b -> a

-- | O(n) Right fold (function applied to each element and its
--   index)
ifoldr :: Vector v a => (Int -> a -> b -> b) -> b -> v a -> b

-- | O(n) Right fold with strict accumulator (function applied to
--   each element and its index)
ifoldr' :: Vector v a => (Int -> a -> b -> b) -> b -> v a -> b

-- | O(n) Check if all elements satisfy the predicate.
all :: Vector v a => (a -> Bool) -> v a -> Bool

-- | O(n) Check if any element satisfies the predicate.
any :: Vector v a => (a -> Bool) -> v a -> Bool

-- | O(n) Check if all elements are True
and :: Vector v Bool => v Bool -> Bool

-- | O(n) Check if any element is True
or :: Vector v Bool => v Bool -> Bool

-- | O(n) Compute the sum of the elements
sum :: (Vector v a, Num a) => v a -> a

-- | O(n) Compute the produce of the elements
product :: (Vector v a, Num a) => v a -> a

-- | O(n) Monadic fold
foldM :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> v b -> m a

-- | O(n) Monadic fold (action applied to each element and its
--   index)
ifoldM :: (Monad m, Vector v b) => (a -> Int -> b -> m a) -> a -> v b -> m a

-- | O(n) Monadic fold with strict accumulator
foldM' :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> v b -> m a

-- | O(n) Monadic fold with strict accumulator (action applied to
--   each element and its index)
ifoldM' :: (Monad m, Vector v b) => (a -> Int -> b -> m a) -> a -> v b -> m a

-- | O(n) Monadic fold that discards the result
foldM_ :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> v b -> m ()

-- | O(n) Monadic fold that discards the result (action applied to
--   each element and its index)
ifoldM_ :: (Monad m, Vector v b) => (a -> Int -> b -> m a) -> a -> v b -> m ()

-- | O(n) Monadic fold with strict accumulator that discards the
--   result
foldM'_ :: (Monad m, Vector v b) => (a -> b -> m a) -> a -> v b -> m ()

-- | O(n) Monadic fold with strict accumulator that discards the
--   result (action applied to each element and its index)
ifoldM'_ :: (Monad m, Vector v b) => (a -> Int -> b -> m a) -> a -> v b -> m ()

-- | Evaluate each action and collect the results
sequence :: (Monad m, Vector v a, Vector v (m a)) => v (m a) -> m (v a)

-- | Evaluate each action and discard the results
sequence_ :: (Monad m, Vector v (m a)) => v (m a) -> m ()

-- | O(n) Prescan
--   
--   
--   prescanl f z = init . scanl f z
--   
--   
--   Example: prescanl (+) 0 <1,2,3,4> = <0,1,3,6>
prescanl :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a

-- | O(n) Prescan with strict accumulator
prescanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a

-- | O(n) Scan
--   
--   
--   postscanl f z = tail . scanl f z
--   
--   
--   Example: postscanl (+) 0 <1,2,3,4> = <1,3,6,10>
postscanl :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a

-- | O(n) Scan with strict accumulator
postscanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a

-- | O(n) Haskell-style scan
--   
--   
--   scanl f z <x1,...,xn> = <y1,...,y(n+1)>
--     where y1 = z
--           yi = f y(i-1) x(i-1)
--   
--   
--   Example: scanl (+) 0 <1,2,3,4> = <0,1,3,6,10>
scanl :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a

-- | O(n) Haskell-style scan with strict accumulator
scanl' :: (Vector v a, Vector v b) => (a -> b -> a) -> a -> v b -> v a

-- | O(n) Scan over a vector with its index
iscanl :: (Vector v a, Vector v b) => (Int -> a -> b -> a) -> a -> v b -> v a

-- | O(n) Scan over a vector (strictly) with its index
iscanl' :: (Vector v a, Vector v b) => (Int -> a -> b -> a) -> a -> v b -> v a

-- | O(n) Right-to-left prescan
--   
--   
--   prescanr f z = reverse . prescanl (flip f) z . reverse
--   
prescanr :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> v a -> v b

-- | O(n) Right-to-left prescan with strict accumulator
prescanr' :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> v a -> v b

-- | O(n) Right-to-left scan
postscanr :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> v a -> v b

-- | O(n) Right-to-left scan with strict accumulator
postscanr' :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> v a -> v b

-- | O(n) Right-to-left Haskell-style scan
scanr :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> v a -> v b

-- | O(n) Right-to-left Haskell-style scan with strict accumulator
scanr' :: (Vector v a, Vector v b) => (a -> b -> b) -> b -> v a -> v b

-- | O(n) Right-to-left scan over a vector with its index
iscanr :: (Vector v a, Vector v b) => (Int -> a -> b -> b) -> b -> v a -> v b

-- | O(n) Right-to-left scan over a vector (strictly) with its index
iscanr' :: (Vector v a, Vector v b) => (Int -> a -> b -> b) -> b -> v a -> v b

-- | O(n) Convert a vector to a list
toList :: Vector v a => v a -> [a]

-- | O(n) Convert a list to a vector
fromList :: Vector v a => [a] -> v a

-- | O(n) Convert the first n elements of a list to a
--   vector
--   
--   
--   fromListN n xs = fromList (take n xs)
--   
fromListN :: Vector v a => Int -> [a] -> v a

-- | O(n) Convert different vector types
convert :: (Vector v a, Vector w a) => v a -> w a

-- | O(n) Yield an immutable copy of the mutable vector.
freeze :: (PrimMonad m, Vector v a) => Mutable v (PrimState m) a -> m (v a)

-- | O(n) Yield a mutable copy of the immutable vector.
thaw :: (PrimMonad m, Vector v a) => v a -> m (Mutable v (PrimState m) a)

-- | O(n) Copy an immutable vector into a mutable one. The two
--   vectors must have the same length.
copy :: (PrimMonad m, Vector v a) => Mutable v (PrimState m) a -> v a -> m ()

-- | O(1) Convert a vector to a Bundle
stream :: Vector v a => v a -> Bundle v a

-- | O(n) Construct a vector from a Bundle
unstream :: Vector v a => Bundle v a -> v a

-- | O(1) Convert a vector to a Bundle, proceeding from right
--   to left
streamR :: forall v a (u :: Type -> Type). Vector v a => v a -> Bundle u a

-- | O(n) Construct a vector from a Bundle, proceeding from
--   right to left
unstreamR :: Vector v a => Bundle v a -> v a

-- | Construct a vector from a monadic initialiser.
new :: Vector v a => New v a -> v a

-- | Convert a vector to an initialiser which, when run, produces a copy of
--   the vector.
clone :: Vector v a => v a -> New v a

-- | O(n) Check if two vectors are equal. All Vector
--   instances are also instances of Eq and it is usually more
--   appropriate to use those. This function is primarily intended for
--   implementing Eq instances for new vector types.
eq :: (Vector v a, Eq a) => v a -> v a -> Bool

-- | O(n) Compare two vectors lexicographically. All Vector
--   instances are also instances of Ord and it is usually more
--   appropriate to use those. This function is primarily intended for
--   implementing Ord instances for new vector types.
cmp :: (Vector v a, Ord a) => v a -> v a -> Ordering

-- | O(n)
eqBy :: (Vector v a, Vector v b) => (a -> b -> Bool) -> v a -> v b -> Bool

-- | O(n)
cmpBy :: (Vector v a, Vector v b) => (a -> b -> Ordering) -> v a -> v b -> Ordering

-- | Generic definition of showsPrec
showsPrec :: (Vector v a, Show a) => Int -> v a -> ShowS

-- | Generic definition of readPrec
readPrec :: (Vector v a, Read a) => ReadPrec (v a)
liftShowsPrec :: Vector v a => (Int -> a -> ShowS) -> ([a] -> ShowS) -> Int -> v a -> ShowS

-- | Note: uses ReadS
liftReadsPrec :: Vector v a => (Int -> ReadS a) -> ReadS [a] -> Int -> ReadS (v a)

-- | Generic definion of gfoldl that views a Vector as a
--   list.
gfoldl :: (Vector v a, Data a) => (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. () => g -> c g) -> v a -> c (v a)
dataCast :: (Vector v a, Data a, Typeable v, Typeable t) => (forall d. Data d => c (t d)) -> Maybe (c (v a))
mkType :: String -> DataType

-- | Boxed Vector. Import as:
--   
--   
--   import qualified RIO.Vector.Boxed as VB
--   
--   
--   This module does not export any partial or unsafe functions. For
--   those, see RIO.Vector.Boxed.Partial and
--   RIO.Vector.Boxed.Unsafe
module RIO.Vector.Boxed

-- | Boxed vectors, supporting efficient slicing.
data Vector a

-- | Mutable boxed vectors keyed on the monad they live in (IO or
--   ST s).
data MVector s a

-- | O(1) Yield the length of the vector
length :: Vector a -> Int

-- | O(1) Test whether a vector is empty
null :: Vector a -> Bool

-- | O(1) Safe indexing
(!?) :: Vector a -> Int -> Maybe a

-- | O(1) Yield a slice of the vector without copying it. The vector
--   must contain at least i+n elements.
slice :: Int -> Int -> Vector a -> Vector a

-- | O(1) Yield at the first n elements without copying.
--   The vector may contain less than n elements in which case it
--   is returned unchanged.
take :: Int -> Vector a -> Vector a

-- | O(1) Yield all but the first n elements without
--   copying. The vector may contain less than n elements in which
--   case an empty vector is returned.
drop :: Int -> Vector a -> Vector a

-- | O(1) Yield the first n elements paired with the
--   remainder without copying.
--   
--   Note that splitAt n v is equivalent to
--   (take n v, drop n v) but slightly more
--   efficient.
splitAt :: Int -> Vector a -> (Vector a, Vector a)

-- | O(1) Empty vector
empty :: Vector a

-- | O(1) Vector with exactly one element
singleton :: a -> Vector a

-- | O(n) Vector of the given length with the same value in each
--   position
replicate :: Int -> a -> Vector a

-- | O(n) Construct a vector of the given length by applying the
--   function to each index
generate :: Int -> (Int -> a) -> Vector a

-- | O(n) Apply function n times to value. Zeroth element is
--   original value.
iterateN :: Int -> (a -> a) -> a -> Vector a

-- | O(n) Execute the monadic action the given number of times and
--   store the results in a vector.
replicateM :: Monad m => Int -> m a -> m (Vector a)

-- | O(n) Construct a vector of the given length by applying the
--   monadic action to each index
generateM :: Monad m => Int -> (Int -> m a) -> m (Vector a)

-- | O(n) Apply monadic function n times to value. Zeroth element is
--   original value.
iterateNM :: Monad m => Int -> (a -> m a) -> a -> m (Vector a)

-- | Execute the monadic action and freeze the resulting vector.
--   
--   
--   create (do { v <- new 2; write v 0 'a'; write v 1 'b'; return v }) = <a,b>
--   
create :: (forall s. () => ST s (MVector s a)) -> Vector a

-- | Execute the monadic action and freeze the resulting vectors.
createT :: Traversable f => (forall s. () => ST s (f (MVector s a))) -> f (Vector a)

-- | O(n) Construct a vector by repeatedly applying the generator
--   function to a seed. The generator function yields Just the next
--   element and the new seed or Nothing if there are no more
--   elements.
--   
--   
--   unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10
--    = <10,9,8,7,6,5,4,3,2,1>
--   
unfoldr :: (b -> Maybe (a, b)) -> b -> Vector a

-- | O(n) Construct a vector with at most n elements by
--   repeatedly applying the generator function to a seed. The generator
--   function yields Just the next element and the new seed or
--   Nothing if there are no more elements.
--   
--   
--   unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>
--   
unfoldrN :: Int -> (b -> Maybe (a, b)) -> b -> Vector a

-- | O(n) Construct a vector by repeatedly applying the monadic
--   generator function to a seed. The generator function yields
--   Just the next element and the new seed or Nothing if
--   there are no more elements.
unfoldrM :: Monad m => (b -> m (Maybe (a, b))) -> b -> m (Vector a)

-- | O(n) Construct a vector by repeatedly applying the monadic
--   generator function to a seed. The generator function yields
--   Just the next element and the new seed or Nothing if
--   there are no more elements.
unfoldrNM :: Monad m => Int -> (b -> m (Maybe (a, b))) -> b -> m (Vector a)

-- | O(n) Construct a vector with n elements by repeatedly
--   applying the generator function to the already constructed part of the
--   vector.
--   
--   
--   constructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in <a,b,c>
--   
constructN :: Int -> (Vector a -> a) -> Vector a

-- | O(n) Construct a vector with n elements from right to
--   left by repeatedly applying the generator function to the already
--   constructed part of the vector.
--   
--   
--   constructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in <c,b,a>
--   
constructrN :: Int -> (Vector a -> a) -> Vector a

-- | O(n) Yield a vector of the given length containing the values
--   x, x+1 etc. This operation is usually more efficient
--   than enumFromTo.
--   
--   
--   enumFromN 5 3 = <5,6,7>
--   
enumFromN :: Num a => a -> Int -> Vector a

-- | O(n) Yield a vector of the given length containing the values
--   x, x+y, x+y+y etc. This operations is
--   usually more efficient than enumFromThenTo.
--   
--   
--   enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>
--   
enumFromStepN :: Num a => a -> a -> Int -> Vector a

-- | O(n) Enumerate values from x to y.
--   
--   WARNING: This operation can be very inefficient. If at all
--   possible, use enumFromN instead.
enumFromTo :: Enum a => a -> a -> Vector a

-- | O(n) Enumerate values from x to y with a
--   specific step z.
--   
--   WARNING: This operation can be very inefficient. If at all
--   possible, use enumFromStepN instead.
enumFromThenTo :: Enum a => a -> a -> a -> Vector a

-- | O(n) Prepend an element
cons :: a -> Vector a -> Vector a

-- | O(n) Append an element
snoc :: Vector a -> a -> Vector a

-- | O(m+n) Concatenate two vectors
(++) :: Vector a -> Vector a -> Vector a
infixr 5 ++

-- | O(n) Concatenate all vectors in the list
concat :: [Vector a] -> Vector a

-- | O(n) Yield the argument but force it not to retain any extra
--   memory, possibly by copying it.
--   
--   This is especially useful when dealing with slices. For example:
--   
--   
--   force (slice 0 2 <huge vector>)
--   
--   
--   Here, the slice retains a reference to the huge vector. Forcing it
--   creates a copy of just the elements that belong to the slice and
--   allows the huge vector to be garbage collected.
force :: Vector a -> Vector a

-- | O(n) Reverse a vector
reverse :: Vector a -> Vector a

-- | Apply a destructive operation to a vector. The operation will be
--   performed in place if it is safe to do so and will modify a copy of
--   the vector otherwise.
--   
--   
--   modify (\v -> write v 0 'x') (replicate 3 'a') = <'x','a','a'>
--   
modify :: (forall s. () => MVector s a -> ST s ()) -> Vector a -> Vector a

-- | O(n) Pair each element in a vector with its index
indexed :: Vector a -> Vector (Int, a)

-- | O(n) Map a function over a vector
map :: (a -> b) -> Vector a -> Vector b

-- | O(n) Apply a function to every element of a vector and its
--   index
imap :: (Int -> a -> b) -> Vector a -> Vector b

-- | Map a function over a vector and concatenate the results.
concatMap :: (a -> Vector b) -> Vector a -> Vector b

-- | O(n) Apply the monadic action to all elements of the vector,
--   yielding a vector of results
mapM :: Monad m => (a -> m b) -> Vector a -> m (Vector b)

-- | O(n) Apply the monadic action to every element of a vector and
--   its index, yielding a vector of results
imapM :: Monad m => (Int -> a -> m b) -> Vector a -> m (Vector b)

-- | O(n) Apply the monadic action to all elements of a vector and
--   ignore the results
mapM_ :: Monad m => (a -> m b) -> Vector a -> m ()

-- | O(n) Apply the monadic action to every element of a vector and
--   its index, ignoring the results
imapM_ :: Monad m => (Int -> a -> m b) -> Vector a -> m ()

-- | O(n) Apply the monadic action to all elements of the vector,
--   yielding a vector of results. Equivalent to flip mapM.
forM :: Monad m => Vector a -> (a -> m b) -> m (Vector b)

-- | O(n) Apply the monadic action to all elements of a vector and
--   ignore the results. Equivalent to flip mapM_.
forM_ :: Monad m => Vector a -> (a -> m b) -> m ()

-- | O(min(m,n)) Zip two vectors with the given function.
zipWith :: (a -> b -> c) -> Vector a -> Vector b -> Vector c

-- | Zip three vectors with the given function.
zipWith3 :: (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d
zipWith4 :: (a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
zipWith5 :: (a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f
zipWith6 :: (a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g

-- | O(min(m,n)) Zip two vectors with a function that also takes the
--   elements' indices.
izipWith :: (Int -> a -> b -> c) -> Vector a -> Vector b -> Vector c

-- | Zip three vectors and their indices with the given function.
izipWith3 :: (Int -> a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d
izipWith4 :: (Int -> a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
izipWith5 :: (Int -> a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f
izipWith6 :: (Int -> a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g

-- | Elementwise pairing of array elements.
zip :: Vector a -> Vector b -> Vector (a, b)

-- | zip together three vectors into a vector of triples
zip3 :: Vector a -> Vector b -> Vector c -> Vector (a, b, c)
zip4 :: Vector a -> Vector b -> Vector c -> Vector d -> Vector (a, b, c, d)
zip5 :: Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector (a, b, c, d, e)
zip6 :: Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector (a, b, c, d, e, f)

-- | O(min(m,n)) Zip the two vectors with the monadic action and
--   yield a vector of results
zipWithM :: Monad m => (a -> b -> m c) -> Vector a -> Vector b -> m (Vector c)

-- | O(min(m,n)) Zip the two vectors with a monadic action that also
--   takes the element index and yield a vector of results
izipWithM :: Monad m => (Int -> a -> b -> m c) -> Vector a -> Vector b -> m (Vector c)

-- | O(min(m,n)) Zip the two vectors with the monadic action and
--   ignore the results
zipWithM_ :: Monad m => (a -> b -> m c) -> Vector a -> Vector b -> m ()

-- | O(min(m,n)) Zip the two vectors with a monadic action that also
--   takes the element index and ignore the results
izipWithM_ :: Monad m => (Int -> a -> b -> m c) -> Vector a -> Vector b -> m ()

-- | O(min(m,n)) Unzip a vector of pairs.
unzip :: Vector (a, b) -> (Vector a, Vector b)
unzip3 :: Vector (a, b, c) -> (Vector a, Vector b, Vector c)
unzip4 :: Vector (a, b, c, d) -> (Vector a, Vector b, Vector c, Vector d)
unzip5 :: Vector (a, b, c, d, e) -> (Vector a, Vector b, Vector c, Vector d, Vector e)
unzip6 :: Vector (a, b, c, d, e, f) -> (Vector a, Vector b, Vector c, Vector d, Vector e, Vector f)

-- | O(n) Drop elements that do not satisfy the predicate
filter :: (a -> Bool) -> Vector a -> Vector a

-- | O(n) Drop elements that do not satisfy the predicate which is
--   applied to values and their indices
ifilter :: (Int -> a -> Bool) -> Vector a -> Vector a

-- | O(n) Drop repeated adjacent elements.
uniq :: Eq a => Vector a -> Vector a

-- | O(n) Drop elements when predicate returns Nothing
mapMaybe :: (a -> Maybe b) -> Vector a -> Vector b

-- | O(n) Drop elements when predicate, applied to index and value,
--   returns Nothing
imapMaybe :: (Int -> a -> Maybe b) -> Vector a -> Vector b

-- | O(n) Drop elements that do not satisfy the monadic predicate
filterM :: Monad m => (a -> m Bool) -> Vector a -> m (Vector a)

-- | O(n) Yield the longest prefix of elements satisfying the
--   predicate without copying.
takeWhile :: (a -> Bool) -> Vector a -> Vector a

-- | O(n) Drop the longest prefix of elements that satisfy the
--   predicate without copying.
dropWhile :: (a -> Bool) -> Vector a -> Vector a

-- | O(n) Split the vector in two parts, the first one containing
--   those elements that satisfy the predicate and the second one those
--   that don't. The relative order of the elements is preserved at the
--   cost of a sometimes reduced performance compared to
--   unstablePartition.
partition :: (a -> Bool) -> Vector a -> (Vector a, Vector a)

-- | O(n) Split the vector in two parts, the first one containing
--   those elements that satisfy the predicate and the second one those
--   that don't. The order of the elements is not preserved but the
--   operation is often faster than partition.
unstablePartition :: (a -> Bool) -> Vector a -> (Vector a, Vector a)

-- | O(n) Split the vector into the longest prefix of elements that
--   satisfy the predicate and the rest without copying.
span :: (a -> Bool) -> Vector a -> (Vector a, Vector a)

-- | O(n) Split the vector into the longest prefix of elements that
--   do not satisfy the predicate and the rest without copying.
break :: (a -> Bool) -> Vector a -> (Vector a, Vector a)

-- | O(n) Check if the vector contains an element
elem :: Eq a => a -> Vector a -> Bool
infix 4 `elem`

-- | O(n) Check if the vector does not contain an element (inverse
--   of elem)
notElem :: Eq a => a -> Vector a -> Bool
infix 4 `notElem`

-- | O(n) Yield Just the first element matching the predicate
--   or Nothing if no such element exists.
find :: (a -> Bool) -> Vector a -> Maybe a

-- | O(n) Yield Just the index of the first element matching
--   the predicate or Nothing if no such element exists.
findIndex :: (a -> Bool) -> Vector a -> Maybe Int

-- | O(n) Yield the indices of elements satisfying the predicate in
--   ascending order.
findIndices :: (a -> Bool) -> Vector a -> Vector Int

-- | O(n) Yield Just the index of the first occurence of the
--   given element or Nothing if the vector does not contain the
--   element. This is a specialised version of findIndex.
elemIndex :: Eq a => a -> Vector a -> Maybe Int

-- | O(n) Yield the indices of all occurences of the given element
--   in ascending order. This is a specialised version of
--   findIndices.
elemIndices :: Eq a => a -> Vector a -> Vector Int

-- | O(n) Left fold
foldl :: (a -> b -> a) -> a -> Vector b -> a

-- | O(n) Left fold with strict accumulator
foldl' :: (a -> b -> a) -> a -> Vector b -> a

-- | O(n) Right fold
foldr :: (a -> b -> b) -> b -> Vector a -> b

-- | O(n) Right fold with a strict accumulator
foldr' :: (a -> b -> b) -> b -> Vector a -> b

-- | O(n) Left fold (function applied to each element and its index)
ifoldl :: (a -> Int -> b -> a) -> a -> Vector b -> a

-- | O(n) Left fold with strict accumulator (function applied to
--   each element and its index)
ifoldl' :: (a -> Int -> b -> a) -> a -> Vector b -> a

-- | O(n) Right fold (function applied to each element and its
--   index)
ifoldr :: (Int -> a -> b -> b) -> b -> Vector a -> b

-- | O(n) Right fold with strict accumulator (function applied to
--   each element and its index)
ifoldr' :: (Int -> a -> b -> b) -> b -> Vector a -> b

-- | O(n) Check if all elements satisfy the predicate.
all :: (a -> Bool) -> Vector a -> Bool

-- | O(n) Check if any element satisfies the predicate.
any :: (a -> Bool) -> Vector a -> Bool

-- | O(n) Check if all elements are True
and :: Vector Bool -> Bool

-- | O(n) Check if any element is True
or :: Vector Bool -> Bool

-- | O(n) Compute the sum of the elements
sum :: Num a => Vector a -> a

-- | O(n) Compute the produce of the elements
product :: Num a => Vector a -> a

-- | O(n) Monadic fold
foldM :: Monad m => (a -> b -> m a) -> a -> Vector b -> m a

-- | O(n) Monadic fold (action applied to each element and its
--   index)
ifoldM :: Monad m => (a -> Int -> b -> m a) -> a -> Vector b -> m a

-- | O(n) Monadic fold with strict accumulator
foldM' :: Monad m => (a -> b -> m a) -> a -> Vector b -> m a

-- | O(n) Monadic fold with strict accumulator (action applied to
--   each element and its index)
ifoldM' :: Monad m => (a -> Int -> b -> m a) -> a -> Vector b -> m a

-- | O(n) Monadic fold that discards the result
foldM_ :: Monad m => (a -> b -> m a) -> a -> Vector b -> m ()

-- | O(n) Monadic fold that discards the result (action applied to
--   each element and its index)
ifoldM_ :: Monad m => (a -> Int -> b -> m a) -> a -> Vector b -> m ()

-- | O(n) Monadic fold with strict accumulator that discards the
--   result
foldM'_ :: Monad m => (a -> b -> m a) -> a -> Vector b -> m ()

-- | O(n) Monadic fold with strict accumulator that discards the
--   result (action applied to each element and its index)
ifoldM'_ :: Monad m => (a -> Int -> b -> m a) -> a -> Vector b -> m ()

-- | Evaluate each action and collect the results
sequence :: Monad m => Vector (m a) -> m (Vector a)

-- | Evaluate each action and discard the results
sequence_ :: Monad m => Vector (m a) -> m ()

-- | O(n) Prescan
--   
--   
--   prescanl f z = init . scanl f z
--   
--   
--   Example: prescanl (+) 0 <1,2,3,4> = <0,1,3,6>
prescanl :: (a -> b -> a) -> a -> Vector b -> Vector a

-- | O(n) Prescan with strict accumulator
prescanl' :: (a -> b -> a) -> a -> Vector b -> Vector a

-- | O(n) Scan
--   
--   
--   postscanl f z = tail . scanl f z
--   
--   
--   Example: postscanl (+) 0 <1,2,3,4> = <1,3,6,10>
postscanl :: (a -> b -> a) -> a -> Vector b -> Vector a

-- | O(n) Scan with strict accumulator
postscanl' :: (a -> b -> a) -> a -> Vector b -> Vector a

-- | O(n) Haskell-style scan
--   
--   
--   scanl f z <x1,...,xn> = <y1,...,y(n+1)>
--     where y1 = z
--           yi = f y(i-1) x(i-1)
--   
--   
--   Example: scanl (+) 0 <1,2,3,4> = <0,1,3,6,10>
scanl :: (a -> b -> a) -> a -> Vector b -> Vector a

-- | O(n) Haskell-style scan with strict accumulator
scanl' :: (a -> b -> a) -> a -> Vector b -> Vector a

-- | O(n) Scan over a vector with its index
iscanl :: (Int -> a -> b -> a) -> a -> Vector b -> Vector a

-- | O(n) Scan over a vector (strictly) with its index
iscanl' :: (Int -> a -> b -> a) -> a -> Vector b -> Vector a

-- | O(n) Right-to-left prescan
--   
--   
--   prescanr f z = reverse . prescanl (flip f) z . reverse
--   
prescanr :: (a -> b -> b) -> b -> Vector a -> Vector b

-- | O(n) Right-to-left prescan with strict accumulator
prescanr' :: (a -> b -> b) -> b -> Vector a -> Vector b

-- | O(n) Right-to-left scan
postscanr :: (a -> b -> b) -> b -> Vector a -> Vector b

-- | O(n) Right-to-left scan with strict accumulator
postscanr' :: (a -> b -> b) -> b -> Vector a -> Vector b

-- | O(n) Right-to-left Haskell-style scan
scanr :: (a -> b -> b) -> b -> Vector a -> Vector b

-- | O(n) Right-to-left Haskell-style scan with strict accumulator
scanr' :: (a -> b -> b) -> b -> Vector a -> Vector b

-- | O(n) Right-to-left scan over a vector with its index
iscanr :: (Int -> a -> b -> b) -> b -> Vector a -> Vector b

-- | O(n) Right-to-left scan over a vector (strictly) with its index
iscanr' :: (Int -> a -> b -> b) -> b -> Vector a -> Vector b

-- | O(n) Convert a vector to a list
toList :: Vector a -> [a]

-- | O(n) Convert a list to a vector
fromList :: [a] -> Vector a

-- | O(n) Convert the first n elements of a list to a
--   vector
--   
--   
--   fromListN n xs = fromList (take n xs)
--   
fromListN :: Int -> [a] -> Vector a

-- | O(n) Convert different vector types
convert :: (Vector v a, Vector w a) => v a -> w a

-- | O(n) Yield an immutable copy of the mutable vector.
freeze :: PrimMonad m => MVector (PrimState m) a -> m (Vector a)

-- | O(n) Yield a mutable copy of the immutable vector.
thaw :: PrimMonad m => Vector a -> m (MVector (PrimState m) a)

-- | O(n) Copy an immutable vector into a mutable one. The two
--   vectors must have the same length.
copy :: PrimMonad m => MVector (PrimState m) a -> Vector a -> m ()

-- | Boxed Vector partial functions. Import as:
--   
--   
--   import qualified RIO.Vector.Boxed.Partial as VB'
--   
module RIO.Vector.Boxed.Partial

-- | O(1) Indexing
(!) :: Vector a -> Int -> a

-- | O(1) First element
head :: Vector a -> a

-- | O(1) Last element
last :: Vector a -> a

-- | O(1) Indexing in a monad.
--   
--   The monad allows operations to be strict in the vector when necessary.
--   Suppose vector copying is implemented like this:
--   
--   
--   copy mv v = ... write mv i (v ! i) ...
--   
--   
--   For lazy vectors, v ! i would not be evaluated which means
--   that mv would unnecessarily retain a reference to v
--   in each element written.
--   
--   With indexM, copying can be implemented like this instead:
--   
--   
--   copy mv v = ... do
--                     x <- indexM v i
--                     write mv i x
--   
--   
--   Here, no references to v are retained because indexing (but
--   not the elements) is evaluated eagerly.
indexM :: Monad m => Vector a -> Int -> m a

-- | O(1) First element of a vector in a monad. See indexM
--   for an explanation of why this is useful.
headM :: Monad m => Vector a -> m a

-- | O(1) Last element of a vector in a monad. See indexM for
--   an explanation of why this is useful.
lastM :: Monad m => Vector a -> m a

-- | O(1) Yield all but the last element without copying. The vector
--   may not be empty.
init :: Vector a -> Vector a

-- | O(1) Yield all but the first element without copying. The
--   vector may not be empty.
tail :: Vector a -> Vector a

-- | O(m+n) For each pair (i,a) from the list, replace the
--   vector element at position i by a.
--   
--   
--   <5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>
--   
(//) :: Vector a -> [(Int, a)] -> Vector a

-- | O(m+n) For each pair (i,a) from the vector of
--   index/value pairs, replace the vector element at position i
--   by a.
--   
--   
--   update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7>
--   
update :: Vector a -> Vector (Int, a) -> Vector a

-- | O(m+min(n1,n2)) For each index i from the index vector
--   and the corresponding value a from the value vector, replace
--   the element of the initial vector at position i by
--   a.
--   
--   
--   update_ <5,9,2,7>  <2,0,2> <1,3,8> = <3,9,8,7>
--   
--   
--   The function update provides the same functionality and is
--   usually more convenient.
--   
--   
--   update_ xs is ys = update xs (zip is ys)
--   
update_ :: Vector a -> Vector Int -> Vector a -> Vector a

-- | O(m+n) For each pair (i,b) from the list, replace the
--   vector element a at position i by f a b.
--   
--   
--   accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>
--   
accum :: (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a

-- | O(m+n) For each pair (i,b) from the vector of pairs,
--   replace the vector element a at position i by f
--   a b.
--   
--   
--   accumulate (+) <5,9,2> <(2,4),(1,6),(0,3),(1,7)> = <5+3, 9+6+7, 2+4>
--   
accumulate :: (a -> b -> a) -> Vector a -> Vector (Int, b) -> Vector a

-- | O(m+min(n1,n2)) For each index i from the index vector
--   and the corresponding value b from the the value vector,
--   replace the element of the initial vector at position i by
--   f a b.
--   
--   
--   accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>
--   
--   
--   The function accumulate provides the same functionality and is
--   usually more convenient.
--   
--   
--   accumulate_ f as is bs = accumulate f as (zip is bs)
--   
accumulate_ :: (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a

-- | O(n) Yield the vector obtained by replacing each element
--   i of the index vector by xs!i. This is
--   equivalent to map (xs!) is but is often much
--   more efficient.
--   
--   
--   backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>
--   
backpermute :: Vector a -> Vector Int -> Vector a

-- | O(n) Left fold on non-empty vectors
foldl1 :: (a -> a -> a) -> Vector a -> a

-- | O(n) Left fold on non-empty vectors with strict accumulator
foldl1' :: (a -> a -> a) -> Vector a -> a

-- | O(n) Right fold on non-empty vectors
foldr1 :: (a -> a -> a) -> Vector a -> a

-- | O(n) Right fold on non-empty vectors with strict accumulator
foldr1' :: (a -> a -> a) -> Vector a -> a

-- | O(n) Yield the maximum element of the vector. The vector may
--   not be empty.
maximum :: Ord a => Vector a -> a

-- | O(n) Yield the maximum element of the vector according to the
--   given comparison function. The vector may not be empty.
maximumBy :: (a -> a -> Ordering) -> Vector a -> a

-- | O(n) Yield the minimum element of the vector. The vector may
--   not be empty.
minimum :: Ord a => Vector a -> a

-- | O(n) Yield the minimum element of the vector according to the
--   given comparison function. The vector may not be empty.
minimumBy :: (a -> a -> Ordering) -> Vector a -> a

-- | O(n) Yield the index of the minimum element of the vector. The
--   vector may not be empty.
minIndex :: Ord a => Vector a -> Int

-- | O(n) Yield the index of the minimum element of the vector
--   according to the given comparison function. The vector may not be
--   empty.
minIndexBy :: (a -> a -> Ordering) -> Vector a -> Int

-- | O(n) Yield the index of the maximum element of the vector. The
--   vector may not be empty.
maxIndex :: Ord a => Vector a -> Int

-- | O(n) Yield the index of the maximum element of the vector
--   according to the given comparison function. The vector may not be
--   empty.
maxIndexBy :: (a -> a -> Ordering) -> Vector a -> Int

-- | O(n) Monadic fold over non-empty vectors
fold1M :: Monad m => (a -> a -> m a) -> Vector a -> m a

-- | O(n) Monadic fold over non-empty vectors with strict
--   accumulator
fold1M' :: Monad m => (a -> a -> m a) -> Vector a -> m a

-- | O(n) Monadic fold over non-empty vectors that discards the
--   result
fold1M_ :: Monad m => (a -> a -> m a) -> Vector a -> m ()

-- | O(n) Monadic fold over non-empty vectors with strict
--   accumulator that discards the result
fold1M'_ :: Monad m => (a -> a -> m a) -> Vector a -> m ()

-- | O(n) Scan over a non-empty vector
--   
--   
--   scanl f <x1,...,xn> = <y1,...,yn>
--     where y1 = x1
--           yi = f y(i-1) xi
--   
scanl1 :: (a -> a -> a) -> Vector a -> Vector a

-- | O(n) Scan over a non-empty vector with a strict accumulator
scanl1' :: (a -> a -> a) -> Vector a -> Vector a

-- | O(n) Right-to-left scan over a non-empty vector
scanr1 :: (a -> a -> a) -> Vector a -> Vector a

-- | O(n) Right-to-left scan over a non-empty vector with a strict
--   accumulator
scanr1' :: (a -> a -> a) -> Vector a -> Vector a

-- | Boxed Vector unsafe functions. These perform no bounds
--   checking, and may cause segmentation faults etc.! Import as:
--   
--   
--   import qualified RIO.Vector.Boxed.Unsafe as VB'
--   
module RIO.Vector.Boxed.Unsafe

-- | O(1) Unsafe indexing without bounds checking
unsafeIndex :: Vector a -> Int -> a

-- | O(1) First element without checking if the vector is empty
unsafeHead :: Vector a -> a

-- | O(1) Last element without checking if the vector is empty
unsafeLast :: Vector a -> a

-- | O(1) Indexing in a monad without bounds checks. See
--   indexM for an explanation of why this is useful.
unsafeIndexM :: Monad m => Vector a -> Int -> m a

-- | O(1) First element in a monad without checking for empty
--   vectors. See indexM for an explanation of why this is useful.
unsafeHeadM :: Monad m => Vector a -> m a

-- | O(1) Last element in a monad without checking for empty
--   vectors. See indexM for an explanation of why this is useful.
unsafeLastM :: Monad m => Vector a -> m a

-- | O(1) Yield a slice of the vector without copying. The vector
--   must contain at least i+n elements but this is not checked.
unsafeSlice :: Int -> Int -> Vector a -> Vector a

-- | O(1) Yield all but the last element without copying. The vector
--   may not be empty but this is not checked.
unsafeInit :: Vector a -> Vector a

-- | O(1) Yield all but the first element without copying. The
--   vector may not be empty but this is not checked.
unsafeTail :: Vector a -> Vector a

-- | O(1) Yield the first n elements without copying. The
--   vector must contain at least n elements but this is not
--   checked.
unsafeTake :: Int -> Vector a -> Vector a

-- | O(1) Yield all but the first n elements without
--   copying. The vector must contain at least n elements but this
--   is not checked.
unsafeDrop :: Int -> Vector a -> Vector a

-- | Same as (//) but without bounds checking.
unsafeUpd :: Vector a -> [(Int, a)] -> Vector a

-- | Same as update but without bounds checking.
unsafeUpdate :: Vector a -> Vector (Int, a) -> Vector a

-- | Same as update_ but without bounds checking.
unsafeUpdate_ :: Vector a -> Vector Int -> Vector a -> Vector a

-- | Same as accum but without bounds checking.
unsafeAccum :: (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a

-- | Same as accumulate but without bounds checking.
unsafeAccumulate :: (a -> b -> a) -> Vector a -> Vector (Int, b) -> Vector a

-- | Same as accumulate_ but without bounds checking.
unsafeAccumulate_ :: (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a

-- | Same as backpermute but without bounds checking.
unsafeBackpermute :: Vector a -> Vector Int -> Vector a

-- | O(1) Unsafe convert a mutable vector to an immutable one
--   without copying. The mutable vector may not be used after this
--   operation.
unsafeFreeze :: PrimMonad m => MVector (PrimState m) a -> m (Vector a)

-- | O(1) Unsafely convert an immutable vector to a mutable one
--   without copying. The immutable vector may not be used after this
--   operation.
unsafeThaw :: PrimMonad m => Vector a -> m (MVector (PrimState m) a)

-- | O(n) Copy an immutable vector into a mutable one. The two
--   vectors must have the same length. This is not checked.
unsafeCopy :: PrimMonad m => MVector (PrimState m) a -> Vector a -> m ()

-- | Generic Vector interface partial functions. Import as:
--   
--   
--   import qualified RIO.Vector.Partial as V'
--   
module RIO.Vector.Partial

-- | O(1) Indexing
(!) :: Vector v a => v a -> Int -> a
infixl 9 !

-- | O(1) First element
head :: Vector v a => v a -> a

-- | O(1) Last element
last :: Vector v a => v a -> a

-- | O(1) Indexing in a monad.
--   
--   The monad allows operations to be strict in the vector when necessary.
--   Suppose vector copying is implemented like this:
--   
--   
--   copy mv v = ... write mv i (v ! i) ...
--   
--   
--   For lazy vectors, v ! i would not be evaluated which means
--   that mv would unnecessarily retain a reference to v
--   in each element written.
--   
--   With indexM, copying can be implemented like this instead:
--   
--   
--   copy mv v = ... do
--                     x <- indexM v i
--                     write mv i x
--   
--   
--   Here, no references to v are retained because indexing (but
--   not the elements) is evaluated eagerly.
indexM :: (Vector v a, Monad m) => v a -> Int -> m a

-- | O(1) First element of a vector in a monad. See indexM
--   for an explanation of why this is useful.
headM :: (Vector v a, Monad m) => v a -> m a

-- | O(1) Last element of a vector in a monad. See indexM for
--   an explanation of why this is useful.
lastM :: (Vector v a, Monad m) => v a -> m a

-- | O(1) Yield all but the last element without copying. The vector
--   may not be empty.
init :: Vector v a => v a -> v a

-- | O(1) Yield all but the first element without copying. The
--   vector may not be empty.
tail :: Vector v a => v a -> v a

-- | O(m+n) For each pair (i,a) from the list, replace the
--   vector element at position i by a.
--   
--   
--   <5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>
--   
(//) :: Vector v a => v a -> [(Int, a)] -> v a

-- | O(m+n) For each pair (i,a) from the vector of
--   index/value pairs, replace the vector element at position i
--   by a.
--   
--   
--   update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7>
--   
update :: (Vector v a, Vector v (Int, a)) => v a -> v (Int, a) -> v a

-- | O(m+min(n1,n2)) For each index i from the index vector
--   and the corresponding value a from the value vector, replace
--   the element of the initial vector at position i by
--   a.
--   
--   
--   update_ <5,9,2,7>  <2,0,2> <1,3,8> = <3,9,8,7>
--   
--   
--   This function is useful for instances of Vector that cannot
--   store pairs. Otherwise, update is probably more convenient.
--   
--   
--   update_ xs is ys = update xs (zip is ys)
--   
update_ :: (Vector v a, Vector v Int) => v a -> v Int -> v a -> v a

-- | O(m+n) For each pair (i,b) from the list, replace the
--   vector element a at position i by f a b.
--   
--   
--   accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>
--   
accum :: Vector v a => (a -> b -> a) -> v a -> [(Int, b)] -> v a

-- | O(m+n) For each pair (i,b) from the vector of pairs,
--   replace the vector element a at position i by f
--   a b.
--   
--   
--   accumulate (+) <5,9,2> <(2,4),(1,6),(0,3),(1,7)> = <5+3, 9+6+7, 2+4>
--   
accumulate :: (Vector v a, Vector v (Int, b)) => (a -> b -> a) -> v a -> v (Int, b) -> v a

-- | O(m+min(n1,n2)) For each index i from the index vector
--   and the corresponding value b from the the value vector,
--   replace the element of the initial vector at position i by
--   f a b.
--   
--   
--   accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>
--   
--   
--   This function is useful for instances of Vector that cannot
--   store pairs. Otherwise, accumulate is probably more convenient:
--   
--   
--   accumulate_ f as is bs = accumulate f as (zip is bs)
--   
accumulate_ :: (Vector v a, Vector v Int, Vector v b) => (a -> b -> a) -> v a -> v Int -> v b -> v a

-- | O(n) Yield the vector obtained by replacing each element
--   i of the index vector by xs!i. This is
--   equivalent to map (xs!) is but is often much
--   more efficient.
--   
--   
--   backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>
--   
backpermute :: (Vector v a, Vector v Int) => v a -> v Int -> v a

-- | O(n) Left fold on non-empty vectors
foldl1 :: Vector v a => (a -> a -> a) -> v a -> a

-- | O(n) Left fold on non-empty vectors with strict accumulator
foldl1' :: Vector v a => (a -> a -> a) -> v a -> a

-- | O(n) Right fold on non-empty vectors
foldr1 :: Vector v a => (a -> a -> a) -> v a -> a

-- | O(n) Right fold on non-empty vectors with strict accumulator
foldr1' :: Vector v a => (a -> a -> a) -> v a -> a

-- | O(n) Yield the maximum element of the vector. The vector may
--   not be empty.
maximum :: (Vector v a, Ord a) => v a -> a

-- | O(n) Yield the maximum element of the vector according to the
--   given comparison function. The vector may not be empty.
maximumBy :: Vector v a => (a -> a -> Ordering) -> v a -> a

-- | O(n) Yield the minimum element of the vector. The vector may
--   not be empty.
minimum :: (Vector v a, Ord a) => v a -> a

-- | O(n) Yield the minimum element of the vector according to the
--   given comparison function. The vector may not be empty.
minimumBy :: Vector v a => (a -> a -> Ordering) -> v a -> a

-- | O(n) Yield the index of the minimum element of the vector. The
--   vector may not be empty.
minIndex :: (Vector v a, Ord a) => v a -> Int

-- | O(n) Yield the index of the minimum element of the vector
--   according to the given comparison function. The vector may not be
--   empty.
minIndexBy :: Vector v a => (a -> a -> Ordering) -> v a -> Int

-- | O(n) Yield the index of the maximum element of the vector. The
--   vector may not be empty.
maxIndex :: (Vector v a, Ord a) => v a -> Int

-- | O(n) Yield the index of the maximum element of the vector
--   according to the given comparison function. The vector may not be
--   empty.
maxIndexBy :: Vector v a => (a -> a -> Ordering) -> v a -> Int

-- | O(n) Monadic fold over non-empty vectors
fold1M :: (Monad m, Vector v a) => (a -> a -> m a) -> v a -> m a

-- | O(n) Monadic fold over non-empty vectors with strict
--   accumulator
fold1M' :: (Monad m, Vector v a) => (a -> a -> m a) -> v a -> m a

-- | O(n) Monadic fold over non-empty vectors that discards the
--   result
fold1M_ :: (Monad m, Vector v a) => (a -> a -> m a) -> v a -> m ()

-- | O(n) Monad fold over non-empty vectors with strict accumulator
--   that discards the result
fold1M'_ :: (Monad m, Vector v a) => (a -> a -> m a) -> v a -> m ()

-- | O(n) Scan over a non-empty vector
--   
--   
--   scanl f <x1,...,xn> = <y1,...,yn>
--     where y1 = x1
--           yi = f y(i-1) xi
--   
scanl1 :: Vector v a => (a -> a -> a) -> v a -> v a

-- | O(n) Scan over a non-empty vector with a strict accumulator
scanl1' :: Vector v a => (a -> a -> a) -> v a -> v a

-- | O(n) Right-to-left scan over a non-empty vector
scanr1 :: Vector v a => (a -> a -> a) -> v a -> v a

-- | O(n) Right-to-left scan over a non-empty vector with a strict
--   accumulator
scanr1' :: Vector v a => (a -> a -> a) -> v a -> v a

-- | Storable Vector. Import as:
--   
--   
--   import qualified RIO.Vector.Storable as VS
--   
--   
--   This module does not export any partial or unsafe functions. For
--   those, see RIO.Vector.Storable.Partial and
--   RIO.Vector.Storable.Unsafe
module RIO.Vector.Storable

-- | Storable-based vectors
data Vector a

-- | Mutable Storable-based vectors
data MVector s a
MVector :: {-# UNPACK #-} !Int -> {-# UNPACK #-} !ForeignPtr a -> MVector s a
class Storable a

-- | O(1) Yield the length of the vector
length :: Storable a => Vector a -> Int

-- | O(1) Test whether a vector is empty
null :: Storable a => Vector a -> Bool

-- | O(1) Safe indexing
(!?) :: Storable a => Vector a -> Int -> Maybe a

-- | O(1) Yield a slice of the vector without copying it. The vector
--   must contain at least i+n elements.
slice :: Storable a => Int -> Int -> Vector a -> Vector a

-- | O(1) Yield at the first n elements without copying.
--   The vector may contain less than n elements in which case it
--   is returned unchanged.
take :: Storable a => Int -> Vector a -> Vector a

-- | O(1) Yield all but the first n elements without
--   copying. The vector may contain less than n elements in which
--   case an empty vector is returned.
drop :: Storable a => Int -> Vector a -> Vector a

-- | O(1) Yield the first n elements paired with the
--   remainder without copying.
--   
--   Note that splitAt n v is equivalent to
--   (take n v, drop n v) but slightly more
--   efficient.
splitAt :: Storable a => Int -> Vector a -> (Vector a, Vector a)

-- | O(1) Empty vector
empty :: Storable a => Vector a

-- | O(1) Vector with exactly one element
singleton :: Storable a => a -> Vector a

-- | O(n) Vector of the given length with the same value in each
--   position
replicate :: Storable a => Int -> a -> Vector a

-- | O(n) Construct a vector of the given length by applying the
--   function to each index
generate :: Storable a => Int -> (Int -> a) -> Vector a

-- | O(n) Apply function n times to value. Zeroth element is
--   original value.
iterateN :: Storable a => Int -> (a -> a) -> a -> Vector a

-- | O(n) Execute the monadic action the given number of times and
--   store the results in a vector.
replicateM :: (Monad m, Storable a) => Int -> m a -> m (Vector a)

-- | O(n) Construct a vector of the given length by applying the
--   monadic action to each index
generateM :: (Monad m, Storable a) => Int -> (Int -> m a) -> m (Vector a)

-- | O(n) Apply monadic function n times to value. Zeroth element is
--   original value.
iterateNM :: (Monad m, Storable a) => Int -> (a -> m a) -> a -> m (Vector a)

-- | Execute the monadic action and freeze the resulting vector.
--   
--   
--   create (do { v <- new 2; write v 0 'a'; write v 1 'b'; return v }) = <a,b>
--   
create :: Storable a => (forall s. () => ST s (MVector s a)) -> Vector a

-- | Execute the monadic action and freeze the resulting vectors.
createT :: (Traversable f, Storable a) => (forall s. () => ST s (f (MVector s a))) -> f (Vector a)

-- | O(n) Construct a vector by repeatedly applying the generator
--   function to a seed. The generator function yields Just the next
--   element and the new seed or Nothing if there are no more
--   elements.
--   
--   
--   unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10
--    = <10,9,8,7,6,5,4,3,2,1>
--   
unfoldr :: Storable a => (b -> Maybe (a, b)) -> b -> Vector a

-- | O(n) Construct a vector with at most n elements by
--   repeatedly applying the generator function to a seed. The generator
--   function yields Just the next element and the new seed or
--   Nothing if there are no more elements.
--   
--   
--   unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>
--   
unfoldrN :: Storable a => Int -> (b -> Maybe (a, b)) -> b -> Vector a

-- | O(n) Construct a vector by repeatedly applying the monadic
--   generator function to a seed. The generator function yields
--   Just the next element and the new seed or Nothing if
--   there are no more elements.
unfoldrM :: (Monad m, Storable a) => (b -> m (Maybe (a, b))) -> b -> m (Vector a)

-- | O(n) Construct a vector by repeatedly applying the monadic
--   generator function to a seed. The generator function yields
--   Just the next element and the new seed or Nothing if
--   there are no more elements.
unfoldrNM :: (Monad m, Storable a) => Int -> (b -> m (Maybe (a, b))) -> b -> m (Vector a)

-- | O(n) Construct a vector with n elements by repeatedly
--   applying the generator function to the already constructed part of the
--   vector.
--   
--   
--   constructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in <a,b,c>
--   
constructN :: Storable a => Int -> (Vector a -> a) -> Vector a

-- | O(n) Construct a vector with n elements from right to
--   left by repeatedly applying the generator function to the already
--   constructed part of the vector.
--   
--   
--   constructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in <c,b,a>
--   
constructrN :: Storable a => Int -> (Vector a -> a) -> Vector a

-- | O(n) Yield a vector of the given length containing the values
--   x, x+1 etc. This operation is usually more efficient
--   than enumFromTo.
--   
--   
--   enumFromN 5 3 = <5,6,7>
--   
enumFromN :: (Storable a, Num a) => a -> Int -> Vector a

-- | O(n) Yield a vector of the given length containing the values
--   x, x+y, x+y+y etc. This operations is
--   usually more efficient than enumFromThenTo.
--   
--   
--   enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>
--   
enumFromStepN :: (Storable a, Num a) => a -> a -> Int -> Vector a

-- | O(n) Enumerate values from x to y.
--   
--   WARNING: This operation can be very inefficient. If at all
--   possible, use enumFromN instead.
enumFromTo :: (Storable a, Enum a) => a -> a -> Vector a

-- | O(n) Enumerate values from x to y with a
--   specific step z.
--   
--   WARNING: This operation can be very inefficient. If at all
--   possible, use enumFromStepN instead.
enumFromThenTo :: (Storable a, Enum a) => a -> a -> a -> Vector a

-- | O(n) Prepend an element
cons :: Storable a => a -> Vector a -> Vector a

-- | O(n) Append an element
snoc :: Storable a => Vector a -> a -> Vector a

-- | O(m+n) Concatenate two vectors
(++) :: Storable a => Vector a -> Vector a -> Vector a
infixr 5 ++

-- | O(n) Concatenate all vectors in the list
concat :: Storable a => [Vector a] -> Vector a

-- | O(n) Yield the argument but force it not to retain any extra
--   memory, possibly by copying it.
--   
--   This is especially useful when dealing with slices. For example:
--   
--   
--   force (slice 0 2 <huge vector>)
--   
--   
--   Here, the slice retains a reference to the huge vector. Forcing it
--   creates a copy of just the elements that belong to the slice and
--   allows the huge vector to be garbage collected.
force :: Storable a => Vector a -> Vector a

-- | O(n) Reverse a vector
reverse :: Storable a => Vector a -> Vector a

-- | Apply a destructive operation to a vector. The operation will be
--   performed in place if it is safe to do so and will modify a copy of
--   the vector otherwise.
--   
--   
--   modify (\v -> write v 0 'x') (replicate 3 'a') = <'x','a','a'>
--   
modify :: Storable a => (forall s. () => MVector s a -> ST s ()) -> Vector a -> Vector a

-- | O(n) Map a function over a vector
map :: (Storable a, Storable b) => (a -> b) -> Vector a -> Vector b

-- | O(n) Apply a function to every element of a vector and its
--   index
imap :: (Storable a, Storable b) => (Int -> a -> b) -> Vector a -> Vector b

-- | Map a function over a vector and concatenate the results.
concatMap :: (Storable a, Storable b) => (a -> Vector b) -> Vector a -> Vector b

-- | O(n) Apply the monadic action to all elements of the vector,
--   yielding a vector of results
mapM :: (Monad m, Storable a, Storable b) => (a -> m b) -> Vector a -> m (Vector b)

-- | O(n) Apply the monadic action to all elements of a vector and
--   ignore the results
mapM_ :: (Monad m, Storable a) => (a -> m b) -> Vector a -> m ()

-- | O(n) Apply the monadic action to all elements of the vector,
--   yielding a vector of results. Equivalent to flip mapM.
forM :: (Monad m, Storable a, Storable b) => Vector a -> (a -> m b) -> m (Vector b)

-- | O(n) Apply the monadic action to all elements of a vector and
--   ignore the results. Equivalent to flip mapM_.
forM_ :: (Monad m, Storable a) => Vector a -> (a -> m b) -> m ()

-- | O(min(m,n)) Zip two vectors with the given function.
zipWith :: (Storable a, Storable b, Storable c) => (a -> b -> c) -> Vector a -> Vector b -> Vector c

-- | Zip three vectors with the given function.
zipWith3 :: (Storable a, Storable b, Storable c, Storable d) => (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d
zipWith4 :: (Storable a, Storable b, Storable c, Storable d, Storable e) => (a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
zipWith5 :: (Storable a, Storable b, Storable c, Storable d, Storable e, Storable f) => (a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f
zipWith6 :: (Storable a, Storable b, Storable c, Storable d, Storable e, Storable f, Storable g) => (a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g

-- | O(min(m,n)) Zip two vectors with a function that also takes the
--   elements' indices.
izipWith :: (Storable a, Storable b, Storable c) => (Int -> a -> b -> c) -> Vector a -> Vector b -> Vector c

-- | Zip three vectors and their indices with the given function.
izipWith3 :: (Storable a, Storable b, Storable c, Storable d) => (Int -> a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d
izipWith4 :: (Storable a, Storable b, Storable c, Storable d, Storable e) => (Int -> a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
izipWith5 :: (Storable a, Storable b, Storable c, Storable d, Storable e, Storable f) => (Int -> a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f
izipWith6 :: (Storable a, Storable b, Storable c, Storable d, Storable e, Storable f, Storable g) => (Int -> a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g

-- | O(min(m,n)) Zip the two vectors with the monadic action and
--   yield a vector of results
zipWithM :: (Monad m, Storable a, Storable b, Storable c) => (a -> b -> m c) -> Vector a -> Vector b -> m (Vector c)

-- | O(min(m,n)) Zip the two vectors with the monadic action and
--   ignore the results
zipWithM_ :: (Monad m, Storable a, Storable b) => (a -> b -> m c) -> Vector a -> Vector b -> m ()

-- | O(n) Drop elements that do not satisfy the predicate
filter :: Storable a => (a -> Bool) -> Vector a -> Vector a

-- | O(n) Drop elements that do not satisfy the predicate which is
--   applied to values and their indices
ifilter :: Storable a => (Int -> a -> Bool) -> Vector a -> Vector a

-- | O(n) Drop repeated adjacent elements.
uniq :: (Storable a, Eq a) => Vector a -> Vector a

-- | O(n) Drop elements when predicate returns Nothing
mapMaybe :: (Storable a, Storable b) => (a -> Maybe b) -> Vector a -> Vector b

-- | O(n) Drop elements when predicate, applied to index and value,
--   returns Nothing
imapMaybe :: (Storable a, Storable b) => (Int -> a -> Maybe b) -> Vector a -> Vector b

-- | O(n) Drop elements that do not satisfy the monadic predicate
filterM :: (Monad m, Storable a) => (a -> m Bool) -> Vector a -> m (Vector a)

-- | O(n) Yield the longest prefix of elements satisfying the
--   predicate without copying.
takeWhile :: Storable a => (a -> Bool) -> Vector a -> Vector a

-- | O(n) Drop the longest prefix of elements that satisfy the
--   predicate without copying.
dropWhile :: Storable a => (a -> Bool) -> Vector a -> Vector a

-- | O(n) Split the vector in two parts, the first one containing
--   those elements that satisfy the predicate and the second one those
--   that don't. The relative order of the elements is preserved at the
--   cost of a sometimes reduced performance compared to
--   unstablePartition.
partition :: Storable a => (a -> Bool) -> Vector a -> (Vector a, Vector a)

-- | O(n) Split the vector in two parts, the first one containing
--   those elements that satisfy the predicate and the second one those
--   that don't. The order of the elements is not preserved but the
--   operation is often faster than partition.
unstablePartition :: Storable a => (a -> Bool) -> Vector a -> (Vector a, Vector a)

-- | O(n) Split the vector into the longest prefix of elements that
--   satisfy the predicate and the rest without copying.
span :: Storable a => (a -> Bool) -> Vector a -> (Vector a, Vector a)

-- | O(n) Split the vector into the longest prefix of elements that
--   do not satisfy the predicate and the rest without copying.
break :: Storable a => (a -> Bool) -> Vector a -> (Vector a, Vector a)

-- | O(n) Check if the vector contains an element
elem :: (Storable a, Eq a) => a -> Vector a -> Bool
infix 4 `elem`

-- | O(n) Check if the vector does not contain an element (inverse
--   of elem)
notElem :: (Storable a, Eq a) => a -> Vector a -> Bool
infix 4 `notElem`

-- | O(n) Yield Just the first element matching the predicate
--   or Nothing if no such element exists.
find :: Storable a => (a -> Bool) -> Vector a -> Maybe a

-- | O(n) Yield Just the index of the first element matching
--   the predicate or Nothing if no such element exists.
findIndex :: Storable a => (a -> Bool) -> Vector a -> Maybe Int

-- | O(n) Yield the indices of elements satisfying the predicate in
--   ascending order.
findIndices :: Storable a => (a -> Bool) -> Vector a -> Vector Int

-- | O(n) Yield Just the index of the first occurence of the
--   given element or Nothing if the vector does not contain the
--   element. This is a specialised version of findIndex.
elemIndex :: (Storable a, Eq a) => a -> Vector a -> Maybe Int

-- | O(n) Yield the indices of all occurences of the given element
--   in ascending order. This is a specialised version of
--   findIndices.
elemIndices :: (Storable a, Eq a) => a -> Vector a -> Vector Int

-- | O(n) Left fold
foldl :: Storable b => (a -> b -> a) -> a -> Vector b -> a

-- | O(n) Left fold with strict accumulator
foldl' :: Storable b => (a -> b -> a) -> a -> Vector b -> a

-- | O(n) Right fold
foldr :: Storable a => (a -> b -> b) -> b -> Vector a -> b

-- | O(n) Right fold with a strict accumulator
foldr' :: Storable a => (a -> b -> b) -> b -> Vector a -> b

-- | O(n) Left fold (function applied to each element and its index)
ifoldl :: Storable b => (a -> Int -> b -> a) -> a -> Vector b -> a

-- | O(n) Left fold with strict accumulator (function applied to
--   each element and its index)
ifoldl' :: Storable b => (a -> Int -> b -> a) -> a -> Vector b -> a

-- | O(n) Right fold (function applied to each element and its
--   index)
ifoldr :: Storable a => (Int -> a -> b -> b) -> b -> Vector a -> b

-- | O(n) Right fold with strict accumulator (function applied to
--   each element and its index)
ifoldr' :: Storable a => (Int -> a -> b -> b) -> b -> Vector a -> b

-- | O(n) Check if all elements satisfy the predicate.
all :: Storable a => (a -> Bool) -> Vector a -> Bool

-- | O(n) Check if any element satisfies the predicate.
any :: Storable a => (a -> Bool) -> Vector a -> Bool

-- | O(n) Check if all elements are True
and :: Vector Bool -> Bool

-- | O(n) Check if any element is True
or :: Vector Bool -> Bool

-- | O(n) Compute the sum of the elements
sum :: (Storable a, Num a) => Vector a -> a

-- | O(n) Compute the produce of the elements
product :: (Storable a, Num a) => Vector a -> a

-- | O(n) Monadic fold
foldM :: (Monad m, Storable b) => (a -> b -> m a) -> a -> Vector b -> m a

-- | O(n) Monadic fold with strict accumulator
foldM' :: (Monad m, Storable b) => (a -> b -> m a) -> a -> Vector b -> m a

-- | O(n) Monadic fold that discards the result
foldM_ :: (Monad m, Storable b) => (a -> b -> m a) -> a -> Vector b -> m ()

-- | O(n) Monadic fold with strict accumulator that discards the
--   result
foldM'_ :: (Monad m, Storable b) => (a -> b -> m a) -> a -> Vector b -> m ()

-- | O(n) Prescan
--   
--   
--   prescanl f z = init . scanl f z
--   
--   
--   Example: prescanl (+) 0 <1,2,3,4> = <0,1,3,6>
prescanl :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector b -> Vector a

-- | O(n) Prescan with strict accumulator
prescanl' :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector b -> Vector a

-- | O(n) Scan
--   
--   
--   postscanl f z = tail . scanl f z
--   
--   
--   Example: postscanl (+) 0 <1,2,3,4> = <1,3,6,10>
postscanl :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector b -> Vector a

-- | O(n) Scan with strict accumulator
postscanl' :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector b -> Vector a

-- | O(n) Haskell-style scan
--   
--   
--   scanl f z <x1,...,xn> = <y1,...,y(n+1)>
--     where y1 = z
--           yi = f y(i-1) x(i-1)
--   
--   
--   Example: scanl (+) 0 <1,2,3,4> = <0,1,3,6,10>
scanl :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector b -> Vector a

-- | O(n) Haskell-style scan with strict accumulator
scanl' :: (Storable a, Storable b) => (a -> b -> a) -> a -> Vector b -> Vector a

-- | O(n) Right-to-left prescan
--   
--   
--   prescanr f z = reverse . prescanl (flip f) z . reverse
--   
prescanr :: (Storable a, Storable b) => (a -> b -> b) -> b -> Vector a -> Vector b

-- | O(n) Right-to-left prescan with strict accumulator
prescanr' :: (Storable a, Storable b) => (a -> b -> b) -> b -> Vector a -> Vector b

-- | O(n) Right-to-left scan
postscanr :: (Storable a, Storable b) => (a -> b -> b) -> b -> Vector a -> Vector b

-- | O(n) Right-to-left scan with strict accumulator
postscanr' :: (Storable a, Storable b) => (a -> b -> b) -> b -> Vector a -> Vector b

-- | O(n) Right-to-left Haskell-style scan
scanr :: (Storable a, Storable b) => (a -> b -> b) -> b -> Vector a -> Vector b

-- | O(n) Right-to-left Haskell-style scan with strict accumulator
scanr' :: (Storable a, Storable b) => (a -> b -> b) -> b -> Vector a -> Vector b

-- | O(n) Convert a vector to a list
toList :: Storable a => Vector a -> [a]

-- | O(n) Convert a list to a vector
fromList :: Storable a => [a] -> Vector a

-- | O(n) Convert the first n elements of a list to a
--   vector
--   
--   
--   fromListN n xs = fromList (take n xs)
--   
fromListN :: Storable a => Int -> [a] -> Vector a

-- | O(n) Convert different vector types
convert :: (Vector v a, Vector w a) => v a -> w a

-- | O(n) Yield an immutable copy of the mutable vector.
freeze :: (Storable a, PrimMonad m) => MVector (PrimState m) a -> m (Vector a)

-- | O(n) Yield a mutable copy of the immutable vector.
thaw :: (Storable a, PrimMonad m) => Vector a -> m (MVector (PrimState m) a)

-- | O(n) Copy an immutable vector into a mutable one. The two
--   vectors must have the same length.
copy :: (Storable a, PrimMonad m) => MVector (PrimState m) a -> Vector a -> m ()

-- | Storable Vector partial functions. Import as:
--   
--   
--   import qualified RIO.Vector.Storable.Partial as VS'
--   
module RIO.Vector.Storable.Partial

-- | O(1) Indexing
(!) :: Storable a => Vector a -> Int -> a

-- | O(1) First element
head :: Storable a => Vector a -> a

-- | O(1) Last element
last :: Storable a => Vector a -> a

-- | O(1) Indexing in a monad.
--   
--   The monad allows operations to be strict in the vector when necessary.
--   Suppose vector copying is implemented like this:
--   
--   
--   copy mv v = ... write mv i (v ! i) ...
--   
--   
--   For lazy vectors, v ! i would not be evaluated which means
--   that mv would unnecessarily retain a reference to v
--   in each element written.
--   
--   With indexM, copying can be implemented like this instead:
--   
--   
--   copy mv v = ... do
--                     x <- indexM v i
--                     write mv i x
--   
--   
--   Here, no references to v are retained because indexing (but
--   not the elements) is evaluated eagerly.
indexM :: (Storable a, Monad m) => Vector a -> Int -> m a

-- | O(1) First element of a vector in a monad. See indexM
--   for an explanation of why this is useful.
headM :: (Storable a, Monad m) => Vector a -> m a

-- | O(1) Last element of a vector in a monad. See indexM for
--   an explanation of why this is useful.
lastM :: (Storable a, Monad m) => Vector a -> m a

-- | O(1) Yield all but the last element without copying. The vector
--   may not be empty.
init :: Storable a => Vector a -> Vector a

-- | O(1) Yield all but the first element without copying. The
--   vector may not be empty.
tail :: Storable a => Vector a -> Vector a

-- | O(m+n) For each pair (i,a) from the list, replace the
--   vector element at position i by a.
--   
--   
--   <5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>
--   
(//) :: Storable a => Vector a -> [(Int, a)] -> Vector a

-- | O(m+min(n1,n2)) For each index i from the index vector
--   and the corresponding value a from the value vector, replace
--   the element of the initial vector at position i by
--   a.
--   
--   
--   update_ <5,9,2,7>  <2,0,2> <1,3,8> = <3,9,8,7>
--   
update_ :: Storable a => Vector a -> Vector Int -> Vector a -> Vector a

-- | O(m+n) For each pair (i,b) from the list, replace the
--   vector element a at position i by f a b.
--   
--   
--   accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>
--   
accum :: Storable a => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a

-- | O(m+min(n1,n2)) For each index i from the index vector
--   and the corresponding value b from the the value vector,
--   replace the element of the initial vector at position i by
--   f a b.
--   
--   
--   accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>
--   
accumulate_ :: (Storable a, Storable b) => (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a

-- | O(n) Yield the vector obtained by replacing each element
--   i of the index vector by xs!i. This is
--   equivalent to map (xs!) is but is often much
--   more efficient.
--   
--   
--   backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>
--   
backpermute :: Storable a => Vector a -> Vector Int -> Vector a

-- | O(n) Left fold on non-empty vectors
foldl1 :: Storable a => (a -> a -> a) -> Vector a -> a

-- | O(n) Left fold on non-empty vectors with strict accumulator
foldl1' :: Storable a => (a -> a -> a) -> Vector a -> a

-- | O(n) Right fold on non-empty vectors
foldr1 :: Storable a => (a -> a -> a) -> Vector a -> a

-- | O(n) Right fold on non-empty vectors with strict accumulator
foldr1' :: Storable a => (a -> a -> a) -> Vector a -> a

-- | O(n) Yield the maximum element of the vector. The vector may
--   not be empty.
maximum :: (Storable a, Ord a) => Vector a -> a

-- | O(n) Yield the maximum element of the vector according to the
--   given comparison function. The vector may not be empty.
maximumBy :: Storable a => (a -> a -> Ordering) -> Vector a -> a

-- | O(n) Yield the minimum element of the vector. The vector may
--   not be empty.
minimum :: (Storable a, Ord a) => Vector a -> a

-- | O(n) Yield the minimum element of the vector according to the
--   given comparison function. The vector may not be empty.
minimumBy :: Storable a => (a -> a -> Ordering) -> Vector a -> a

-- | O(n) Yield the index of the minimum element of the vector. The
--   vector may not be empty.
minIndex :: (Storable a, Ord a) => Vector a -> Int

-- | O(n) Yield the index of the minimum element of the vector
--   according to the given comparison function. The vector may not be
--   empty.
minIndexBy :: Storable a => (a -> a -> Ordering) -> Vector a -> Int

-- | O(n) Yield the index of the maximum element of the vector. The
--   vector may not be empty.
maxIndex :: (Storable a, Ord a) => Vector a -> Int

-- | O(n) Yield the index of the maximum element of the vector
--   according to the given comparison function. The vector may not be
--   empty.
maxIndexBy :: Storable a => (a -> a -> Ordering) -> Vector a -> Int

-- | O(n) Monadic fold over non-empty vectors
fold1M :: (Monad m, Storable a) => (a -> a -> m a) -> Vector a -> m a

-- | O(n) Monadic fold over non-empty vectors with strict
--   accumulator
fold1M' :: (Monad m, Storable a) => (a -> a -> m a) -> Vector a -> m a

-- | O(n) Monadic fold over non-empty vectors that discards the
--   result
fold1M_ :: (Monad m, Storable a) => (a -> a -> m a) -> Vector a -> m ()

-- | O(n) Monadic fold over non-empty vectors with strict
--   accumulator that discards the result
fold1M'_ :: (Monad m, Storable a) => (a -> a -> m a) -> Vector a -> m ()

-- | O(n) Scan over a non-empty vector
--   
--   
--   scanl f <x1,...,xn> = <y1,...,yn>
--     where y1 = x1
--           yi = f y(i-1) xi
--   
scanl1 :: Storable a => (a -> a -> a) -> Vector a -> Vector a

-- | O(n) Scan over a non-empty vector with a strict accumulator
scanl1' :: Storable a => (a -> a -> a) -> Vector a -> Vector a

-- | O(n) Right-to-left scan over a non-empty vector
scanr1 :: Storable a => (a -> a -> a) -> Vector a -> Vector a

-- | O(n) Right-to-left scan over a non-empty vector with a strict
--   accumulator
scanr1' :: Storable a => (a -> a -> a) -> Vector a -> Vector a

-- | Storable Vector unsafe functions. These perform no bounds
--   checking, and may cause segmentation faults etc.! Import as:
--   
--   
--   import qualified RIO.Vector.Storable.Unsafe as VS'
--   
module RIO.Vector.Storable.Unsafe

-- | O(1) Unsafe indexing without bounds checking
unsafeIndex :: Storable a => Vector a -> Int -> a

-- | O(1) First element without checking if the vector is empty
unsafeHead :: Storable a => Vector a -> a

-- | O(1) Last element without checking if the vector is empty
unsafeLast :: Storable a => Vector a -> a

-- | O(1) Indexing in a monad without bounds checks. See
--   indexM for an explanation of why this is useful.
unsafeIndexM :: (Storable a, Monad m) => Vector a -> Int -> m a

-- | O(1) First element in a monad without checking for empty
--   vectors. See indexM for an explanation of why this is useful.
unsafeHeadM :: (Storable a, Monad m) => Vector a -> m a

-- | O(1) Last element in a monad without checking for empty
--   vectors. See indexM for an explanation of why this is useful.
unsafeLastM :: (Storable a, Monad m) => Vector a -> m a

-- | O(1) Yield a slice of the vector without copying. The vector
--   must contain at least i+n elements but this is not checked.
unsafeSlice :: Storable a => Int -> Int -> Vector a -> Vector a

-- | O(1) Yield all but the last element without copying. The vector
--   may not be empty but this is not checked.
unsafeInit :: Storable a => Vector a -> Vector a

-- | O(1) Yield all but the first element without copying. The
--   vector may not be empty but this is not checked.
unsafeTail :: Storable a => Vector a -> Vector a

-- | O(1) Yield the first n elements without copying. The
--   vector must contain at least n elements but this is not
--   checked.
unsafeTake :: Storable a => Int -> Vector a -> Vector a

-- | O(1) Yield all but the first n elements without
--   copying. The vector must contain at least n elements but this
--   is not checked.
unsafeDrop :: Storable a => Int -> Vector a -> Vector a

-- | Same as (//) but without bounds checking.
unsafeUpd :: Storable a => Vector a -> [(Int, a)] -> Vector a

-- | Same as update_ but without bounds checking.
unsafeUpdate_ :: Storable a => Vector a -> Vector Int -> Vector a -> Vector a

-- | Same as accum but without bounds checking.
unsafeAccum :: Storable a => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a

-- | Same as accumulate_ but without bounds checking.
unsafeAccumulate_ :: (Storable a, Storable b) => (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a

-- | Same as backpermute but without bounds checking.
unsafeBackpermute :: Storable a => Vector a -> Vector Int -> Vector a

-- | O(1) Unsafe convert a mutable vector to an immutable one
--   without copying. The mutable vector may not be used after this
--   operation.
unsafeFreeze :: (Storable a, PrimMonad m) => MVector (PrimState m) a -> m (Vector a)

-- | O(1) Unsafely convert an immutable vector to a mutable one
--   without copying. The immutable vector may not be used after this
--   operation.
unsafeThaw :: (Storable a, PrimMonad m) => Vector a -> m (MVector (PrimState m) a)

-- | O(n) Copy an immutable vector into a mutable one. The two
--   vectors must have the same length. This is not checked.
unsafeCopy :: (Storable a, PrimMonad m) => MVector (PrimState m) a -> Vector a -> m ()

-- | O(1) Create a vector from a ForeignPtr with an offset
--   and a length.
--   
--   The data may not be modified through the ForeignPtr afterwards.
--   
--   If your offset is 0 it is more efficient to use
--   unsafeFromForeignPtr0.
unsafeFromForeignPtr :: Storable a => ForeignPtr a -> Int -> Int -> Vector a

-- | O(1) Create a vector from a ForeignPtr and a length.
--   
--   It is assumed the pointer points directly to the data (no offset). Use
--   unsafeFromForeignPtr if you need to specify an offset.
--   
--   The data may not be modified through the ForeignPtr afterwards.
unsafeFromForeignPtr0 :: Storable a => ForeignPtr a -> Int -> Vector a

-- | O(1) Yield the underlying ForeignPtr together with the
--   offset to the data and its length. The data may not be modified
--   through the ForeignPtr.
unsafeToForeignPtr :: Storable a => Vector a -> (ForeignPtr a, Int, Int)

-- | O(1) Yield the underlying ForeignPtr together with its
--   length.
--   
--   You can assume the pointer points directly to the data (no offset).
--   
--   The data may not be modified through the ForeignPtr.
unsafeToForeignPtr0 :: Storable a => Vector a -> (ForeignPtr a, Int)

-- | Lifted version of unsafeWith
unsafeWith :: (MonadUnliftIO m, Storable a) => Vector a -> (Ptr a -> m b) -> m b

-- | Unboxed Vector. Import as:
--   
--   
--   import qualified RIO.Vector.Unboxed as VU
--   
--   
--   This module does not export any partial or unsafe functions. For
--   those, see RIO.Vector.Unboxed.Partial and
--   RIO.Vector.Unboxed.Unsafe
module RIO.Vector.Unboxed
data family Vector a
data family MVector s a
class (Vector Vector a, MVector MVector a) => Unbox a

-- | O(1) Yield the length of the vector
length :: Unbox a => Vector a -> Int

-- | O(1) Test whether a vector is empty
null :: Unbox a => Vector a -> Bool

-- | O(1) Safe indexing
(!?) :: Unbox a => Vector a -> Int -> Maybe a

-- | O(1) Yield a slice of the vector without copying it. The vector
--   must contain at least i+n elements.
slice :: Unbox a => Int -> Int -> Vector a -> Vector a

-- | O(1) Yield at the first n elements without copying.
--   The vector may contain less than n elements in which case it
--   is returned unchanged.
take :: Unbox a => Int -> Vector a -> Vector a

-- | O(1) Yield all but the first n elements without
--   copying. The vector may contain less than n elements in which
--   case an empty vector is returned.
drop :: Unbox a => Int -> Vector a -> Vector a

-- | O(1) Yield the first n elements paired with the
--   remainder without copying.
--   
--   Note that splitAt n v is equivalent to
--   (take n v, drop n v) but slightly more
--   efficient.
splitAt :: Unbox a => Int -> Vector a -> (Vector a, Vector a)

-- | O(1) Empty vector
empty :: Unbox a => Vector a

-- | O(1) Vector with exactly one element
singleton :: Unbox a => a -> Vector a

-- | O(n) Vector of the given length with the same value in each
--   position
replicate :: Unbox a => Int -> a -> Vector a

-- | O(n) Construct a vector of the given length by applying the
--   function to each index
generate :: Unbox a => Int -> (Int -> a) -> Vector a

-- | O(n) Apply function n times to value. Zeroth element is
--   original value.
iterateN :: Unbox a => Int -> (a -> a) -> a -> Vector a

-- | O(n) Execute the monadic action the given number of times and
--   store the results in a vector.
replicateM :: (Monad m, Unbox a) => Int -> m a -> m (Vector a)

-- | O(n) Construct a vector of the given length by applying the
--   monadic action to each index
generateM :: (Monad m, Unbox a) => Int -> (Int -> m a) -> m (Vector a)

-- | O(n) Apply monadic function n times to value. Zeroth element is
--   original value.
iterateNM :: (Monad m, Unbox a) => Int -> (a -> m a) -> a -> m (Vector a)

-- | Execute the monadic action and freeze the resulting vector.
--   
--   
--   create (do { v <- new 2; write v 0 'a'; write v 1 'b'; return v }) = <a,b>
--   
create :: Unbox a => (forall s. () => ST s (MVector s a)) -> Vector a

-- | Execute the monadic action and freeze the resulting vectors.
createT :: (Traversable f, Unbox a) => (forall s. () => ST s (f (MVector s a))) -> f (Vector a)

-- | O(n) Construct a vector by repeatedly applying the generator
--   function to a seed. The generator function yields Just the next
--   element and the new seed or Nothing if there are no more
--   elements.
--   
--   
--   unfoldr (\n -> if n == 0 then Nothing else Just (n,n-1)) 10
--    = <10,9,8,7,6,5,4,3,2,1>
--   
unfoldr :: Unbox a => (b -> Maybe (a, b)) -> b -> Vector a

-- | O(n) Construct a vector with at most n elements by
--   repeatedly applying the generator function to a seed. The generator
--   function yields Just the next element and the new seed or
--   Nothing if there are no more elements.
--   
--   
--   unfoldrN 3 (\n -> Just (n,n-1)) 10 = <10,9,8>
--   
unfoldrN :: Unbox a => Int -> (b -> Maybe (a, b)) -> b -> Vector a

-- | O(n) Construct a vector by repeatedly applying the monadic
--   generator function to a seed. The generator function yields
--   Just the next element and the new seed or Nothing if
--   there are no more elements.
unfoldrM :: (Monad m, Unbox a) => (b -> m (Maybe (a, b))) -> b -> m (Vector a)

-- | O(n) Construct a vector by repeatedly applying the monadic
--   generator function to a seed. The generator function yields
--   Just the next element and the new seed or Nothing if
--   there are no more elements.
unfoldrNM :: (Monad m, Unbox a) => Int -> (b -> m (Maybe (a, b))) -> b -> m (Vector a)

-- | O(n) Construct a vector with n elements by repeatedly
--   applying the generator function to the already constructed part of the
--   vector.
--   
--   
--   constructN 3 f = let a = f <> ; b = f <a> ; c = f <a,b> in <a,b,c>
--   
constructN :: Unbox a => Int -> (Vector a -> a) -> Vector a

-- | O(n) Construct a vector with n elements from right to
--   left by repeatedly applying the generator function to the already
--   constructed part of the vector.
--   
--   
--   constructrN 3 f = let a = f <> ; b = f<a> ; c = f <b,a> in <c,b,a>
--   
constructrN :: Unbox a => Int -> (Vector a -> a) -> Vector a

-- | O(n) Yield a vector of the given length containing the values
--   x, x+1 etc. This operation is usually more efficient
--   than enumFromTo.
--   
--   
--   enumFromN 5 3 = <5,6,7>
--   
enumFromN :: (Unbox a, Num a) => a -> Int -> Vector a

-- | O(n) Yield a vector of the given length containing the values
--   x, x+y, x+y+y etc. This operations is
--   usually more efficient than enumFromThenTo.
--   
--   
--   enumFromStepN 1 0.1 5 = <1,1.1,1.2,1.3,1.4>
--   
enumFromStepN :: (Unbox a, Num a) => a -> a -> Int -> Vector a

-- | O(n) Enumerate values from x to y.
--   
--   WARNING: This operation can be very inefficient. If at all
--   possible, use enumFromN instead.
enumFromTo :: (Unbox a, Enum a) => a -> a -> Vector a

-- | O(n) Enumerate values from x to y with a
--   specific step z.
--   
--   WARNING: This operation can be very inefficient. If at all
--   possible, use enumFromStepN instead.
enumFromThenTo :: (Unbox a, Enum a) => a -> a -> a -> Vector a

-- | O(n) Prepend an element
cons :: Unbox a => a -> Vector a -> Vector a

-- | O(n) Append an element
snoc :: Unbox a => Vector a -> a -> Vector a

-- | O(m+n) Concatenate two vectors
(++) :: Unbox a => Vector a -> Vector a -> Vector a
infixr 5 ++

-- | O(n) Concatenate all vectors in the list
concat :: Unbox a => [Vector a] -> Vector a

-- | O(n) Yield the argument but force it not to retain any extra
--   memory, possibly by copying it.
--   
--   This is especially useful when dealing with slices. For example:
--   
--   
--   force (slice 0 2 <huge vector>)
--   
--   
--   Here, the slice retains a reference to the huge vector. Forcing it
--   creates a copy of just the elements that belong to the slice and
--   allows the huge vector to be garbage collected.
force :: Unbox a => Vector a -> Vector a

-- | O(n) Reverse a vector
reverse :: Unbox a => Vector a -> Vector a

-- | Apply a destructive operation to a vector. The operation will be
--   performed in place if it is safe to do so and will modify a copy of
--   the vector otherwise.
--   
--   
--   modify (\v -> write v 0 'x') (replicate 3 'a') = <'x','a','a'>
--   
modify :: Unbox a => (forall s. () => MVector s a -> ST s ()) -> Vector a -> Vector a

-- | O(n) Pair each element in a vector with its index
indexed :: Unbox a => Vector a -> Vector (Int, a)

-- | O(n) Map a function over a vector
map :: (Unbox a, Unbox b) => (a -> b) -> Vector a -> Vector b

-- | O(n) Apply a function to every element of a vector and its
--   index
imap :: (Unbox a, Unbox b) => (Int -> a -> b) -> Vector a -> Vector b

-- | Map a function over a vector and concatenate the results.
concatMap :: (Unbox a, Unbox b) => (a -> Vector b) -> Vector a -> Vector b

-- | O(n) Apply the monadic action to all elements of the vector,
--   yielding a vector of results
mapM :: (Monad m, Unbox a, Unbox b) => (a -> m b) -> Vector a -> m (Vector b)

-- | O(n) Apply the monadic action to every element of a vector and
--   its index, yielding a vector of results
imapM :: (Monad m, Unbox a, Unbox b) => (Int -> a -> m b) -> Vector a -> m (Vector b)

-- | O(n) Apply the monadic action to all elements of a vector and
--   ignore the results
mapM_ :: (Monad m, Unbox a) => (a -> m b) -> Vector a -> m ()

-- | O(n) Apply the monadic action to every element of a vector and
--   its index, ignoring the results
imapM_ :: (Monad m, Unbox a) => (Int -> a -> m b) -> Vector a -> m ()

-- | O(n) Apply the monadic action to all elements of the vector,
--   yielding a vector of results. Equivalent to flip mapM.
forM :: (Monad m, Unbox a, Unbox b) => Vector a -> (a -> m b) -> m (Vector b)

-- | O(n) Apply the monadic action to all elements of a vector and
--   ignore the results. Equivalent to flip mapM_.
forM_ :: (Monad m, Unbox a) => Vector a -> (a -> m b) -> m ()

-- | O(min(m,n)) Zip two vectors with the given function.
zipWith :: (Unbox a, Unbox b, Unbox c) => (a -> b -> c) -> Vector a -> Vector b -> Vector c

-- | Zip three vectors with the given function.
zipWith3 :: (Unbox a, Unbox b, Unbox c, Unbox d) => (a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d
zipWith4 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e) => (a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
zipWith5 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f) => (a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f
zipWith6 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f, Unbox g) => (a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g

-- | O(min(m,n)) Zip two vectors with a function that also takes the
--   elements' indices.
izipWith :: (Unbox a, Unbox b, Unbox c) => (Int -> a -> b -> c) -> Vector a -> Vector b -> Vector c

-- | Zip three vectors and their indices with the given function.
izipWith3 :: (Unbox a, Unbox b, Unbox c, Unbox d) => (Int -> a -> b -> c -> d) -> Vector a -> Vector b -> Vector c -> Vector d
izipWith4 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e) => (Int -> a -> b -> c -> d -> e) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e
izipWith5 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f) => (Int -> a -> b -> c -> d -> e -> f) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f
izipWith6 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f, Unbox g) => (Int -> a -> b -> c -> d -> e -> f -> g) -> Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector g

-- | O(1) Zip 2 vectors
zip :: (Unbox a, Unbox b) => Vector a -> Vector b -> Vector (a, b)

-- | O(1) Zip 3 vectors
zip3 :: (Unbox a, Unbox b, Unbox c) => Vector a -> Vector b -> Vector c -> Vector (a, b, c)

-- | O(1) Zip 4 vectors
zip4 :: (Unbox a, Unbox b, Unbox c, Unbox d) => Vector a -> Vector b -> Vector c -> Vector d -> Vector (a, b, c, d)

-- | O(1) Zip 5 vectors
zip5 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e) => Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector (a, b, c, d, e)

-- | O(1) Zip 6 vectors
zip6 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f) => Vector a -> Vector b -> Vector c -> Vector d -> Vector e -> Vector f -> Vector (a, b, c, d, e, f)

-- | O(min(m,n)) Zip the two vectors with the monadic action and
--   yield a vector of results
zipWithM :: (Monad m, Unbox a, Unbox b, Unbox c) => (a -> b -> m c) -> Vector a -> Vector b -> m (Vector c)

-- | O(min(m,n)) Zip the two vectors with a monadic action that also
--   takes the element index and yield a vector of results
izipWithM :: (Monad m, Unbox a, Unbox b, Unbox c) => (Int -> a -> b -> m c) -> Vector a -> Vector b -> m (Vector c)

-- | O(min(m,n)) Zip the two vectors with the monadic action and
--   ignore the results
zipWithM_ :: (Monad m, Unbox a, Unbox b) => (a -> b -> m c) -> Vector a -> Vector b -> m ()

-- | O(min(m,n)) Zip the two vectors with a monadic action that also
--   takes the element index and ignore the results
izipWithM_ :: (Monad m, Unbox a, Unbox b) => (Int -> a -> b -> m c) -> Vector a -> Vector b -> m ()

-- | O(1) Unzip 2 vectors
unzip :: (Unbox a, Unbox b) => Vector (a, b) -> (Vector a, Vector b)

-- | O(1) Unzip 3 vectors
unzip3 :: (Unbox a, Unbox b, Unbox c) => Vector (a, b, c) -> (Vector a, Vector b, Vector c)

-- | O(1) Unzip 4 vectors
unzip4 :: (Unbox a, Unbox b, Unbox c, Unbox d) => Vector (a, b, c, d) -> (Vector a, Vector b, Vector c, Vector d)

-- | O(1) Unzip 5 vectors
unzip5 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e) => Vector (a, b, c, d, e) -> (Vector a, Vector b, Vector c, Vector d, Vector e)

-- | O(1) Unzip 6 vectors
unzip6 :: (Unbox a, Unbox b, Unbox c, Unbox d, Unbox e, Unbox f) => Vector (a, b, c, d, e, f) -> (Vector a, Vector b, Vector c, Vector d, Vector e, Vector f)

-- | O(n) Drop elements that do not satisfy the predicate
filter :: Unbox a => (a -> Bool) -> Vector a -> Vector a

-- | O(n) Drop elements that do not satisfy the predicate which is
--   applied to values and their indices
ifilter :: Unbox a => (Int -> a -> Bool) -> Vector a -> Vector a

-- | O(n) Drop repeated adjacent elements.
uniq :: (Unbox a, Eq a) => Vector a -> Vector a

-- | O(n) Drop elements when predicate returns Nothing
mapMaybe :: (Unbox a, Unbox b) => (a -> Maybe b) -> Vector a -> Vector b

-- | O(n) Drop elements when predicate, applied to index and value,
--   returns Nothing
imapMaybe :: (Unbox a, Unbox b) => (Int -> a -> Maybe b) -> Vector a -> Vector b

-- | O(n) Drop elements that do not satisfy the monadic predicate
filterM :: (Monad m, Unbox a) => (a -> m Bool) -> Vector a -> m (Vector a)

-- | O(n) Yield the longest prefix of elements satisfying the
--   predicate without copying.
takeWhile :: Unbox a => (a -> Bool) -> Vector a -> Vector a

-- | O(n) Drop the longest prefix of elements that satisfy the
--   predicate without copying.
dropWhile :: Unbox a => (a -> Bool) -> Vector a -> Vector a

-- | O(n) Split the vector in two parts, the first one containing
--   those elements that satisfy the predicate and the second one those
--   that don't. The relative order of the elements is preserved at the
--   cost of a sometimes reduced performance compared to
--   unstablePartition.
partition :: Unbox a => (a -> Bool) -> Vector a -> (Vector a, Vector a)

-- | O(n) Split the vector in two parts, the first one containing
--   those elements that satisfy the predicate and the second one those
--   that don't. The order of the elements is not preserved but the
--   operation is often faster than partition.
unstablePartition :: Unbox a => (a -> Bool) -> Vector a -> (Vector a, Vector a)

-- | O(n) Split the vector into the longest prefix of elements that
--   satisfy the predicate and the rest without copying.
span :: Unbox a => (a -> Bool) -> Vector a -> (Vector a, Vector a)

-- | O(n) Split the vector into the longest prefix of elements that
--   do not satisfy the predicate and the rest without copying.
break :: Unbox a => (a -> Bool) -> Vector a -> (Vector a, Vector a)

-- | O(n) Check if the vector contains an element
elem :: (Unbox a, Eq a) => a -> Vector a -> Bool
infix 4 `elem`

-- | O(n) Check if the vector does not contain an element (inverse
--   of elem)
notElem :: (Unbox a, Eq a) => a -> Vector a -> Bool
infix 4 `notElem`

-- | O(n) Yield Just the first element matching the predicate
--   or Nothing if no such element exists.
find :: Unbox a => (a -> Bool) -> Vector a -> Maybe a

-- | O(n) Yield Just the index of the first element matching
--   the predicate or Nothing if no such element exists.
findIndex :: Unbox a => (a -> Bool) -> Vector a -> Maybe Int

-- | O(n) Yield the indices of elements satisfying the predicate in
--   ascending order.
findIndices :: Unbox a => (a -> Bool) -> Vector a -> Vector Int

-- | O(n) Yield Just the index of the first occurence of the
--   given element or Nothing if the vector does not contain the
--   element. This is a specialised version of findIndex.
elemIndex :: (Unbox a, Eq a) => a -> Vector a -> Maybe Int

-- | O(n) Yield the indices of all occurences of the given element
--   in ascending order. This is a specialised version of
--   findIndices.
elemIndices :: (Unbox a, Eq a) => a -> Vector a -> Vector Int

-- | O(n) Left fold
foldl :: Unbox b => (a -> b -> a) -> a -> Vector b -> a

-- | O(n) Left fold with strict accumulator
foldl' :: Unbox b => (a -> b -> a) -> a -> Vector b -> a

-- | O(n) Right fold
foldr :: Unbox a => (a -> b -> b) -> b -> Vector a -> b

-- | O(n) Right fold with a strict accumulator
foldr' :: Unbox a => (a -> b -> b) -> b -> Vector a -> b

-- | O(n) Left fold (function applied to each element and its index)
ifoldl :: Unbox b => (a -> Int -> b -> a) -> a -> Vector b -> a

-- | O(n) Left fold with strict accumulator (function applied to
--   each element and its index)
ifoldl' :: Unbox b => (a -> Int -> b -> a) -> a -> Vector b -> a

-- | O(n) Right fold (function applied to each element and its
--   index)
ifoldr :: Unbox a => (Int -> a -> b -> b) -> b -> Vector a -> b

-- | O(n) Right fold with strict accumulator (function applied to
--   each element and its index)
ifoldr' :: Unbox a => (Int -> a -> b -> b) -> b -> Vector a -> b

-- | O(n) Check if all elements satisfy the predicate.
all :: Unbox a => (a -> Bool) -> Vector a -> Bool

-- | O(n) Check if any element satisfies the predicate.
any :: Unbox a => (a -> Bool) -> Vector a -> Bool

-- | O(n) Check if all elements are True
and :: Vector Bool -> Bool

-- | O(n) Check if any element is True
or :: Vector Bool -> Bool

-- | O(n) Compute the sum of the elements
sum :: (Unbox a, Num a) => Vector a -> a

-- | O(n) Compute the produce of the elements
product :: (Unbox a, Num a) => Vector a -> a

-- | O(n) Monadic fold
foldM :: (Monad m, Unbox b) => (a -> b -> m a) -> a -> Vector b -> m a

-- | O(n) Monadic fold (action applied to each element and its
--   index)
ifoldM :: (Monad m, Unbox b) => (a -> Int -> b -> m a) -> a -> Vector b -> m a

-- | O(n) Monadic fold with strict accumulator
foldM' :: (Monad m, Unbox b) => (a -> b -> m a) -> a -> Vector b -> m a

-- | O(n) Monadic fold with strict accumulator (action applied to
--   each element and its index)
ifoldM' :: (Monad m, Unbox b) => (a -> Int -> b -> m a) -> a -> Vector b -> m a

-- | O(n) Monadic fold that discards the result
foldM_ :: (Monad m, Unbox b) => (a -> b -> m a) -> a -> Vector b -> m ()

-- | O(n) Monadic fold that discards the result (action applied to
--   each element and its index)
ifoldM_ :: (Monad m, Unbox b) => (a -> Int -> b -> m a) -> a -> Vector b -> m ()

-- | O(n) Monadic fold with strict accumulator that discards the
--   result
foldM'_ :: (Monad m, Unbox b) => (a -> b -> m a) -> a -> Vector b -> m ()

-- | O(n) Monadic fold with strict accumulator that discards the
--   result (action applied to each element and its index)
ifoldM'_ :: (Monad m, Unbox b) => (a -> Int -> b -> m a) -> a -> Vector b -> m ()

-- | O(n) Prescan
--   
--   
--   prescanl f z = init . scanl f z
--   
--   
--   Example: prescanl (+) 0 <1,2,3,4> = <0,1,3,6>
prescanl :: (Unbox a, Unbox b) => (a -> b -> a) -> a -> Vector b -> Vector a

-- | O(n) Prescan with strict accumulator
prescanl' :: (Unbox a, Unbox b) => (a -> b -> a) -> a -> Vector b -> Vector a

-- | O(n) Scan
--   
--   
--   postscanl f z = tail . scanl f z
--   
--   
--   Example: postscanl (+) 0 <1,2,3,4> = <1,3,6,10>
postscanl :: (Unbox a, Unbox b) => (a -> b -> a) -> a -> Vector b -> Vector a

-- | O(n) Scan with strict accumulator
postscanl' :: (Unbox a, Unbox b) => (a -> b -> a) -> a -> Vector b -> Vector a

-- | O(n) Haskell-style scan
--   
--   
--   scanl f z <x1,...,xn> = <y1,...,y(n+1)>
--     where y1 = z
--           yi = f y(i-1) x(i-1)
--   
--   
--   Example: scanl (+) 0 <1,2,3,4> = <0,1,3,6,10>
scanl :: (Unbox a, Unbox b) => (a -> b -> a) -> a -> Vector b -> Vector a

-- | O(n) Haskell-style scan with strict accumulator
scanl' :: (Unbox a, Unbox b) => (a -> b -> a) -> a -> Vector b -> Vector a

-- | O(n) Right-to-left prescan
--   
--   
--   prescanr f z = reverse . prescanl (flip f) z . reverse
--   
prescanr :: (Unbox a, Unbox b) => (a -> b -> b) -> b -> Vector a -> Vector b

-- | O(n) Right-to-left prescan with strict accumulator
prescanr' :: (Unbox a, Unbox b) => (a -> b -> b) -> b -> Vector a -> Vector b

-- | O(n) Right-to-left scan
postscanr :: (Unbox a, Unbox b) => (a -> b -> b) -> b -> Vector a -> Vector b

-- | O(n) Right-to-left scan with strict accumulator
postscanr' :: (Unbox a, Unbox b) => (a -> b -> b) -> b -> Vector a -> Vector b

-- | O(n) Right-to-left Haskell-style scan
scanr :: (Unbox a, Unbox b) => (a -> b -> b) -> b -> Vector a -> Vector b

-- | O(n) Right-to-left Haskell-style scan with strict accumulator
scanr' :: (Unbox a, Unbox b) => (a -> b -> b) -> b -> Vector a -> Vector b

-- | O(n) Convert a vector to a list
toList :: Unbox a => Vector a -> [a]

-- | O(n) Convert a list to a vector
fromList :: Unbox a => [a] -> Vector a

-- | O(n) Convert the first n elements of a list to a
--   vector
--   
--   
--   fromListN n xs = fromList (take n xs)
--   
fromListN :: Unbox a => Int -> [a] -> Vector a

-- | O(n) Convert different vector types
convert :: (Vector v a, Vector w a) => v a -> w a

-- | O(n) Yield an immutable copy of the mutable vector.
freeze :: (Unbox a, PrimMonad m) => MVector (PrimState m) a -> m (Vector a)

-- | O(n) Yield a mutable copy of the immutable vector.
thaw :: (Unbox a, PrimMonad m) => Vector a -> m (MVector (PrimState m) a)

-- | O(n) Copy an immutable vector into a mutable one. The two
--   vectors must have the same length.
copy :: (Unbox a, PrimMonad m) => MVector (PrimState m) a -> Vector a -> m ()

-- | Unboxed Vector partial functions. Import as:
--   
--   
--   import qualified RIO.Vector.Unboxed.Partial as VU'
--   
module RIO.Vector.Unboxed.Partial

-- | O(1) Indexing
(!) :: Unbox a => Vector a -> Int -> a

-- | O(1) First element
head :: Unbox a => Vector a -> a

-- | O(1) Last element
last :: Unbox a => Vector a -> a

-- | O(1) Indexing in a monad.
--   
--   The monad allows operations to be strict in the vector when necessary.
--   Suppose vector copying is implemented like this:
--   
--   
--   copy mv v = ... write mv i (v ! i) ...
--   
--   
--   For lazy vectors, v ! i would not be evaluated which means
--   that mv would unnecessarily retain a reference to v
--   in each element written.
--   
--   With indexM, copying can be implemented like this instead:
--   
--   
--   copy mv v = ... do
--                     x <- indexM v i
--                     write mv i x
--   
--   
--   Here, no references to v are retained because indexing (but
--   not the elements) is evaluated eagerly.
indexM :: (Unbox a, Monad m) => Vector a -> Int -> m a

-- | O(1) First element of a vector in a monad. See indexM
--   for an explanation of why this is useful.
headM :: (Unbox a, Monad m) => Vector a -> m a

-- | O(1) Last element of a vector in a monad. See indexM for
--   an explanation of why this is useful.
lastM :: (Unbox a, Monad m) => Vector a -> m a

-- | O(1) Yield all but the last element without copying. The vector
--   may not be empty.
init :: Unbox a => Vector a -> Vector a

-- | O(1) Yield all but the first element without copying. The
--   vector may not be empty.
tail :: Unbox a => Vector a -> Vector a

-- | O(m+n) For each pair (i,a) from the list, replace the
--   vector element at position i by a.
--   
--   
--   <5,9,2,7> // [(2,1),(0,3),(2,8)] = <3,9,8,7>
--   
(//) :: Unbox a => Vector a -> [(Int, a)] -> Vector a

-- | O(m+n) For each pair (i,a) from the vector of
--   index/value pairs, replace the vector element at position i
--   by a.
--   
--   
--   update <5,9,2,7> <(2,1),(0,3),(2,8)> = <3,9,8,7>
--   
update :: Unbox a => Vector a -> Vector (Int, a) -> Vector a

-- | O(m+min(n1,n2)) For each index i from the index vector
--   and the corresponding value a from the value vector, replace
--   the element of the initial vector at position i by
--   a.
--   
--   
--   update_ <5,9,2,7>  <2,0,2> <1,3,8> = <3,9,8,7>
--   
--   
--   The function update provides the same functionality and is
--   usually more convenient.
--   
--   
--   update_ xs is ys = update xs (zip is ys)
--   
update_ :: Unbox a => Vector a -> Vector Int -> Vector a -> Vector a

-- | O(m+n) For each pair (i,b) from the list, replace the
--   vector element a at position i by f a b.
--   
--   
--   accum (+) <5,9,2> [(2,4),(1,6),(0,3),(1,7)] = <5+3, 9+6+7, 2+4>
--   
accum :: Unbox a => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a

-- | O(m+n) For each pair (i,b) from the vector of pairs,
--   replace the vector element a at position i by f
--   a b.
--   
--   
--   accumulate (+) <5,9,2> <(2,4),(1,6),(0,3),(1,7)> = <5+3, 9+6+7, 2+4>
--   
accumulate :: (Unbox a, Unbox b) => (a -> b -> a) -> Vector a -> Vector (Int, b) -> Vector a

-- | O(m+min(n1,n2)) For each index i from the index vector
--   and the corresponding value b from the the value vector,
--   replace the element of the initial vector at position i by
--   f a b.
--   
--   
--   accumulate_ (+) <5,9,2> <2,1,0,1> <4,6,3,7> = <5+3, 9+6+7, 2+4>
--   
--   
--   The function accumulate provides the same functionality and is
--   usually more convenient.
--   
--   
--   accumulate_ f as is bs = accumulate f as (zip is bs)
--   
accumulate_ :: (Unbox a, Unbox b) => (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a

-- | O(n) Yield the vector obtained by replacing each element
--   i of the index vector by xs!i. This is
--   equivalent to map (xs!) is but is often much
--   more efficient.
--   
--   
--   backpermute <a,b,c,d> <0,3,2,3,1,0> = <a,d,c,d,b,a>
--   
backpermute :: Unbox a => Vector a -> Vector Int -> Vector a

-- | O(n) Left fold on non-empty vectors
foldl1 :: Unbox a => (a -> a -> a) -> Vector a -> a

-- | O(n) Left fold on non-empty vectors with strict accumulator
foldl1' :: Unbox a => (a -> a -> a) -> Vector a -> a

-- | O(n) Right fold on non-empty vectors
foldr1 :: Unbox a => (a -> a -> a) -> Vector a -> a

-- | O(n) Right fold on non-empty vectors with strict accumulator
foldr1' :: Unbox a => (a -> a -> a) -> Vector a -> a

-- | O(n) Yield the maximum element of the vector. The vector may
--   not be empty.
maximum :: (Unbox a, Ord a) => Vector a -> a

-- | O(n) Yield the maximum element of the vector according to the
--   given comparison function. The vector may not be empty.
maximumBy :: Unbox a => (a -> a -> Ordering) -> Vector a -> a

-- | O(n) Yield the minimum element of the vector. The vector may
--   not be empty.
minimum :: (Unbox a, Ord a) => Vector a -> a

-- | O(n) Yield the minimum element of the vector according to the
--   given comparison function. The vector may not be empty.
minimumBy :: Unbox a => (a -> a -> Ordering) -> Vector a -> a

-- | O(n) Yield the index of the minimum element of the vector. The
--   vector may not be empty.
minIndex :: (Unbox a, Ord a) => Vector a -> Int

-- | O(n) Yield the index of the minimum element of the vector
--   according to the given comparison function. The vector may not be
--   empty.
minIndexBy :: Unbox a => (a -> a -> Ordering) -> Vector a -> Int

-- | O(n) Yield the index of the maximum element of the vector. The
--   vector may not be empty.
maxIndex :: (Unbox a, Ord a) => Vector a -> Int

-- | O(n) Yield the index of the maximum element of the vector
--   according to the given comparison function. The vector may not be
--   empty.
maxIndexBy :: Unbox a => (a -> a -> Ordering) -> Vector a -> Int

-- | O(n) Monadic fold over non-empty vectors
fold1M :: (Monad m, Unbox a) => (a -> a -> m a) -> Vector a -> m a

-- | O(n) Monadic fold over non-empty vectors with strict
--   accumulator
fold1M' :: (Monad m, Unbox a) => (a -> a -> m a) -> Vector a -> m a

-- | O(n) Monadic fold over non-empty vectors that discards the
--   result
fold1M_ :: (Monad m, Unbox a) => (a -> a -> m a) -> Vector a -> m ()

-- | O(n) Monadic fold over non-empty vectors with strict
--   accumulator that discards the result
fold1M'_ :: (Monad m, Unbox a) => (a -> a -> m a) -> Vector a -> m ()

-- | O(n) Scan over a non-empty vector
--   
--   
--   scanl f <x1,...,xn> = <y1,...,yn>
--     where y1 = x1
--           yi = f y(i-1) xi
--   
scanl1 :: Unbox a => (a -> a -> a) -> Vector a -> Vector a

-- | O(n) Scan over a non-empty vector with a strict accumulator
scanl1' :: Unbox a => (a -> a -> a) -> Vector a -> Vector a

-- | O(n) Right-to-left scan over a non-empty vector
scanr1 :: Unbox a => (a -> a -> a) -> Vector a -> Vector a

-- | O(n) Right-to-left scan over a non-empty vector with a strict
--   accumulator
scanr1' :: Unbox a => (a -> a -> a) -> Vector a -> Vector a

-- | Unoxed Vector unsafe functions. These perform no bounds
--   checking, and may cause segmentation faults etc.! Import as:
--   
--   
--   import qualified RIO.Vector.Unoxed.Unsafe as VU'
--   
module RIO.Vector.Unboxed.Unsafe

-- | O(1) Unsafe indexing without bounds checking
unsafeIndex :: Unbox a => Vector a -> Int -> a

-- | O(1) First element without checking if the vector is empty
unsafeHead :: Unbox a => Vector a -> a

-- | O(1) Last element without checking if the vector is empty
unsafeLast :: Unbox a => Vector a -> a

-- | O(1) Indexing in a monad without bounds checks. See
--   indexM for an explanation of why this is useful.
unsafeIndexM :: (Unbox a, Monad m) => Vector a -> Int -> m a

-- | O(1) First element in a monad without checking for empty
--   vectors. See indexM for an explanation of why this is useful.
unsafeHeadM :: (Unbox a, Monad m) => Vector a -> m a

-- | O(1) Last element in a monad without checking for empty
--   vectors. See indexM for an explanation of why this is useful.
unsafeLastM :: (Unbox a, Monad m) => Vector a -> m a

-- | O(1) Yield a slice of the vector without copying. The vector
--   must contain at least i+n elements but this is not checked.
unsafeSlice :: Unbox a => Int -> Int -> Vector a -> Vector a

-- | O(1) Yield all but the last element without copying. The vector
--   may not be empty but this is not checked.
unsafeInit :: Unbox a => Vector a -> Vector a

-- | O(1) Yield all but the first element without copying. The
--   vector may not be empty but this is not checked.
unsafeTail :: Unbox a => Vector a -> Vector a

-- | O(1) Yield the first n elements without copying. The
--   vector must contain at least n elements but this is not
--   checked.
unsafeTake :: Unbox a => Int -> Vector a -> Vector a

-- | O(1) Yield all but the first n elements without
--   copying. The vector must contain at least n elements but this
--   is not checked.
unsafeDrop :: Unbox a => Int -> Vector a -> Vector a

-- | Same as (//) but without bounds checking.
unsafeUpd :: Unbox a => Vector a -> [(Int, a)] -> Vector a

-- | Same as update but without bounds checking.
unsafeUpdate :: Unbox a => Vector a -> Vector (Int, a) -> Vector a

-- | Same as update_ but without bounds checking.
unsafeUpdate_ :: Unbox a => Vector a -> Vector Int -> Vector a -> Vector a

-- | Same as accum but without bounds checking.
unsafeAccum :: Unbox a => (a -> b -> a) -> Vector a -> [(Int, b)] -> Vector a

-- | Same as accumulate but without bounds checking.
unsafeAccumulate :: (Unbox a, Unbox b) => (a -> b -> a) -> Vector a -> Vector (Int, b) -> Vector a

-- | Same as accumulate_ but without bounds checking.
unsafeAccumulate_ :: (Unbox a, Unbox b) => (a -> b -> a) -> Vector a -> Vector Int -> Vector b -> Vector a

-- | Same as backpermute but without bounds checking.
unsafeBackpermute :: Unbox a => Vector a -> Vector Int -> Vector a

-- | O(1) Unsafe convert a mutable vector to an immutable one
--   without copying. The mutable vector may not be used after this
--   operation.
unsafeFreeze :: (Unbox a, PrimMonad m) => MVector (PrimState m) a -> m (Vector a)

-- | O(1) Unsafely convert an immutable vector to a mutable one
--   without copying. The immutable vector may not be used after this
--   operation.
unsafeThaw :: (Unbox a, PrimMonad m) => Vector a -> m (MVector (PrimState m) a)

-- | O(n) Copy an immutable vector into a mutable one. The two
--   vectors must have the same length. This is not checked.
unsafeCopy :: (Unbox a, PrimMonad m) => MVector (PrimState m) a -> Vector a -> m ()

-- | Generic Vector interface unsafe functions. These perform no
--   bounds checking, and may cause segmentation faults etc.! Import as:
--   
--   
--   import qualified RIO.Vector.Unsafe as V'
--   
module RIO.Vector.Unsafe

-- | Class of immutable vectors. Every immutable vector is associated with
--   its mutable version through the Mutable type family. Methods of
--   this class should not be used directly. Instead,
--   Data.Vector.Generic and other Data.Vector modules provide safe
--   and fusible wrappers.
--   
--   Minimum complete implementation:
--   
--   
--   
- basicUnsafeFreeze
--   
- basicUnsafeThaw
--   
- basicLength
--   
- basicUnsafeSlice
--   
- basicUnsafeIndexM
--   
class MVector Mutable v a => Vector (v :: Type -> Type) a

-- | Assumed complexity: O(1)
--   
--   Unsafely convert a mutable vector to its immutable version without
--   copying. The mutable vector may not be used after this operation.
basicUnsafeFreeze :: (Vector v a, PrimMonad m) => Mutable v (PrimState m) a -> m (v a)

-- | Assumed complexity: O(1)
--   
--   Unsafely convert an immutable vector to its mutable version without
--   copying. The immutable vector may not be used after this operation.
basicUnsafeThaw :: (Vector v a, PrimMonad m) => v a -> m (Mutable v (PrimState m) a)

-- | Assumed complexity: O(1)
--   
--   Yield the length of the vector.
basicLength :: Vector v a => v a -> Int

-- | Assumed complexity: O(1)
--   
--   Yield a slice of the vector without copying it. No range checks are
--   performed.
basicUnsafeSlice :: Vector v a => Int -> Int -> v a -> v a

-- | Assumed complexity: O(1)
--   
--   Yield the element at the given position in a monad. No range checks
--   are performed.
--   
--   The monad allows us to be strict in the vector if we want. Suppose we
--   had
--   
--   
--   unsafeIndex :: v a -> Int -> a
--   
--   
--   instead. Now, if we wanted to copy a vector, we'd do something like
--   
--   
--   copy mv v ... = ... unsafeWrite mv i (unsafeIndex v i) ...
--   
--   
--   For lazy vectors, the indexing would not be evaluated which means that
--   we would retain a reference to the original vector in each element we
--   write. This is not what we want!
--   
--   With basicUnsafeIndexM, we can do
--   
--   
--   copy mv v ... = ... case basicUnsafeIndexM v i of
--                         Box x -> unsafeWrite mv i x ...
--   
--   
--   which does not have this problem because indexing (but not the
--   returned element!) is evaluated immediately.
basicUnsafeIndexM :: (Vector v a, Monad m) => v a -> Int -> m a

-- | Assumed complexity: O(n)
--   
--   Copy an immutable vector into a mutable one. The two vectors must have
--   the same length but this is not checked.
--   
--   Instances of Vector should redefine this method if they wish to
--   support an efficient block copy operation.
--   
--   Default definition: copying basic on basicUnsafeIndexM and
--   basicUnsafeWrite.
basicUnsafeCopy :: (Vector v a, PrimMonad m) => Mutable v (PrimState m) a -> v a -> m ()

-- | Evaluate a as far as storing it in a vector would and yield
--   b. The v a argument only fixes the type and is not
--   touched. The method is only used for optimisation purposes. Thus, it
--   is safe for instances of Vector to evaluate a less
--   than it would be when stored in a vector although this might result in
--   suboptimal code.
--   
--   
--   elemseq v x y = (singleton x `asTypeOf` v) `seq` y
--   
--   
--   Default defintion: a is not evaluated at all
elemseq :: Vector v a => v a -> a -> b -> b

-- | O(1) Unsafe indexing without bounds checking
unsafeIndex :: Vector v a => v a -> Int -> a

-- | O(1) First element without checking if the vector is empty
unsafeHead :: Vector v a => v a -> a

-- | O(1) Last element without checking if the vector is empty
unsafeLast :: Vector v a => v a -> a

-- | O(1) Indexing in a monad without bounds checks. See
--   indexM for an explanation of why this is useful.
unsafeIndexM :: (Vector v a, Monad m) => v a -> Int -> m a

-- | O(1) First element in a monad without checking for empty
--   vectors. See indexM for an explanation of why this is useful.
unsafeHeadM :: (Vector v a, Monad m) => v a -> m a

-- | O(1) Last element in a monad without checking for empty
--   vectors. See indexM for an explanation of why this is useful.
unsafeLastM :: (Vector v a, Monad m) => v a -> m a

-- | O(1) Yield a slice of the vector without copying. The vector
--   must contain at least i+n elements but this is not checked.
unsafeSlice :: Vector v a => Int -> Int -> v a -> v a

-- | O(1) Yield all but the last element without copying. The vector
--   may not be empty but this is not checked.
unsafeInit :: Vector v a => v a -> v a

-- | O(1) Yield all but the first element without copying. The
--   vector may not be empty but this is not checked.
unsafeTail :: Vector v a => v a -> v a

-- | O(1) Yield the first n elements without copying. The
--   vector must contain at least n elements but this is not
--   checked.
unsafeTake :: Vector v a => Int -> v a -> v a

-- | O(1) Yield all but the first n elements without
--   copying. The vector must contain at least n elements but this
--   is not checked.
unsafeDrop :: Vector v a => Int -> v a -> v a

-- | Same as (//) but without bounds checking.
unsafeUpd :: Vector v a => v a -> [(Int, a)] -> v a

-- | Same as update but without bounds checking.
unsafeUpdate :: (Vector v a, Vector v (Int, a)) => v a -> v (Int, a) -> v a

-- | Same as update_ but without bounds checking.
unsafeUpdate_ :: (Vector v a, Vector v Int) => v a -> v Int -> v a -> v a

-- | Same as accum but without bounds checking.
unsafeAccum :: Vector v a => (a -> b -> a) -> v a -> [(Int, b)] -> v a

-- | Same as accumulate but without bounds checking.
unsafeAccumulate :: (Vector v a, Vector v (Int, b)) => (a -> b -> a) -> v a -> v (Int, b) -> v a

-- | Same as accumulate_ but without bounds checking.
unsafeAccumulate_ :: (Vector v a, Vector v Int, Vector v b) => (a -> b -> a) -> v a -> v Int -> v b -> v a

-- | Same as backpermute but without bounds checking.
unsafeBackpermute :: (Vector v a, Vector v Int) => v a -> v Int -> v a

-- | O(1) Unsafe convert a mutable vector to an immutable one
--   without copying. The mutable vector may not be used after this
--   operation.
unsafeFreeze :: (PrimMonad m, Vector v a) => Mutable v (PrimState m) a -> m (v a)

-- | O(1) Unsafely convert an immutable vector to a mutable one
--   without copying. The immutable vector may not be used after this
--   operation.
unsafeThaw :: (PrimMonad m, Vector v a) => v a -> m (Mutable v (PrimState m) a)

-- | O(n) Copy an immutable vector into a mutable one. The two
--   vectors must have the same length. This is not checked.
unsafeCopy :: (PrimMonad m, Vector v a) => Mutable v (PrimState m) a -> v a -> m ()

-- | Provides reexports of MonadWriter and related helpers.
module RIO.Writer
class (Monoid w, Monad m) => MonadWriter w (m :: Type -> Type) | m -> w
writer :: MonadWriter w m => (a, w) -> m a
tell :: MonadWriter w m => w -> m ()
listen :: MonadWriter w m => m a -> m (a, w)
pass :: MonadWriter w m => m (a, w -> w) -> m a
listens :: MonadWriter w m => (w -> b) -> m a -> m (a, b)
censor :: MonadWriter w m => (w -> w) -> m a -> m a
type Writer w = WriterT w Identity
runWriter :: Writer w a -> (a, w)
execWriter :: Writer w a -> w
mapWriter :: ((a, w) -> (b, w')) -> Writer w a -> Writer w' b
newtype WriterT w (m :: Type -> Type) a
WriterT :: m (a, w) -> WriterT w (m :: Type -> Type) a
[runWriterT] :: WriterT w (m :: Type -> Type) a -> m (a, w)
execWriterT :: Monad m => WriterT w m a -> m w
mapWriterT :: (m (a, w) -> n (b, w')) -> WriterT w m a -> WriterT w' n b
