Overview

This module provides two functions for finding the occurrences of a
pattern in a target string using the Knuth-Morris-Pratt algorithm.
It exists only for systematic reasons, the functions from
Data.ByteString.Search are much faster, except for very short patterns,
in which case Data.ByteString.Search.DFA provides better functions.

Complexity and Performance

The preprocessing of the pattern is O(patternLength) in time and space.
The time complexity of the searching phase is O(targetLength) for both
functions.

In most cases, these functions are considerably slower than the
Boyer-Moore variants, performance is close to that of those from
Data.ByteString.Search.DFA.

Partial application

Both functions can be usefully partially applied. Given only a
pattern, the auxiliary data will be computed only once, allowing for
efficient re-use.