stringsearch-0.3.6.6: Fast searching, splitting and replacing of ByteStrings

CopyrightDaniel Fischer
LicenseBSD3
MaintainerDaniel Fischer <daniel.is.fischer@googlemail.com>
StabilityProvisional
Portabilityportable
Safe HaskellNone
LanguageHaskell98

Data.ByteString.Search.Substitution

Description

Class for values to be substituted into strict and lazy ByteStrings by the replace functions defined in this package.

Synopsis

Documentation

class Substitution a where Source

Type class of meaningful substitutions for replace functions on ByteStrings. Instances for strict and lazy ByteStrings are provided here.

Methods

substitution :: a -> [ByteString] -> [ByteString] Source

substitution transforms a value to a substitution function.

prependCycle :: a -> ByteString -> ByteString Source

prependCycle sub lazyBS shall prepend infinitely many copies of sub to lazyBS without entering an infinite loop in case of an empty sub, so e.g.

  prependCycle "" "ab" == "ab"

shall (quickly) evaluate to True. For non-empty sub, the cycle shall be constructed efficiently.