Data.ByteString.Search.Substitution

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

Copyright | Daniel Fischer
License | BSD3
Maintainer | Daniel Fischer <daniel.is.fischer@googlemail.com>
Stability | Provisional
Portability | portable
Safe Haskell | None
Language | Haskell98

Data.ByteString.Search.Substitution

Description

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

Synopsis

- class Substitution a where

# Documentation

class Substitution a where #

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

Minimal complete definition

substitution, prependCycle

Methods

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

``substitution`` transforms a value to a substitution function.

prependCycle :: a -> ByteString -> ByteString #

``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.

Instances

Substitution ByteString # |
Methods substitution :: ByteString -> [ByteString] -> [ByteString] # prependCycle :: ByteString -> ByteString -> ByteString #
Substitution ByteString # |
Methods substitution :: ByteString -> [ByteString] -> [ByteString] # prependCycle :: ByteString -> ByteString -> ByteString #