katydid-0.4.0.2: A haskell implementation of Katydid

Safe HaskellNone
LanguageHaskell2010

Data.Katydid.Relapse.Relapse

Description

This module provides an implementation of the relapse validation language.

Relapse is intended to be used for validation of trees or filtering of lists of trees.

Katydid currently provides two types of trees out of the box: Json and XML, but relapse supports any type of tree as long the type is of the Tree typeclass provided by the Parsers module.

The validate and filter functions expects a Tree to be a list of trees, since not all serialization formats have a single root. For example, valid json like "[1, 2]" does not have a single root. Relapse can also validate these types of trees. If your tree has a single root, simply provide a singleton list as input.

Synopsis

Documentation

parse :: String -> Either String Grammar Source #

parse parses the relapse grammar and returns either a parsed grammar or an error string.

parseWithUDFs :: MkFunc -> String -> Either String Grammar Source #

parseWithUDFs parses the relapse grammar with extra user defined functions and returns either a parsed grammar or an error string.

data Grammar Source #

Grammar represents a compiled relapse grammar.

validate :: Tree t => Grammar -> [t] -> Bool Source #

validate returns whether a tree is valid, given the grammar.

filter :: Tree t => Grammar -> [[t]] -> [[t]] Source #

filter returns a filtered list of trees, given the grammar.