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


-- | Safe wrappers for partial list functions, supporting MonadThrow.
--   
--   Data.List includes a handful of partial functions that throw
--   uncatchable exceptions when given empty lists. This package provides
--   safe alternatives for such functions based on MonadThrow which can
--   provide a variety of failure cases: Nothing, IOException, Left, etc.
@package listsafe
@version 0.1.0.1


-- | Operations on lists. This module re-exports all safe functions of
--   <a>List</a>, but wraps all partial functions which may fail. As such,
--   this module can be imported instead of <a>Data.List</a>.
--   
--   Partial functions are wrapped into the <a>MonadThrow</a>-monad from
--   <a>Control.Monad.Catch</a> and as such, have appropriate failure cases
--   for all instances. E.g.:
--   
--   <ul>
--   <li><a>Nothing</a> for <a>Maybe</a>,</li>
--   <li>the empty list for '[a]',</li>
--   <li><tt>IOException</tt> for <a>IO</a>,</li>
--   <li>lifted exceptions for monad transformers.</li>
--   </ul>
module Data.List.Safe
group :: Eq a => [a] -> [[a]]
data [] a
all :: Foldable t => (a -> Bool) -> t a -> Bool
and :: Foldable t => t Bool -> Bool
any :: Foldable t => (a -> Bool) -> t a -> Bool
concat :: Foldable t => t [a] -> [a]
concatMap :: Foldable t => (a -> [b]) -> t a -> [b]
notElem :: (Foldable t, Eq a) => a -> t a -> Bool
or :: Foldable t => t Bool -> Bool
lines :: String -> [String]
unlines :: [String] -> String
unwords :: [String] -> String
words :: String -> [String]
break :: (a -> Bool) -> [a] -> ([a], [a])
cycle :: HasCallStack => [a] -> [a]
drop :: Int -> [a] -> [a]
dropWhile :: (a -> Bool) -> [a] -> [a]
iterate :: (a -> a) -> a -> [a]
lookup :: Eq a => a -> [(a, b)] -> Maybe b
repeat :: a -> [a]
replicate :: Int -> a -> [a]
reverse :: [a] -> [a]
scanl :: (b -> a -> b) -> b -> [a] -> [b]
scanl1 :: (a -> a -> a) -> [a] -> [a]
scanr :: (a -> b -> b) -> b -> [a] -> [b]
scanr1 :: (a -> a -> a) -> [a] -> [a]
span :: (a -> Bool) -> [a] -> ([a], [a])
splitAt :: Int -> [a] -> ([a], [a])
take :: Int -> [a] -> [a]
takeWhile :: (a -> Bool) -> [a] -> [a]
unzip :: [(a, b)] -> ([a], [b])
unzip3 :: [(a, b, c)] -> ([a], [b], [c])
zip3 :: [a] -> [b] -> [c] -> [(a, b, c)]
zipWith :: (a -> b -> c) -> [a] -> [b] -> [c]
zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d]
elem :: (Foldable t, Eq a) => a -> t a -> Bool
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
length :: Foldable t => t a -> Int
null :: Foldable t => t a -> Bool
product :: (Foldable t, Num a) => t a -> a
sum :: (Foldable t, Num a) => t a -> a
(++) :: [a] -> [a] -> [a]
map :: (a -> b) -> [a] -> [b]
zip :: [a] -> [b] -> [(a, b)]
filter :: (a -> Bool) -> [a] -> [a]
find :: Foldable t => (a -> Bool) -> t a -> Maybe a
isSubsequenceOf :: Eq a => [a] -> [a] -> Bool
(\\) :: Eq a => [a] -> [a] -> [a]
delete :: Eq a => a -> [a] -> [a]
deleteBy :: (a -> a -> Bool) -> a -> [a] -> [a]
deleteFirstsBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]
dropWhileEnd :: (a -> Bool) -> [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]
genericDrop :: Integral i => i -> [a] -> [a]
genericIndex :: Integral i => [a] -> i -> a
genericLength :: Num i => [a] -> i
genericReplicate :: Integral i => i -> a -> [a]
genericSplitAt :: Integral i => i -> [a] -> ([a], [a])
genericTake :: Integral i => i -> [a] -> [a]
groupBy :: (a -> a -> Bool) -> [a] -> [[a]]
inits :: [a] -> [[a]]
insert :: Ord a => a -> [a] -> [a]
insertBy :: (a -> a -> Ordering) -> a -> [a] -> [a]
intercalate :: [a] -> [[a]] -> [a]
intersect :: Eq a => [a] -> [a] -> [a]
intersectBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]
intersperse :: a -> [a] -> [a]
isInfixOf :: Eq a => [a] -> [a] -> Bool
isPrefixOf :: Eq a => [a] -> [a] -> Bool
isSuffixOf :: Eq a => [a] -> [a] -> Bool
nub :: Eq a => [a] -> [a]
nubBy :: (a -> a -> Bool) -> [a] -> [a]
partition :: (a -> Bool) -> [a] -> ([a], [a])
permutations :: [a] -> [[a]]
singleton :: a -> [a]
sort :: Ord a => [a] -> [a]
sortBy :: (a -> a -> Ordering) -> [a] -> [a]
sortOn :: Ord b => (a -> b) -> [a] -> [a]
stripPrefix :: Eq a => [a] -> [a] -> Maybe [a]
subsequences :: [a] -> [[a]]
tails :: [a] -> [[a]]
transpose :: [[a]] -> [[a]]
unfoldr :: (b -> Maybe (a, b)) -> b -> [a]
union :: Eq a => [a] -> [a] -> [a]
unionBy :: (a -> a -> Bool) -> [a] -> [a] -> [a]
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])
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)]
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]
mapAccumL :: Traversable t => (s -> a -> (s, b)) -> s -> t a -> (s, t b)
mapAccumR :: Traversable t => (s -> a -> (s, b)) -> s -> t a -> (s, t b)
(!?) :: [a] -> Int -> Maybe a
iterate' :: (a -> a) -> a -> [a]
scanl' :: (b -> a -> b) -> b -> [a] -> [b]
uncons :: [a] -> Maybe (a, [a])
unsnoc :: [a] -> Maybe ([a], a)

-- | Extract the first element of a list. Empty lists throw an
--   <a>EmptyListException</a>.
head :: MonadThrow m => [a] -> m a

-- | Extract the last element of a list. Empty lists throw an
--   <a>EmptyListException</a>.
last :: MonadThrow m => [a] -> m a

-- | Extract the elements after the head of a list. Empty lists throw an
--   <a>EmptyListException</a>.
tail :: MonadThrow m => [a] -> m [a]

-- | Return all the elements of a list except the last one. Empty lists
--   throw an <a>EmptyListException</a>.
init :: MonadThrow m => [a] -> m [a]

-- | <a>foldl1</a> is a variant of <a>foldl</a> that has no starting value,
--   and thus must be applied to non-empty lists. Empty lists throw an
--   <a>EmptyListException</a>.
foldl1 :: MonadThrow m => (a -> a -> a) -> [a] -> m a

-- | A strict version of <a>foldl1</a>.
foldl1' :: MonadThrow m => (a -> a -> a) -> [a] -> m a

-- | <a>foldr1</a> is a variant of <a>foldr</a> that has no starting value,
--   and thus must be applied to non-empty lists. Empty lists throw an
--   <a>EmptyListException</a>.
foldr1 :: MonadThrow m => (a -> a -> a) -> [a] -> m a

-- | <a>maximum</a> returns the maximum value from a list, which must be
--   non-empty, finite, and of an ordered type. It is a special case of
--   <a>maximumBy</a>, which allows the programmer to supply their own
--   comparison function. Empty lists throw an <a>EmptyListException</a>.
maximum :: (MonadThrow m, Ord a) => [a] -> m a

-- | <a>minimum</a> returns the maximum value from a list, which must be
--   non-empty, finite, and of an ordered type. It is a special case of
--   <a>minimumBy</a>, which allows the programmer to supply their own
--   comparison function. Empty lists throw an <a>EmptyListException</a>.
minimum :: (MonadThrow m, Ord a) => [a] -> m a

-- | The <a>maximumBy</a> function takes a comparison function and a list
--   and returns the greatest element of the list by the comparison
--   function. The list must be finite and non-empty. Empty lists throw an
--   <a>EmptyListException</a>.
maximumBy :: MonadThrow m => (a -> a -> Ordering) -> [a] -> m a

-- | The <a>minimumBy</a> function takes a comparison function and a list
--   and returns the least element of the list by the comparison function.
--   The list must be finite and non-empty. Empty lists throw an
--   <a>EmptyListException</a>.
minimumBy :: MonadThrow m => (a -> a -> Ordering) -> [a] -> m a

-- | List index (subscript) operator, starting from 0. Indices larger than
--   <tt>length xs - 1</tt> throw an <a>EmptyListException</a>, negative
--   indices throw an <a>NegativeIndexException</a>.
(!!) :: (MonadThrow m, Integral n) => [a] -> n -> m a

-- | Takes a function that requires a non-empty list and wraps it in an
--   instance of <a>MonadThrow</a>. For empty lists, an
--   <a>EmptyListException</a> is thrown.
wrap :: MonadThrow m => ([a] -> b) -> [a] -> m b

-- | Signals that the list was empty or contained too few elements (in the
--   case or access by index).
data EmptyListException
EmptyListException :: EmptyListException

-- | Singals that an element with a negative index was accessed.
data NegativeIndexException
NegativeIndexException :: NegativeIndexException
instance GHC.Classes.Eq Data.List.Safe.EmptyListException
instance GHC.Classes.Eq Data.List.Safe.NegativeIndexException
instance GHC.Internal.Exception.Type.Exception Data.List.Safe.EmptyListException
instance GHC.Internal.Exception.Type.Exception Data.List.Safe.NegativeIndexException
instance GHC.Classes.Ord Data.List.Safe.EmptyListException
instance GHC.Classes.Ord Data.List.Safe.NegativeIndexException
instance GHC.Internal.Read.Read Data.List.Safe.EmptyListException
instance GHC.Internal.Read.Read Data.List.Safe.NegativeIndexException
instance GHC.Internal.Show.Show Data.List.Safe.EmptyListException
instance GHC.Internal.Show.Show Data.List.Safe.NegativeIndexException
