1
import qualified Data.ByteString.Lazy as P
2
import qualified Data.ByteString as B
3
import qualified Data.List as L
7
let s = [65..68] ++ [103,103]
12
print "Should have the same structure:"
13
print $ L.groupBy (/=) $ s
16
\i -> do putStr ((show i) ++ "\t"); print $ P.groupBy (/=) $ pack i s
19
chunk :: Int -> [a] -> [[a]]
21
chunk size xs = case L.splitAt size xs of (xs', xs'') -> xs' : chunk size xs''
23
pack :: Int -> [Word8] -> P.ByteString
24
pack n str = P.LPS $ L.map B.pack (chunk n str)