-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | NonEmpty lists that look [more, like, this] -- -- This package provides NonEmpty, an alternative to the -- NonEmpty type in base. -- -- It has a few differences from base's NonEmpty: -- -- -- -- The show instance is the original raison d'être. When scanning textual -- data, the brain can interpret uniformity more quickly. Which do you -- think is easier to scan? -- --
--   x :| [y, z]
--   [x, y, z]
--   
-- -- Now imagine this in various fields of a large compound structure, and -- you have two of them, and you're trying to find the difference. -- --
--   >>> :set -XOverloadedLists
--   
--   >>> aNonEmpty [1, 2, 3]
--   [1,2,3]
--   
--   >>> read "[1, 2, 3]" :: NonEmpty Int
--   [1,2,3]
--   
@package neononempty @version 1.0.0 -- | NonEmpty - Like base's NonEmpty but with: -- -- -- -- Added functions: -- -- -- -- Removed functions: -- -- -- -- Changed functions: -- -- -- -- Replaced functions: -- -- module Data.List.NeoNonEmpty -- | A list with one or more elements. data NonEmpty a -- | Construct a NonEmpty from an element and a list. pattern (:|) :: a -> [a] -> NonEmpty a -- | Construct a NonEmpty list from a single element. singleton :: a -> NonEmpty a -- | Construct a NonEmpty from an element and a list. fromCons :: a -> [a] -> NonEmpty a -- | A non empty thing. Useful as a syntactically lightweight type -- annotation, especially when using OverloadedLists: -- --
--   >>> :set -XOverloadedLists
--   
--   >>> [(), ()]
--       • Ambiguous type variable ‘a0’ arising from a use of ‘print’
--         prevents the constraint ‘(Show a0)’ from being solved.
--   
--   >>> aNonEmpty [(), ()]
--   [(),()]
--   
aNonEmpty :: NonEmpty a -> NonEmpty a -- | Converts base's NonEmpty to a NonEmpty fromNonEmpty :: NonEmpty a -> NonEmpty a -- | Converts a NonEmpty to base's NonEmpty toNonEmpty :: NonEmpty a -> NonEmpty a -- | Converts a normal list to a NonEmpty list, given the list has at least -- one element fromList :: [a] -> Maybe (NonEmpty a) -- | Converts a NonEmpty list to a normal list toList :: NonEmpty a -> [a] -- | Number of elements in NonEmpty list. length :: NonEmpty a -> Int -- | Extract the first element of the nonempty stream. head :: NonEmpty a -> a -- | Extract the possibly-empty tail of the nonempty stream. tail :: NonEmpty a -> [a] -- | Extract the last element of the nonempty stream. last :: NonEmpty a -> a -- | Extract everything except the last element of the nonempty stream. init :: NonEmpty a -> [a] -- | Prepend an element to the nonempty stream. cons :: a -> NonEmpty a -> NonEmpty a -- | Produces the first element of the nonempty stream, and a stream of the -- remaining elements. uncons :: NonEmpty a -> (a, [a]) -- | Append an element to the back of a nonempty stream. snoc :: NonEmpty a -> a -> NonEmpty a -- | Produces all elements up to the last element, and the last element unsnoc :: forall a. NonEmpty a -> ([a], a) -- | Dual of foldr, see unfoldr. unfoldr :: (a -> (b, Maybe a)) -> a -> NonEmpty b -- | Sort a nonempty stream. sort :: forall a. Ord a => NonEmpty a -> NonEmpty a -- | Reverse a nonempty stream. reverse :: NonEmpty a -> NonEmpty a -- | Produces all the prefixes of a stream, starting with the shortest. The -- result is NonEmpty because the result always contains the empty -- list as the first element. -- --
--   >>> inits [1,2,3]
--   [[], [1], [1,2], [1,2,3]]
--   
-- --
--   >>> inits [1]
--   [[], [1]]
--   
-- --
--   >>> inits []
--   [[]]
--   
inits :: Foldable f => f a -> NonEmpty [a] -- | Produces all the nonempty prefixes of a nonempty stream, starting with -- the shortest. -- --
--   >>> inits1 [1,2,3]
--   [[1], [1,2], [1,2,3]]
--   
-- --
--   >>> inits1 [1]
--   [[1]]
--   
inits1 :: forall a. NonEmpty a -> NonEmpty (NonEmpty a) -- | Produces all the suffixes of a stream, starting with the longest. The -- result is NonEmpty because the result always contains the empty -- list as the first element. -- --
--   >>> tails [1,2,3]
--   [[1, 2, 3], [2, 3], [3], []]
--   
-- --
--   >>> tails [1]
--   [[1], []]
--   
-- --
--   >>> tails []
--   [[]]
--   
tails :: Foldable f => f a -> NonEmpty [a] -- | Produces all the nonempty suffixes of a nonempty stream, starting with -- the longest. -- --
--   >>> tails1 [1,2,3]
--   [[1, 2, 3], [2, 3], [3]]
--   
-- --
--   >>> tails1 [1]
--   [[1]]
--   
tails1 :: forall a. NonEmpty a -> NonEmpty (NonEmpty a) -- | A monomorphic version of <> for NonEmpty. -- --
--   >>> append [1] [2, 3]
--   [1, 2, 3]
--   
append :: NonEmpty a -> NonEmpty a -> NonEmpty a -- | Append a list at the end of a NonEmpty. -- --
--   >>> appendList [1, 2, 3] []
--   [1, 2, 3]
--   
-- --
--   >>> appendList [1, 2, 3] [4, 5]
--   [1, 2, 3, 4, 5]
--   
appendList :: NonEmpty a -> [a] -> NonEmpty a -- | Prepend a list to the front of a NonEmpty. -- --
--   >>> prependList [] [1, 2, 3]
--   [1, 2, 3]
--   
-- --
--   >>> prependList [negate 1, 0] [1, 2, 3]
--   [-1, 0, 1, 2, 3]
--   
prependList :: [a] -> NonEmpty a -> NonEmpty a -- | Map a function over a NonEmpty stream. map :: (a -> b) -> NonEmpty a -> NonEmpty b -- | Produces a NonEmpty which alternates between elementes of the -- input list, and the supplied element. -- --
--   >>> intersperse 0 [1, 2, 3])
--   [1, 0, 2, 0, 3]
--   
-- --
--   >>> intersperse 0 [1]
--   [1]
--   
intersperse :: a -> NonEmpty a -> NonEmpty a -- | Left-associative fold, lazy in the accumulator. See foldl. foldl1 :: (a -> a -> a) -> NonEmpty a -> a -- | Left-associative fold, strict in the accumulator. See foldl'. foldl1' :: (a -> a -> a) -> NonEmpty a -> a -- | Left-associative fold, strict in the accumulator. See foldl'. foldr1 :: (a -> a -> a) -> NonEmpty a -> a -- | scanl is similar to foldl, but returns a stream of successive reduced -- values from the left: -- --
--   >>> scanl (+) 1 [20, 300, 4000]
--   [1,21,321,4321]
--   
scanl :: Foldable f => (b -> a -> b) -> b -> f a -> NonEmpty b -- | A strict version of scanl. scanl' :: Foldable f => (b -> a -> b) -> b -> f a -> NonEmpty b -- | scanl1 is a variant of scanl that has no starting value argument: -- --
--   scanl1 f [x1, x2, ...] == [x1, x1 f x2, x1 f (x2 f x3), ...]
--   
scanl1 :: (a -> a -> a) -> NonEmpty a -> NonEmpty a -- | Right-to-left dual of scanl. Note that the order of parameters on the -- accumulating function are reversed compared to scanl. Also note that -- --
--   head (scanr f z xs) == foldr f z xs
--   
-- --
--   >>> scanr (+) 0 [1..4]
--   [10,9,7,4,0]
--   
-- --
--   >>> scanr (+) 42 []
--   [42]
--   
-- --
--   >>> scanr (-) 100 [1..4]
--   [98,-97,99,-96,100]
--   
scanr :: Foldable f => (a -> b -> b) -> b -> f a -> NonEmpty b -- | scanr1 is a variant of scanr that has no starting value argument. -- --
--   >>> scanr1 (+) [1..4]
--   [10,9,7,4]
--   
-- --
--   >>> scanr1 (+) []
--   []
--   
-- --
--   >>> scanr1 (-) [1..4]
--   [-2,3,-1,4]
--   
scanr1 :: (a -> a -> a) -> NonEmpty a -> NonEmpty a -- | transpose for NonEmpty, behaves the same as transpose. The -- rows/columns need not be the same length, in which case -- --
--   transpose . transpose /= id
--   
transpose :: forall a. NonEmpty (NonEmpty a) -> NonEmpty (NonEmpty a) -- | Behaves the same as sortBy sortBy :: (a -> a -> Ordering) -> NonEmpty a -> NonEmpty a -- | Sort a list on a projection of its elements. Projects once, then -- sorts, then un-projects. This is useful when the projection function -- is expensive. If it's not, you should probably use sortWith. sortOn :: Ord o => (a -> o) -> NonEmpty a -> NonEmpty a -- | Sort a list on a projection of its elements. Projects during -- comparison. This is useful when the projection function is cheap. If -- it's not, you should probably use sortOn. sortWith :: Ord o => (a -> o) -> NonEmpty a -> NonEmpty a -- | iterate f x produces the infinite sequence of repeated applications of -- f to x. -- --
--   iterate f x = [x, f x, f (f x), ..]
--   
iterate :: (a -> a) -> a -> NonEmpty a -- | repeat x returns a constant stream, where all elements are equal to x. repeat :: a -> NonEmpty a -- | cycle xs returns the infinite repetition of xs: -- --
--   cycle [1, 2, 3] == [1, 2, 3, 1, 2, 3, ...]
--   
cycle :: NonEmpty a -> NonEmpty a -- | insert x xs inserts x into the last position in xs where it is still -- less than or equal to the next element. If the list is sorted -- beforehand, the result will also be sorted. insert :: (Foldable f, Ord a) => a -> f a -> NonEmpty a -- | some1 x sequences x one or more times. some1 :: Alternative f => f a -> f (NonEmpty a) -- | take n xs returns the first n elements of xs. take :: Int -> NonEmpty a -> [a] -- | drop n xs drops the first n elements from the front of the sequence -- xs. drop :: Int -> NonEmpty a -> [a] -- | splitAt n xs returns a pair consisting of the prefix of xs of length n -- and the remaining stream immediately following this prefix. -- -- splitAt n xs == (take n xs, drop n xs) splitAt :: Int -> NonEmpty a -> ([a], [a]) -- | Produces the longest prefix of the stream for which the predicate -- holds. takeWhile :: (a -> Bool) -> NonEmpty a -> [a] -- | dropWhile p xs produces the suffix remaining after takeWhile p xs. dropWhile :: (a -> Bool) -> NonEmpty a -> [a] -- | span p xs returns the longest prefix of xs that satisfies p, together -- with the remainder of the stream. -- -- span p xs == (takeWhile p xs, dropWhile p xs) span :: (a -> Bool) -> NonEmpty a -> ([a], [a]) -- | break p is equivalent to span (not . p). break :: (a -> Bool) -> NonEmpty a -> ([a], [a]) -- | Removes any elements of a nonempty stream that do not satisfy a -- predicate. filter :: (a -> Bool) -> NonEmpty a -> [a] -- | Produces a pair of lists, the first of elements that satisfy the given -- predicate, the second of elements that did not. -- --
--   partition p xs == (filter p xs, filter (not . p) xs)
--   
partition :: (a -> Bool) -> NonEmpty a -> ([a], [a]) -- | Takes a stream and returns a list of streams such that flattening the -- resulting list is equal to the argument. Moreover, each stream in the -- resulting list contains only equal elements. -- --
--   >>> group "Mississippi"
--   ["M", "i", "ss", "i", "ss", "i", "pp", "i"]
--   
group :: (Foldable f, Eq a) => f a -> [NonEmpty a] -- | Similar to group, but sorts the input first so that each -- equivalence class has, at most, one list in the output. groupAll :: Ord a => [a] -> [NonEmpty a] -- | Similar to group, but uses the provided equality predicate -- instead of ==. groupBy :: Foldable f => (a -> a -> Bool) -> f a -> [NonEmpty a] -- | Similar to groupBy, but sorts the input first so that each -- equivalence class has, at most, one list in the output. groupAllBy :: (a -> a -> Ordering) -> [a] -> [NonEmpty a] -- | Similar to group, but uses the provided projection when -- comparing for equality. groupWith :: (Foldable f, Eq b) => (a -> b) -> f a -> [NonEmpty a] -- | Similar to groupWith, but sorts the input first so that each -- equivalence class has, at most, one list in the output. groupAllWith :: Ord b => (a -> b) -> [a] -> [NonEmpty a] -- | Similar to group, but uses the knowledge that its input is -- non-empty to produce guaranteed non-empty output. group1 :: forall a. Eq a => NonEmpty a -> NonEmpty (NonEmpty a) -- | Similar to group1, but sorts the input first so that each -- equivalence class has, at most, one list in the output. groupAll1 :: Ord a => NonEmpty a -> [NonEmpty a] -- | Similar to group1, but uses the provided equality predicate -- instead of ==. groupBy1 :: (a -> a -> Bool) -> NonEmpty a -> NonEmpty (NonEmpty a) -- | Similar to group, but sorts the input first so that each -- equivalence class has, at most, one list in the output. groupAllBy1 :: (a -> a -> Ordering) -> [a] -> [NonEmpty a] -- | Similar to group1, but uses the provided projection when -- comparing for equality. groupWith1 :: Eq b => (a -> b) -> NonEmpty a -> NonEmpty (NonEmpty a) -- | Similar to groupWith1, but sorts the list first so that each -- equivalence class has, at most, one list in the output. groupAllWith1 :: Ord b => (a -> b) -> NonEmpty a -> NonEmpty (NonEmpty a) -- | Returns True if the first argument is a prefix of the second. -- --
--   >>> isPrefixOf [1, 2, 3] [1, 2, 3, 4, 5]
--   True
--   
--   >>> isPrefixOf "abc" "defghi"
--   False
--   
--   >>> isPrefixOf "abc" ""
--   False
--   
isPrefixOf :: Eq a => [a] -> NonEmpty a -> Bool -- | Removes duplicate elements from a list. In particular, it keeps only -- the first occurrence of each element. (The name nub means -- essence.) It is a special case of nubBy, which allows the -- programmer to supply their own inequality test. nub :: Eq a => NonEmpty a -> NonEmpty a -- | Behaves just like nub, except it uses a user-supplied equality -- predicate instead of the overloaded == function. nubBy :: (a -> a -> Bool) -> NonEmpty a -> NonEmpty a -- | xs !! n returns the element of the stream xs at index n, if present. -- Note that the head of the stream has index 0. (!?) :: NonEmpty a -> Int -> Maybe a infixl 9 !? -- | <math>. Takes two streams and produces a stream of corresponding -- pairs. -- --
--   >>> zip [1, 2] ['a', 'b']
--   [(1, 'a'),(2, 'b')]
--   
zip :: forall a b. NonEmpty a -> NonEmpty b -> NonEmpty (a, b) -- | <math>. Generalises zip by zipping with the provided function, -- instead of a tupling function. zipWith :: forall a b c. (a -> b -> c) -> NonEmpty a -> NonEmpty b -> NonEmpty c instance GHC.Base.Semigroup (Data.List.NeoNonEmpty.NonEmpty a) instance GHC.Classes.Ord a => GHC.Classes.Ord (Data.List.NeoNonEmpty.NonEmpty a) instance GHC.Classes.Eq a => GHC.Classes.Eq (Data.List.NeoNonEmpty.NonEmpty a) instance GHC.Base.Monad Data.List.NeoNonEmpty.NonEmpty instance Data.Functor.Classes.Show1 Data.List.NeoNonEmpty.NonEmpty instance Data.Functor.Classes.Read1 Data.List.NeoNonEmpty.NonEmpty instance Data.Functor.Classes.Ord1 Data.List.NeoNonEmpty.NonEmpty instance Data.Functor.Classes.Eq1 Data.List.NeoNonEmpty.NonEmpty instance Data.Foldable.Foldable Data.List.NeoNonEmpty.NonEmpty instance Control.Monad.Zip.MonadZip Data.List.NeoNonEmpty.NonEmpty instance Control.Monad.Fix.MonadFix Data.List.NeoNonEmpty.NonEmpty instance GHC.Base.Functor Data.List.NeoNonEmpty.NonEmpty instance GHC.Base.Applicative Data.List.NeoNonEmpty.NonEmpty instance Data.Data.Data a => Data.Data.Data (Data.List.NeoNonEmpty.NonEmpty a) instance GHC.Generics.Generic1 Data.List.NeoNonEmpty.NonEmpty instance GHC.Generics.Generic (Data.List.NeoNonEmpty.NonEmpty a) instance GHC.IsList.IsList (Data.List.NeoNonEmpty.NonEmpty a) instance GHC.Show.Show a => GHC.Show.Show (Data.List.NeoNonEmpty.NonEmpty a) instance GHC.Read.Read a => GHC.Read.Read (Data.List.NeoNonEmpty.NonEmpty a)