Hoogle Search
Within LTS Haskell 24.36 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
chunksOf :: Int -> Text -> [Text]rio RIO.Text O(n) Splits a Text into components of length k. The last element may be shorter than the other chunks, depending on the length of the input. Examples:
>>> chunksOf 3 "foobarbaz" ["foo","bar","baz"]
>>> chunksOf 4 "haskell.org" ["hask","ell.","org"]
chunksOf :: Int64 -> Text -> [Text]rio RIO.Text.Lazy O(n) Splits a Text into components of length k. The last element may be shorter than the other chunks, depending on the length of the input. Examples:
chunksOf 3 "foobarbaz" == ["foo","bar","baz"] chunksOf 4 "haskell.org" == ["hask","ell.","org"]
-
streaming Streaming Break a stream into substreams each with n functorial layers.
>>> S.print $ mapped S.sum $ chunksOf 2 $ each [1,1,1,1,1] 2 2 1
-
streaming Streaming.Internal Break a stream into substreams each with n functorial layers.
>>> S.print $ mapped S.sum $ chunksOf 2 $ each [1,1,1,1,1] 2 2 1
-
pipes-bytestring Pipes.ByteString Split a byte stream into FreeT-delimited byte streams of fixed size
chunksOf :: Int -> JSString -> [JSString]jsaddle Data.JSString O(n) Splits a JSString into components of length k. The last element may be shorter than the other chunks, depending on the length of the input. Examples:
chunksOf 3 "foobarbaz" == ["foo","bar","baz"] chunksOf 4 "haskell.org" == ["hask","ell.","org"]
chunksOf :: Int -> NESeq a -> NESeq (NESeq a)nonempty-containers Data.Sequence.NonEmpty chunksOf c xs splits xs into chunks of size c>0. If c does not divide the length of xs evenly, then the last element of the result will be short. Is only defined if c is a positive number. Side note: the given performance bound is missing some messy terms that only really affect edge cases. Performance degrades smoothly from <math> (for <math>) to <math> (for <math>). The true bound is more like <math>
-
pipes-group Pipes.Group chunksOf is an splits a Producer into a FreeT of Producers of fixed length
chunksOf n :: Monad m => Lens' (Producer a m x) (Groups a m x) view (chunksOf n) :: Monad m => Splitter a m x set (chunksOf n) :: Monad m => Groups a m x -> Producer a m x -> Producer a m x over (chunksOf n) :: Monad m => Transformation a m x -> Producer a m x -> Producer a m x
>>> import Lens.Family (view) >>> import Pipes (yield, each) >>> import Pipes.Prelude (toList) >>> (toList . intercalates (yield '|') . view (chunksOf 3)) (each "12233345") "122|333|45"
-
streamly-core Streamly.Data.Fold Deprecated: Please use groupsOf instead
-
streamly-core Streamly.Data.Stream chunksOf n stream groups the elements in the input stream into arrays of n elements each. Same as the following but may be more efficient:
>>> chunksOf n = Stream.foldMany (Array.writeN n)
Pre-release