BSD-3-Clause licensed by Walter Schulze
Maintained by [email protected]
This version can be pinned in stack with:katydid-0.2.0.1@sha256:5d3a4a46b105f69663add9609ab22c8d1e691a61b07f04c07d666223130243c8,3212
Used by 1 package in nightly-2018-05-09(full list with versions):

Katydid

Build Status

A Haskell implementation of Katydid.

This includes:

Documentation for katydid

Documentation for katydid-haskell

Documentation for katydid-haskell/Relapse

All JSON and XML tests from the language agnostic test suite [passes].

Hackage.

Example

Validating a single structure can be done using the validate function:

validate :: Tree t => Refs -> [t] -> Bool

, where a tree is a class in the Parsers module:

class Tree a where
    getLabel :: a -> Label
    getChildren :: a -> [a]

Here is an example that validates a single JSON tree:

main = either 
    (\err -> putStrLn $ "error:" ++ err) 
    (\valid -> if valid 
        then putStrLn "dragons exist" 
        else putStrLn "dragons are fictional"
    ) $
    Relapse.validate <$> 
        runExcept (Relapse.parseGrammar ".DragonsExist == true") <*> 
        Json.decodeJSON "{\"DragonsExist\": false}"

Efficiency

If you want to validate multiple trees using the same grammar then the filter function does some internal memoization, which makes a huge difference.

filter :: Tree t => Refs -> [[t]] -> [[t]]

Changes

2.0.1

Fixes parsing of builtin regex and contains functions.

2.0.0

Adds benchmarks

1.1.0

Cleanup

1.0.0

First version