module HaskellWorks.Data.Xml.Internal.ByteString ( repartitionMod8 ) where import Data.ByteString (ByteString) import qualified Data.ByteString as BS repartitionMod8 :: ByteString -> ByteString -> (ByteString, ByteString) repartitionMod8 :: ByteString -> ByteString -> (ByteString, ByteString) repartitionMod8 ByteString aBS ByteString bBS = (Int -> ByteString -> ByteString BS.take Int cLen ByteString abBS, Int -> ByteString -> ByteString BS.drop Int cLen ByteString abBS) where abBS :: ByteString abBS = [ByteString] -> ByteString BS.concat [ByteString aBS, ByteString bBS] abLen :: Int abLen = ByteString -> Int BS.length ByteString abBS cLen :: Int cLen = (Int abLen Int -> Int -> Int forall a. Integral a => a -> a -> a `div` Int 8) Int -> Int -> Int forall a. Num a => a -> a -> a * Int 8 {-# INLINE repartitionMod8 #-}