Hoogle Search
Within LTS Haskell 24.6 (ghc-9.10.2)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
class (Monoid seq, MonoTraversable seq, SemiSequence seq, MonoPointed seq) =>
IsSequence seqmono-traversable Data.Sequences Sequence Laws:
fromList . otoList = id fromList (x <> y) = fromList x <> fromList y otoList (fromList x <> fromList y) = x <> y
-
mono-traversable Data.Sequences Lazy sequences containing strict chunks of data.
class (Integral Index seq, GrowingAppend seq) =>
SemiSequence seqmono-traversable Data.Sequences SemiSequence was created to share code between IsSequence and NonNull. Semi means SemiGroup A SemiSequence can accommodate a SemiGroup such as NonEmpty or NonNull A Monoid should be able to fill out IsSequence. SemiSequence operations maintain the same type because they all maintain the same number of elements or increase them. However, a decreasing function such as filter may change they type. For example, from NonEmpty to '[]' This type-changing function exists on NonNull as nfilter filter and other such functions are placed in IsSequence NOTE: Like GrowingAppend, ideally we'd have a Semigroup superclass constraint here, but that would pull in more dependencies to this package than desired.
subsequences :: IsSequence seq => seq -> [seq]mono-traversable Data.Sequences subsequences returns a list of all subsequences of the argument.
> subsequences "abc" ["","a","b","ab","c","ac","bc","abc"]
isSubsequenceOf :: Eq a => [a] -> [a] -> Boolrio RIO.List The isSubsequenceOf function takes two lists and returns True if all the elements of the first list occur, in order, in the second. The elements do not have to occur consecutively. isSubsequenceOf x y is equivalent to x `elem` (subsequences y). Note: isSubsequenceOf is often used in infix form.
Examples
>>> "GHC" `isSubsequenceOf` "The Glorious Haskell Compiler" True
>>> ['a','d'..'z'] `isSubsequenceOf` ['a'..'z'] True
>>> [1..10] `isSubsequenceOf` [10,9..0] False
For the result to be True, the first list must be finite; for the result to be False, the second list must be finite:>>> [0,2..10] `isSubsequenceOf` [0..] True
>>> [0..] `isSubsequenceOf` [0,2..10] False
>>> [0,2..] `isSubsequenceOf` [0..] * Hangs forever*
-
rio RIO.List The subsequences function returns the list of all subsequences of the argument.
Laziness
subsequences does not look ahead unless it must:>>> take 1 (subsequences undefined) [[]] >>> take 2 (subsequences ('a' : undefined)) ["","a"]
Examples
>>> subsequences "abc" ["","a","b","ab","c","ac","bc","abc"]
This function is productive on infinite inputs:>>> take 8 $ subsequences ['a'..] ["","a","b","ab","c","ac","bc","abc"]
bisequence :: (Bitraversable t, Applicative f) => t (f a) (f b) -> f (t a b)rio RIO.Prelude Sequences all the actions in a structure, building a new structure with the same shape using the results of the actions. For a version that ignores the results, see bisequence_.
bisequence ≡ bitraverse id id
Examples
Basic usage:>>> bisequence (Just 4, Nothing) Nothing
>>> bisequence (Just 4, Just 5) Just (4,5)
>>> bisequence ([1, 2, 3], [4, 5]) [(1,4),(1,5),(2,4),(2,5),(3,4),(3,5)]
bisequence_ :: (Bifoldable t, Applicative f) => t (f a) (f b) -> f ()rio RIO.Prelude Evaluate each action in the structure from left to right, and ignore the results. For a version that doesn't ignore the results, see bisequence.
Examples
Basic usage:>>> bisequence_ (print "Hello", print "World") "Hello" "World"
>>> bisequence_ (Left (print "Hello")) "Hello"
>>> bisequence_ (Right (print "World")) "World"
enumSequenceFrom :: Num a => a -> Sequence amath-functions Numeric.Series enumSequenceFrom x generate sequence: <math>
enumSequenceFromStep :: Num a => a -> a -> Sequence amath-functions Numeric.Series enumSequenceFromStep x d generate sequence: <math>