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 Source

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 Source

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 Source

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 Source

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 Source

Arguments

:: Monad m 
=> Text

Description of what the string is for.

-> Consumer Value Doc m Text 

Consume a string.

integer Source

Arguments

:: Monad m 
=> Text

Description of what the integer is for.

-> Consumer Value Doc m Integer 

Consume an integer.

double Source

Arguments

:: Monad m 
=> Text

Description of what the double is for.

-> Consumer Value Doc m Double 

Consume an double.

bool Source

Arguments

:: Monad m 
=> Text

Description of what the bool is for.

-> Consumer Value Doc m Bool 

Parse a boolean.

null Source

Arguments

:: Monad m 
=> Text

What the null is for.

-> Consumer Value Doc m () 

Expect null.

Annotations

label Source

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 Source

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 Source

Description of parseable things.

Instances