| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Data.List.NonEmpty.Linear
Description
Linear versions of NonEmpty functions.
This module only contains minimal amount of documentation; consult the original Data.List.NonEmpty module for more detailed information.
Synopsis
- data NonEmpty a = a :| [a]
- map :: (a %1 -> b) -> NonEmpty a %1 -> NonEmpty b
- intersperse :: a -> NonEmpty a %1 -> NonEmpty a
- scanl :: Dupable b => (b %1 -> a %1 -> b) -> b %1 -> NonEmpty a %1 -> NonEmpty b
- scanr :: Dupable b => (a %1 -> b %1 -> b) -> b %1 -> NonEmpty a %1 -> NonEmpty b
- scanl1 :: Dupable a => (a %1 -> a %1 -> a) -> NonEmpty a %1 -> NonEmpty a
- scanr1 :: Dupable a => (a %1 -> a %1 -> a) -> NonEmpty a %1 -> NonEmpty a
- transpose :: NonEmpty (NonEmpty a) %1 -> NonEmpty (NonEmpty a)
- sortBy :: (a -> a -> Ordering) -> NonEmpty a -> NonEmpty a
- sortWith :: Ord o => (a -> o) -> NonEmpty a -> NonEmpty a
- length :: NonEmpty a %1 -> (Ur Int, NonEmpty a)
- head :: NonEmpty a -> a
- tail :: NonEmpty a -> [a]
- last :: NonEmpty a -> a
- init :: NonEmpty a -> [a]
- singleton :: a %1 -> NonEmpty a
- (<|) :: a %1 -> NonEmpty a %1 -> NonEmpty a
- cons :: a %1 -> NonEmpty a %1 -> NonEmpty a
- uncons :: NonEmpty a %1 -> (a, Maybe (NonEmpty a))
- unfoldr :: (a %1 -> (b, Maybe a)) -> a %1 -> NonEmpty b
- sort :: Ord a => NonEmpty a -> NonEmpty a
- reverse :: NonEmpty a %1 -> NonEmpty a
- append :: NonEmpty a %1 -> NonEmpty a %1 -> NonEmpty a
- appendList :: NonEmpty a %1 -> [a] %1 -> NonEmpty a
- prependList :: [a] %1 -> NonEmpty a %1 -> NonEmpty a
- take :: Consumable a => Int -> NonEmpty a %1 -> [a]
- drop :: Consumable a => Int -> NonEmpty a %1 -> [a]
- splitAt :: Consumable a => Int -> NonEmpty a %1 -> ([a], [a])
- takeWhile :: Dupable a => (a %1 -> Bool) -> NonEmpty a %1 -> [a]
- dropWhile :: Dupable a => (a %1 -> Bool) -> NonEmpty a %1 -> [a]
- span :: Dupable a => (a %1 -> Bool) -> NonEmpty a %1 -> ([a], [a])
- break :: Dupable a => (a %1 -> Bool) -> NonEmpty a %1 -> ([a], [a])
- filter :: Dupable a => (a %1 -> Bool) -> NonEmpty a %1 -> [a]
- partition :: Dupable a => (a %1 -> Bool) -> NonEmpty a %1 -> ([a], [a])
- zip :: (Consumable a, Consumable b) => NonEmpty a %1 -> NonEmpty b %1 -> NonEmpty (a, b)
- zipWith :: (Consumable a, Consumable b) => (a %1 -> b %1 -> c) -> NonEmpty a %1 -> NonEmpty b %1 -> NonEmpty c
- zip' :: NonEmpty a %1 -> NonEmpty b %1 -> (NonEmpty (a, b), Maybe (Either (NonEmpty a) (NonEmpty b)))
- zipWith' :: (a %1 -> b %1 -> c) -> NonEmpty a %1 -> NonEmpty b %1 -> (NonEmpty c, Maybe (Either (NonEmpty a) (NonEmpty b)))
- unzip :: NonEmpty (a, b) %1 -> (NonEmpty a, NonEmpty b)
- unzip3 :: NonEmpty (a, b, c) %1 -> (NonEmpty a, NonEmpty b, NonEmpty c)
- fromList :: HasCallStack => [a] %1 -> NonEmpty a
- toList :: NonEmpty a %1 -> [a]
- nonEmpty :: [a] %1 -> Maybe (NonEmpty a)
- xor :: NonEmpty Bool %1 -> Bool
Non-empty stream transformations
Non-empty (and non-strict) list type.
Since: base-4.9.0.0
Constructors
| a :| [a] infixr 5 |
Instances
intersperse :: a -> NonEmpty a %1 -> NonEmpty a Source #
Basic functions
length :: NonEmpty a %1 -> (Ur Int, NonEmpty a) Source #
Return the length of the given list alongside with the list itself.
appendList :: NonEmpty a %1 -> [a] %1 -> NonEmpty a Source #
prependList :: [a] %1 -> NonEmpty a %1 -> NonEmpty a Source #
Extracting sublists
take :: Consumable a => Int -> NonEmpty a %1 -> [a] Source #
NOTE: This does not short-circuit and always traverses the entire list to consume the rest of the elements.
takeWhile :: Dupable a => (a %1 -> Bool) -> NonEmpty a %1 -> [a] Source #
NOTE: This does not short-circuit and always traverses the entire list to consume the rest of the elements.
Zipping and unzipping streams
zip :: (Consumable a, Consumable b) => NonEmpty a %1 -> NonEmpty b %1 -> NonEmpty (a, b) Source #
zipWith :: (Consumable a, Consumable b) => (a %1 -> b %1 -> c) -> NonEmpty a %1 -> NonEmpty b %1 -> NonEmpty c Source #
zip' :: NonEmpty a %1 -> NonEmpty b %1 -> (NonEmpty (a, b), Maybe (Either (NonEmpty a) (NonEmpty b))) Source #
Same as zip, but returns the leftovers instead of consuming them.
zipWith' :: (a %1 -> b %1 -> c) -> NonEmpty a %1 -> NonEmpty b %1 -> (NonEmpty c, Maybe (Either (NonEmpty a) (NonEmpty b))) Source #
Same as zipWith, but returns the leftovers instead of consuming them.
Because the leftovers are returned at toplevel, zipWith' is pretty strict:
forcing the second cons cell of the returned list forces all the recursive
calls.
Converting to and from a list
fromList :: HasCallStack => [a] %1 -> NonEmpty a Source #