kmp-dfa-0.1.0.0: KMP algorithm implementation based on Deterministic Finite State Automata

Safe HaskellSafe
LanguageHaskell2010

Algorithms.DFA.KMP

Synopsis

Documentation

newtype DFA a Source #

a specialized DFA with distinguish between Left and Right jumps. Nothing signals a final state

Constructors

DFA (a -> Maybe (Either (DFA a) (DFA a))) 

step Source #

Arguments

:: Eq a 
=> (Int -> DFA a)

index to state solver

-> [(a, Int)]

Right argument to index list

-> Either Int Int

fallback index

-> [a]

final state arguments

-> a

the selector

-> Maybe (Either (DFA a) (DFA a)) 

create a DFA step

run :: DFA a -> [a] -> Maybe (DFA a) Source #

run the automata against an input Nothing signal success

mkDFA :: Eq a => [(a, Int)] -> DFA a Source #

build a DFA from a pattern zipeed with the prefix

prefix :: Eq a => [a] -> [Int] Source #

A list of prefixes to serve mkDFA

match :: Eq a => [a] -> [a] -> Bool Source #

test a match exists