Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
- tryTokReplace :: String -> ByteString -> ByteString -> ByteString -> Maybe ByteString
- forceTokReplace :: String -> ByteString -> ByteString -> ByteString -> ByteString
- annotateReplace :: String -> ByteString -> ByteString -> ByteString -> Bool
- breakToTokens :: ByteString -> [ByteString]
- defaultToks :: String
Documentation
tryTokReplace :: String -> ByteString -> ByteString -> ByteString -> Maybe ByteString Source #
tryTokReplace tokChars old new input
tries to find the token old
and
replace it with the token new
everywhere in the input
, returning Just
the modified input
, unless the token new
is already in the input
in
which case Nothing
is returned. A token is a sequence of bytes that match
the class defined by tokChars
. This function is supposed to work
efficiently with large input
s i.e. whole files.
forceTokReplace :: String -> ByteString -> ByteString -> ByteString -> ByteString Source #
forceTokReplace tokChars old new input
replaces all occurrences of
the old
token with the new
one, throughout the input
.
annotateReplace :: String -> ByteString -> ByteString -> ByteString -> Bool Source #
Check if a token replace operation touches the given line.
breakToTokens :: ByteString -> [ByteString] Source #
Break a Bytestring
into tokens, according to defaultToks
,
discarding non-tokens.
defaultToks :: String Source #