Skip to content
Find file
Fetching contributors…
Cannot retrieve contributors at this time
16 lines (13 sloc) 396 Bytes
module Functions
(
rechunk
) where
import qualified Data.ByteString as B
import qualified Data.ByteString.Lazy as L
rechunk :: Int -> B.ByteString -> L.ByteString
rechunk n
| n <= 0 = error "rechunk: wtf!?"
| otherwise = L.fromChunks . go
where go bs | B.null bs = []
| otherwise = case B.splitAt n bs of
(x,y) -> x : go y
Something went wrong with that request. Please try again.