{-# LANGUAGE OverloadedStrings #-}


-- reference to L.isPrefixOf
-- see Data.List (delete, deleteBy)

module  Data.Carbonara.LazyByteString where

import qualified Data.ByteString.Char8 as S (singleton)
import qualified Data.ByteString.Internal as S (w2c,c2w) 
import Data.Int (Int64)

import qualified Data.ByteString.Lazy.Internal as L (ByteString(Chunk,Empty))
import qualified Data.ByteString.Lazy.Char8 as L (ByteString, any, append, cons, drop
                 , dropWhile, filter, isPrefixOf, pack
                 , singleton, snoc, splitWith, take, takeWhile) 


delete :: Char -> L.ByteString -> L.ByteString
delete _ L.Empty = L.Empty
delete c (L.Chunk x xs) = if x == c' then xs else xs -- x `L.cons` delete c' xs
    where c' = S.singleton  c
