| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Codec.JSON.Decoder.Stream
Description
Functions for parsing JSON with incremental output.
Synopsis
- data Stream a (m :: Type -> Type) r
- stream :: Source a r -> Blank -> Stream a Partial (Blank, Either (Path, Error) r)
- data Source a r
- mapSource :: (a -> b) -> Source a r -> Source b r
- foldSource :: (b -> a -> b) -> (b -> r -> b) -> b -> Source a r -> Decoder b
- foldSource' :: (b -> a -> b) -> (b -> r -> b) -> b -> Source a r -> Decoder b
- sourceDecoder :: Decoder a -> r -> Source a r
- data KeyDecoder a
- stringKey :: KeyDecoder String
- textKey :: KeyDecoder Text
- lazyTextKey :: KeyDecoder Text
- copyKey :: KeyDecoder a -> KeyDecoder (JSONKey, a)
- sourceObject :: KeyDecoder k -> (k -> r -> Source a r) -> r -> Source a r
- sourceObject_ :: (JSONKey -> r -> Source a r) -> r -> Source a r
- sourceArray :: (Word -> r -> Source a r) -> r -> Source a r
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.
Run
stream :: Source a r -> Blank -> Stream a Partial (Blank, Either (Path, Error) r) Source #
Run a stream incrementally.
Source
Decoder type for streams.
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
| Functor KeyDecoder Source # | |
Defined in Codec.JSON.Decoder.Internal Methods fmap :: (a -> b) -> KeyDecoder a -> KeyDecoder b # (<$) :: a -> KeyDecoder b -> KeyDecoder a # | |
| Alt KeyDecoder Source # |
|
Defined in Codec.JSON.Decoder.Internal Methods (<!>) :: KeyDecoder a -> KeyDecoder a -> KeyDecoder a # some :: Applicative KeyDecoder => KeyDecoder a -> KeyDecoder [a] # many :: Applicative KeyDecoder => KeyDecoder a -> KeyDecoder [a] # | |
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.