Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
This module exports facilities similar to those exported by the
Pipes.Aeson module, except they do not restrict the Value
s
that might be encoded or decoded to be just valid top-level values. That is,
not only Object
s or Array
s, according to to the RFC-4627 JSON
standard.
Synopsis
- encode :: (Monad m, ToJSON a) => a -> Proxy x' x () ByteString m ()
- decode :: (Monad m, FromJSON a) => Parser ByteString m (Maybe (Either DecodingError a))
- decoded :: (Monad m, FromJSON a, ToJSON a) => Lens' (Producer ByteString m r) (Producer a m (Either (DecodingError, Producer ByteString m r) r))
- loop :: (Monad m, FromJSON a) => (Producer ByteString m r -> Producer ByteString m r) -> Producer ByteString m r -> Producer' (Either DecodingError a) m r
- decodeL :: (Monad m, FromJSON a) => Parser ByteString m (Maybe (Either DecodingError (Int, a)))
- decodedL :: (Monad m, FromJSON a, ToJSON a) => Lens' (Producer ByteString m r) (Producer (Int, a) m (Either (DecodingError, Producer ByteString m r) r))
- loopL :: (Monad m, FromJSON a) => (Producer ByteString m r -> Producer ByteString m r) -> Producer ByteString m r -> Proxy x' x () (Either DecodingError (Int, a)) m r
Encoding
Decoding
decode :: (Monad m, FromJSON a) => Parser ByteString m (Maybe (Either DecodingError a)) Source #
decoded :: (Monad m, FromJSON a, ToJSON a) => Lens' (Producer ByteString m r) (Producer a m (Either (DecodingError, Producer ByteString m r) r)) Source #
:: (Monad m, FromJSON a) | |
=> (Producer ByteString m r -> Producer ByteString m r) | In case of Ideally you will want to drop everything until the beginning of the next
JSON element. This is easy to accomplish if there is a clear whitespace
delimiter between the JSON elements, such as a newline (i.e.,
Notice that unless you advance the |
-> Producer ByteString m r | Raw JSON input. |
-> Producer' (Either DecodingError a) m r |
Repeteadly try to parse raw JSON bytes into a
values, reporting any
DecodingError
s downstream as they happen.
Including lenghts
decodeL :: (Monad m, FromJSON a) => Parser ByteString m (Maybe (Either DecodingError (Int, a))) Source #
Like decode
, except it also returns the length of JSON input that was
consumed in order to obtain the value, not including the length of whitespace
between each parsed JSON input.
decodedL :: (Monad m, FromJSON a, ToJSON a) => Lens' (Producer ByteString m r) (Producer (Int, a) m (Either (DecodingError, Producer ByteString m r) r)) Source #
Like decoded
, except it also tags each decoded entity with the length of
JSON input that was consumed in order to obtain the value, not including the
length of whitespace between each parsed JSON input.
:: (Monad m, FromJSON a) | |
=> (Producer ByteString m r -> Producer ByteString m r) | In case of Ideally you will want to drop everything until the beginning of the next
JSON element. This is easy to accomplish if there is a clear whitespace
delimiter between the JSON elements, such as a newline (i.e.,
Notice that unless you advance the |
-> Producer ByteString m r | Raw JSON input. |
-> Proxy x' x () (Either DecodingError (Int, a)) m r |
Like loop
, except it also outputs the length of JSON input that was
consumed in order to obtain the value, not including the length of whitespace
before nor after the parsed JSON input.