hist-pl-transliter-0.1.0: A simple EDSL for transliteration rules

Safe HaskellSafe-Inferred




The module provides a simple embedded domain specific language for defining transliteration rules. All parsers are case-insensitive by default.



data TrRules Source

A set of transliteration rules.




wordRules :: [Parser String]

Word-level rule is applied only when it matches the entire word.

charRules :: [Parser String]

Character-level rule is always applied when a match is found.

transliter :: TrRules -> String -> StringSource

Transliterate the word with the given set of transliteration rules.


type Parser = Parsec String ()Source

A parser data type.

ciString :: String -> Parser StringSource

Case insensitive string parser.

ciChar :: Char -> Parser CharSource

Case insensitive character parser.


(#>) :: String -> String -> Parser StringSource

A transliteration rule, e.g. ("abc" #> "bcd") will substitute all "abc" (sub)string instances with "bcd".

(>#>) :: Parser String -> String -> Parser StringSource

Similar to `#>`, but this function allows to define a custom parser for the string which should be substituted with another string.

(>+>) :: Parser String -> Parser String -> Parser StringSource

Concatentation of parsers.

(.|) :: String -> String -> Parser StringSource

OR parser, i.e. a parser which tries to match the first string argument, and only tries the second one if the first match failed.

(.|.) :: Parser String -> String -> Parser StringSource

Similar to .|, but accepts a parser as the first argument.