Copyright | (c) Grant Weyburne 2022 |
---|---|
License | BSD-3 |
Safe Haskell | None |
Language | Haskell2010 |
Synopsis
- data MLR a b
- zipWithExtras1 :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> (NonEmpty c, MLR a b)
- zipWithExtras :: forall a b c. (a -> b -> c) -> [a] -> [b] -> ([c], MLR a b)
- mlrOrdering :: MLR a b -> Ordering
- fromList1LR :: [a] -> Either String (NonEmpty a)
- chunksOf1 :: Pos -> NonEmpty a -> NonEmpty (NonEmpty a)
- chunksRange1 :: Pos -> Pos -> NonEmpty a -> NonEmpty (NonEmpty a)
- chunkNLen :: forall t a u z. (Traversable t, Foldable u) => t z -> Pos -> u a -> Either String (t (NonEmpty a))
- chunkNLen1 :: forall a u. Foldable u => Pos -> Pos -> u a -> Either String (NonEmpty (NonEmpty a))
- data Split1 a
- split1Ordering :: Split1 a -> Ordering
- splitAt1 :: Pos -> NonEmpty a -> (NonEmpty a, [a])
- splitAt1' :: forall a. Pos -> NonEmpty a -> (NonEmpty a, Split1 a)
- splitAt1GE :: Pos -> NonEmpty a -> Either String (NonEmpty a, [a])
- splitAts1 :: Pos -> NonEmpty a -> NonEmpty (NonEmpty a)
- splits1 :: forall a. NonEmpty a -> [(NonEmpty a, NonEmpty a)]
- splits3 :: forall a. NonEmpty a -> NonEmpty ([a], a, [a])
- partition1 :: Foldable1 t => (a -> Bool) -> t a -> These (NonEmpty a) (NonEmpty a)
- spanAdjacent1 :: (a -> a -> Bool) -> NonEmpty a -> (NonEmpty a, [a])
- breakAdjacent1 :: (a -> a -> Bool) -> NonEmpty a -> (NonEmpty a, [a])
- span1 :: Foldable1 t => (a -> Bool) -> t a -> These (NonEmpty a) (NonEmpty a)
- break1 :: Foldable1 t => (a -> Bool) -> t a -> These (NonEmpty a) (NonEmpty a)
- data Seq1 a
- isSequence1 :: (Foldable1 t, Eq a, Enum a) => t a -> Bool
- isEnumAscending :: forall t a. (Foldable1 t, Eq a, Enum a) => t a -> Seq1 a
- seq1Ordering :: Seq1 a -> Ordering
- uncons1 :: forall a. NonEmpty a -> (a, [a])
- unsnoc1 :: forall a. NonEmpty a -> ([a], a)
- consNonEmpty :: Iso (NonEmpty a) (NonEmpty b) (a, [a]) (b, [b])
- snocNonEmpty :: Iso (NonEmpty a) (NonEmpty b) ([a], a) ([b], b)
- sumP :: Foldable1 t => t Pos -> Pos
- lengthP :: Foldable1 t => t a -> Pos
- foldMapM1 :: forall b m f a. (Semigroup b, Monad m, Foldable1 f) => (a -> m b) -> f a -> m b
- unfoldr1NE :: forall s a. (NonEmpty s -> (a, [s])) -> NonEmpty s -> NonEmpty a
- unfoldrM1 :: Monad m => (s -> m (a, Maybe s)) -> s -> m (NonEmpty a)
- iterateMaybe1 :: (a -> Bool) -> (a -> a) -> a -> NonEmpty a
- iterateMaybe1' :: (a -> Maybe a) -> a -> NonEmpty a
- iterateN1 :: Pos -> (a -> a) -> a -> NonEmpty a
- replicateP :: Pos -> a -> NonEmpty a
- appendL1 :: [a] -> NonEmpty a -> NonEmpty a
- appendR1 :: NonEmpty a -> [a] -> NonEmpty a
- snoc1 :: Foldable t => t a -> a -> NonEmpty a
- updateAt1 :: Pos -> (a -> a) -> NonEmpty a -> Maybe (NonEmpty a)
- at1 :: Pos -> NonEmpty a -> Maybe a
- setAt1 :: Pos -> a -> NonEmpty a -> Maybe (NonEmpty a)
- units1 :: Pos -> NonEmpty ()
- unitsF :: forall l a. (IsList (l a), Item (l a) ~ ()) => Pos -> l a
- lengthExact1 :: Pos -> NonEmpty a -> Either String (NonEmpty a)
- take1 :: Pos -> NonEmpty a -> NonEmpty a
- sum1 :: (Foldable1 t, Num a) => t a -> a
- groupByAdjacent1 :: forall a. (a -> a -> Bool) -> NonEmpty a -> NonEmpty (NonEmpty a)
- findDupsBy :: forall a c. Ord c => (a -> c) -> [a] -> ([NonEmpty (Int, a)], [(Int, a)])
- replicate1 :: Pos -> a -> NonEmpty a
- replicate1M :: Applicative m => Pos -> m a -> m (NonEmpty a)
- nonemptySnoc :: ([a] -> a -> b) -> NonEmpty a -> b
- nonempty :: (a -> [a] -> b) -> NonEmpty a -> b
- nonempty' :: NonEmpty a -> (a -> [a] -> b) -> b
Documentation
represents an optional Either
ie Maybe (Either (NonEmpty a) (NonEmpty b))
MLRLeft !(NonEmpty a) | extra values on the left hand side |
MLREqual | both values have the same length |
MLRRight !(NonEmpty b) | extra values on the right hand side |
zip
zipWithExtras1 :: (a -> b -> c) -> NonEmpty a -> NonEmpty b -> (NonEmpty c, MLR a b) Source #
zips two nonempty lists together and puts any leftovers into MLR
zipWithExtras :: forall a b c. (a -> b -> c) -> [a] -> [b] -> ([c], MLR a b) Source #
zips two lists together and puts any leftovers into MLR
chunking
chunksOf1 :: Pos -> NonEmpty a -> NonEmpty (NonEmpty a) Source #
split a nonempty list into a nonempty list of nonempty chunks
chunksRange1 :: Pos -> Pos -> NonEmpty a -> NonEmpty (NonEmpty a) Source #
split a nonempty list into a nonempty list of nonempty chunks given a chunk size and how many to skip each iteration can decide the size of the chunks and how many elements to skip
chunkNLen :: forall t a u z. (Traversable t, Foldable u) => t z -> Pos -> u a -> Either String (t (NonEmpty a)) Source #
fills a container "tz" with chunks of size "len" must fill the container exactly
chunkNLen1 :: forall a u. Foldable u => Pos -> Pos -> u a -> Either String (NonEmpty (NonEmpty a)) Source #
creates a nonempty container of length "sz" with chunks of a given size: see chunkNLen
must fill the container exactly
split
represents the status of a split a nonempty list
splitAt1 :: Pos -> NonEmpty a -> (NonEmpty a, [a]) Source #
splitAt
for a nonempty list but doesnt guarantee the number of elements
splitAt1' :: forall a. Pos -> NonEmpty a -> (NonEmpty a, Split1 a) Source #
split a nonempty list preserving information about the split
splitAt1GE :: Pos -> NonEmpty a -> Either String (NonEmpty a, [a]) Source #
split a nonempty list but has to have enough elements else fails
splits1 :: forall a. NonEmpty a -> [(NonEmpty a, NonEmpty a)] Source #
break up a nonempty list into all possible pairs of nonempty lists
splits3 :: forall a. NonEmpty a -> NonEmpty ([a], a, [a]) Source #
break up a nonempty list into a nonempty list of three parts
partition
partition1 :: Foldable1 t => (a -> Bool) -> t a -> These (NonEmpty a) (NonEmpty a) Source #
partitionThese
for a nonempty list
span
spanAdjacent1 :: (a -> a -> Bool) -> NonEmpty a -> (NonEmpty a, [a]) Source #
like span
but applies the predicate to adjacent elements
breakAdjacent1 :: (a -> a -> Bool) -> NonEmpty a -> (NonEmpty a, [a]) Source #
like break
but applies the predicate to adjacent elements
span1 :: Foldable1 t => (a -> Bool) -> t a -> These (NonEmpty a) (NonEmpty a) Source #
span
for a nonempty list
break1 :: Foldable1 t => (a -> Bool) -> t a -> These (NonEmpty a) (NonEmpty a) Source #
break
for a nonempty list
ascending order methods
possible results for determining if a nonempty list is in ascending order
S1Short !(NonEmpty a) | generated enumerable sequence is shorter than the original list |
S1Fail !(a, a) | first mismatch |
S1Ok | both sequences match |
isSequence1 :: (Foldable1 t, Eq a, Enum a) => t a -> Bool Source #
predicate for an ascending nonempty list
isEnumAscending :: forall t a. (Foldable1 t, Eq a, Enum a) => t a -> Seq1 a Source #
shows the first failure or if the length of the enum is too short
isomorphisms
positive specific functions
fold unfold
foldMapM1 :: forall b m f a. (Semigroup b, Monad m, Foldable1 f) => (a -> m b) -> f a -> m b Source #
"foldMapM" for nonempty containers: uses Semigroup instead of Monoid
unfoldr1NE :: forall s a. (NonEmpty s -> (a, [s])) -> NonEmpty s -> NonEmpty a Source #
unfoldr for a nonempty list
will not terminate if the user keeps returning a larger [s] than received
unfoldrM1 :: Monad m => (s -> m (a, Maybe s)) -> s -> m (NonEmpty a) Source #
unfoldM
for nonempty results
iterators
iterateMaybe1 :: (a -> Bool) -> (a -> a) -> a -> NonEmpty a Source #
like iterateMaybe1'
with boolMaybe
iterateMaybe1' :: (a -> Maybe a) -> a -> NonEmpty a Source #
like iterate
but allows termination using Maybe
replicateP :: Pos -> a -> NonEmpty a Source #
generate a repeated nonempty list of values for a fixed size
miscellaneous
updateAt1 :: Pos -> (a -> a) -> NonEmpty a -> Maybe (NonEmpty a) Source #
update a value at an index starting at one
setAt1 :: Pos -> a -> NonEmpty a -> Maybe (NonEmpty a) Source #
set a value at an index starting at one
unitsF :: forall l a. (IsList (l a), Item (l a) ~ ()) => Pos -> l a Source #
generate a nonempty list of units for a given container of the given size
lengthExact1 :: Pos -> NonEmpty a -> Either String (NonEmpty a) Source #
compares the length of a potentially infinite nonempty list with "n" and succeeds if they are the same
groupByAdjacent1 :: forall a. (a -> a -> Bool) -> NonEmpty a -> NonEmpty (NonEmpty a) Source #
groupBy1
but applies the predicate to adjacent elements
findDupsBy :: forall a c. Ord c => (a -> c) -> [a] -> ([NonEmpty (Int, a)], [(Int, a)]) Source #
partition duplicates elements together with their positiion
replicate1M :: Applicative m => Pos -> m a -> m (NonEmpty a) Source #
replicateM
for a nonempty list
nonemptySnoc :: ([a] -> a -> b) -> NonEmpty a -> b Source #