module Extension.ByteString (stripPrefix, stripSuffix) where import Data.ByteString (ByteString(..)) import qualified Data.ByteString.Char8 as BS import Data.Maybe (fromMaybe) stripPrefix :: ByteString -> ByteString -> ByteString stripPrefix :: ByteString -> ByteString -> ByteString stripPrefix ByteString prefix = forall a. (a -> Maybe a) -> a -> a maybeOriginal forall a b. (a -> b) -> a -> b $ ByteString -> ByteString -> Maybe ByteString BS.stripPrefix ByteString prefix stripSuffix :: ByteString -> ByteString -> ByteString stripSuffix :: ByteString -> ByteString -> ByteString stripSuffix ByteString suffix = forall a. (a -> Maybe a) -> a -> a maybeOriginal forall a b. (a -> b) -> a -> b $ ByteString -> ByteString -> Maybe ByteString BS.stripSuffix ByteString suffix maybeOriginal :: (a -> Maybe a) -> a -> a maybeOriginal :: forall a. (a -> Maybe a) -> a -> a maybeOriginal a -> Maybe a f a g = forall a. a -> Maybe a -> a fromMaybe a g forall a b. (a -> b) -> a -> b $ a -> Maybe a f a g