pipes-aeson-0.1.0.0: Encode and decode JSON streams using aeson and pipes.

Safe HaskellNone

Control.Proxy.Aeson.Unsafe

Contents

Description

This module exports facilities similar to those exported by the Control.Proxy.Aeson module, except they do not restrict the Values that might be encoded or decoded to be just valid top-level values. That is, not only Objects or Arrays, according to to the RFC-4627 JSON standard.

Synopsis

Encoding

encode :: (Proxy p, Monad m, ToJSON a) => a -> p x' x () ByteString m ()Source

Like encode, except it accepts any ToJSON instance.

encodeD :: (Proxy p, Monad m, ToJSON a) => () -> Pipe p a ByteString m rSource

Like encodeD, except it accepts any ToJSON instance.

Decoding

decode :: (Monad m, Proxy p, FromJSON r) => EitherP DecodingError (StateP [ByteString] p) () (Maybe ByteString) y' y m rSource

Like decode, except it will decode any ToJSON instance.

decodeD :: (Monad m, Proxy p, FromJSON b) => () -> Pipe (EitherP DecodingError (StateP [ByteString] p)) (Maybe ByteString) b m ()Source

Like decodeD, except it will decode any ToJSON instance.

Lower level parsing

parseValue :: (Monad m, Proxy p) => EitherP ParsingError (StateP [ByteString] p) () (Maybe ByteString) y' y m ValueSource

Like parseValue, except it will parse into any Value.

parseValueD :: (Monad m, Proxy p) => () -> Pipe (EitherP ParsingError (StateP [ByteString] p)) (Maybe ByteString) Value m ()Source

Like parseValueD, except it will parse into any Value.

Types

data DecodingError Source

An error while decoding a JSON value.

Constructors

ParserError ParsingError

An Attoparsec error that happened while parsing the raw JSON string.

ValueError String

An Aeson error that happened while trying to convert a Value to an FromJSON instance, as reported by Error.