json-1.0.0.0: RFC 8259 JSON
Safe HaskellNone
LanguageHaskell2010

Codec.JSON.Decoder.Stream

Description

Functions for parsing JSON with incremental output.

Synopsis

Stream

data Stream a (m :: Type -> Type) r Source #

A list parametrized by an element type a, an effect type m and the return type r.

Constructors

Yield a (Stream a m r) 
Effect (m (Stream a m r)) 
Return r 

Instances

Instances details
Functor m => Functor (Stream a m) Source # 
Instance details

Defined in Codec.JSON.Decoder.Stream.Internal

Methods

fmap :: (a0 -> b) -> Stream a m a0 -> Stream a m b #

(<$) :: a0 -> Stream a m b -> Stream a m a0 #

Run

stream :: Source a r -> Blank -> Stream a Partial (Blank, Either (Path, Error) r) Source #

Run a stream incrementally.

Source

data Source a r Source #

Decoder type for streams.

Instances

Instances details
Functor (Source a) Source # 
Instance details

Defined in Codec.JSON.Decoder.Stream.Internal

Methods

fmap :: (a0 -> b) -> Source a a0 -> Source a b #

(<$) :: a0 -> Source a b -> Source a a0 #

mapSource :: (a -> b) -> Source a r -> Source b r Source #

Apply a function to each element of the stream-decoder.

foldSource :: (b -> a -> b) -> (b -> r -> b) -> b -> Source a r -> Decoder b Source #

Left-associative fold of a stream-decoder, lazy in the accumulator.

foldSource' :: (b -> a -> b) -> (b -> r -> b) -> b -> Source a r -> Decoder b Source #

Left-associative fold of a stream-decoder, strict in the accumulator.

sourceDecoder :: Decoder a -> r -> Source a r Source #

Use a non-incremental decoder as a single-element stream.

Object

Key

data KeyDecoder a Source #

Object pair name decoder type

Instances

Instances details
Functor KeyDecoder Source # 
Instance details

Defined in Codec.JSON.Decoder.Internal

Methods

fmap :: (a -> b) -> KeyDecoder a -> KeyDecoder b #

(<$) :: a -> KeyDecoder b -> KeyDecoder a #

Alt KeyDecoder Source #

(<!>): references to all new input consumed by the left decoder are kept until it completes.

Instance details

Defined in Codec.JSON.Decoder.Internal

stringKey :: KeyDecoder String Source #

Decode a JSON object pair name as a String.

textKey :: KeyDecoder Text Source #

Decode a JSON object pair name as a strict Text.

lazyTextKey :: KeyDecoder Text Source #

Decode a JSON object pair name as a lazy Text.

copyKey :: KeyDecoder a -> KeyDecoder (JSONKey, a) Source #

Get a copy of the underlying input alongside the object pair name.

Sources

sourceObject :: KeyDecoder k -> (k -> r -> Source a r) -> r -> Source a r Source #

Stream a JSON object. Object pair names are parsed with the given KeyDecoder.

sourceObject_ :: (JSONKey -> r -> Source a r) -> r -> Source a r Source #

Stream a JSON object. Object pair names are copied verbatim.

Array

sourceArray :: (Word -> r -> Source a r) -> r -> Source a r Source #

Stream a JSON array. The Word argument is the element index, starts at 0.