The katydid package

[ Tags: bsd3, data, library, program ] [ Propose Tags ]

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

Versions 0.1.0.0, 0.1.1.0
Dependencies base (>=4.7 && <5), containers, hxt, json, katydid, mtl, parsec, regex-tdfa [details]
License BSD3
Copyright Walter Schulze
Author Walter Schulze
Maintainer awalterschulze@gmail.com
Category Data
Home page https://github.com/katydid/katydid-haskell
Source repository head: git clone https://github.com/katydid/katydid-haskell
Uploaded Mon Nov 6 10:43:17 UTC 2017 by awalterschulze
Distributions LTSHaskell:0.1.1.0, NixOS:0.1.1.0, Stackage:0.1.1.0, Tumbleweed:0.1.1.0
Executables katydid-exe
Downloads 301 total (176 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2017-11-06 [all 1 reports]
Hackage Matrix CI

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for katydid-0.1.1.0

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