ron-hs-0.4.0: RON format implementation in haskell
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Ron.Deserialize

Description

Ron routines for deserialization. Also exposes the underlying attoparsec parsers if you want to build more complicated consumers of ron, like conduits or pipes

Synopsis

Documentation

decode :: FromRon a => ByteString -> Either String a Source #

Parse a ByteString to your type. The error is produced by attoparsec and is not very useful.

decodeLazy :: FromRon a => ByteString -> Either String a Source #

Parse a lazy ByteString to your type. The error is produced by attoparsec and is not very useful.

decodeFile :: FromRon a => FilePath -> IO a Source #

Parse file content to your type. Throws ParseError or DecodeError on errors.

loads :: ByteString -> Either String Value Source #

Parse a ByteString to a Value. You probably want decode instead

loadsLazy :: ByteString -> Either String Value Source #

Parse a lazy ByteString to a Value. You probably want decodeLazy instead

loadFile :: FilePath -> IO Value Source #

Parse file. Throws ParseError

loadFile' :: FilePath -> IO (Either String Value) Source #

Parse file and return the error in Either

Exceptions

data DecodeError Source #

Error parsing Value to custom type

Parsers

document :: Parser Value Source #

A parser for a complete Ron document, consisting of a single value. Expects EOF at the end. Will parse Ron notation, or a toplevel record with no braces, or a toplevel list with no braces; the latter two are ron-hs extensions.

toplevel :: Parser Value Source #

Toplevel is either a toplevel list, toplevel record, or a regular ron value. The first two are ron-hs extensions.

This is similar to document, but won't parse whitespace before self, and doesn't expect EOF at the end.

value :: Parser Value Source #

A ron value as defined by the ron-rs spec (with minor deviations described in this package).

Unlike toplevel, this won't parse bare toplevel list or record. Unlike document and like toplevel, won't parse whitespace before self, and doesn't expect EOF at the end.

ronWhitespace :: Parser () Source #

Whitespace as defined by ron-rs spec. Useful if you want to build your custom attoparsec parsers from value or toplevel.