descriptive-0.5.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

:: Text

Description of what the object is.

-> Consumer Object Doc a

An object consumer.

-> Consumer Value Doc a 

Consume an object.

key Source

Arguments

:: Text

The key to lookup.

-> Consumer Value Doc a

A value consumer of the object at the key.

-> Consumer Object Doc a 

Consume from object at the given key.

keyMaybe Source

Arguments

:: Text

The key to lookup.

-> Consumer Value Doc a

A value consumer of the object at the key.

-> Consumer Object Doc (Maybe a) 

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

array Source

Arguments

:: Text

Description of this array.

-> Consumer Value Doc a

Consumer for each element in the array.

-> Consumer Value Doc (Vector a) 

Consume an array.

string Source

Arguments

:: Text

Description of what the string is for.

-> Consumer Value Doc Text 

Consume a string.

integer Source

Arguments

:: Text

Description of what the integer is for.

-> Consumer Value Doc Integer 

Consume an integer.

double Source

Arguments

:: Text

Description of what the double is for.

-> Consumer Value Doc Double 

Consume an double.

bool Source

Arguments

:: Text

Description of what the bool is for.

-> Consumer Value Doc Bool 

Parse a boolean.

null Source

Arguments

:: Text

What the null is for.

-> Consumer Value Doc () 

Expect null.

Annotations

label Source

Arguments

:: Text

Some label.

-> Consumer s Doc a

A value consumer.

-> Consumer s Doc a 

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

info Source

Arguments

:: Text

Some information.

-> Consumer s Doc a

A value consumer.

-> Consumer s Doc a 

Wrap a consumer with some handy information.

Description

data Doc Source

Description of parseable things.

Instances