-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Simple interpreter for Markov's normal algorithms -- -- This package contains data types for defining Markov's normal -- algorithms and a function to run them. @package markov @version 0.1 module Data.MarkovAlgo -- | Markov's algorithm itself type Algo c = [Rule c] -- | One rule in algorithm data Rule c -- | Non-terminating rule (:->) :: [c] -> [c] -> Rule c -- | Terminating rule (:->.) :: [c] -> [c] -> Rule c -- | Variable for rules data Var α -- | Literal char L :: α -> Var α -- | Variable with given number V :: Int -> Var α -- | Get antecedent of rule antecedent :: Rule c -> [c] -- | Get consequent of rule consequent :: Rule c -> [c] -- | Get data constructor of Rule constructor :: Rule c -> ([d] -> [d] -> Rule d) -- | Expand algorithm with variables into algorithm without variables expand :: Eq α => [α] -> Algo (Var α) -> Algo α -- | Create generic Rule from concrete Rule parseRule :: Eq α => [α] -> Rule α -> Rule (Var α) -- | Build concrete algo from simple text description with variables buildAlgo :: Eq α => [α] -> [α] -> Algo α -> Algo α -- | Run concrete (without variables) Markov's algorithm runMarkov :: Eq α => Algo α -> [α] -> [α] instance Eq c => Eq (Rule c) instance Show (Var Char) instance Show (Rule (Var Char)) instance Show (Rule Char)