katydid: A haskell implementation of Katydid

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain]

A haskell implementation of Katydid

This includes:

You should only need the following modules:

If you want to implement your own parser then you can look at the Parsers module


[Skip to ReadMe]

Properties

Versions0.1.0.0, 0.1.1.0, 0.2.0.1, 0.2.0.1, 0.3.0.0, 0.3.0.1, 0.3.1.0, 0.4.0.1, 0.4.0.2
Change logchangelog.md
Dependenciesbase (>=4.7 && <5), containers, deepseq, hxt, json, katydid, mtl, parsec, regex-tdfa [details]
LicenseBSD-3-Clause
CopyrightWalter Schulze
AuthorWalter Schulze
Maintainerawalterschulze@gmail.com
CategoryData
Home pagehttps://github.com/katydid/katydid-haskell
Source repositoryhead: git clone https://github.com/katydid/katydid-haskell
Executableskatydid-exe
UploadedMon Mar 19 13:34:57 UTC 2018 by awalterschulze

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees


Readme for katydid-0.2.0.1

[back to package description]

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]]