descriptive-0.7.0: Self-describing consumers/parsers; forms, cmd-line args, JSON, etc.

Safe HaskellNone
LanguageHaskell98

Descriptive.JSON

Contents

Description

A JSON API which describes itself.

Synopsis

Consumers

object

Arguments

:: Monad m 
=> Text

Description of what the object is.

-> Consumer Object Doc m a

An object consumer.

-> Consumer Value Doc m a 

Consume an object.

key

Arguments

:: Monad m 
=> Text

The key to lookup.

-> Consumer Value Doc m a

A value consumer of the object at the key.

-> Consumer Object Doc m a 

Consume from object at the given key.

keyMaybe

Arguments

:: Monad m 
=> Text

The key to lookup.

-> Consumer Value Doc m a

A value consumer of the object at the key.

-> Consumer Object Doc m (Maybe a) 

Optionally consume from object at the given key, only if it exists.

array

Arguments

:: Monad m 
=> Text

Description of this array.

-> Consumer Value Doc m a

Consumer for each element in the array.

-> Consumer Value Doc m (Vector a) 

Consume an array.

string

Arguments

:: Monad m 
=> Text

Description of what the string is for.

-> Consumer Value Doc m Text 

Consume a string.

integer

Arguments

:: Monad m 
=> Text

Description of what the integer is for.

-> Consumer Value Doc m Integer 

Consume an integer.

double

Arguments

:: Monad m 
=> Text

Description of what the double is for.

-> Consumer Value Doc m Double 

Consume an double.

bool

Arguments

:: Monad m 
=> Text

Description of what the bool is for.

-> Consumer Value Doc m Bool 

Parse a boolean.

null

Arguments

:: Monad m 
=> Text

What the null is for.

-> Consumer Value Doc m () 

Expect null.

Annotations

label

Arguments

:: Monad m 
=> Text

Some label.

-> Consumer s Doc m a

A value consumer.

-> Consumer s Doc m a 

Wrap a consumer with a label e.g. a type tag.

info

Arguments

:: Monad m 
=> Text

Some information.

-> Consumer s Doc m a

A value consumer.

-> Consumer s Doc m a 

Wrap a consumer with some handy information.

Description

data Doc

Description of parseable things.

Constructors

Integer !Text 
Double !Text 
Text !Text 
Boolean !Text 
Null !Text 
Object !Text 
Key !Text 
Array !Text 
Label !Text 
Info !Text 

Instances