tomland-0.3.1: TOML parser

Safe HaskellNone
LanguageHaskell2010

Toml.Bi.Code

Contents

Synopsis

Types

type BiToml a = Bi Env St a Source #

Specialied Bi type alias for Toml monad. Keeps TOML object either as environment or state.

type Env = ExceptT DecodeException (Reader TOML) Source #

Immutable environment for Toml conversion. This is r type variable in Bijection data type.

type St = MaybeT (State TOML) Source #

Mutable context for Toml conversion. This is w type variable in Bijection data type.

MaybeT (State TOML) a
    = State TOML (Maybe a)
    = TOML -> (Maybe a, TOML)

Exceptions

data DecodeException Source #

Type of exception for converting from Toml to user custom data type.

Constructors

TrivialError 
KeyNotFound Key

No such key

TableNotFound Key

No such table

TypeMismatch Key Text TValue

Expected type vs actual type

ParseError ParseException

Exception during parsing

prettyException :: DecodeException -> Text Source #

Converts DecodeException into pretty human-readable text.

Encode/Decode

decode :: BiToml a -> Text -> Either DecodeException a Source #

Convert textual representation of toml into user data type.

decodeFile :: MonadIO m => BiToml a -> FilePath -> m a Source #

Decode a value from a file. In case of parse errors, throws LoadTomlException.

encode :: BiToml a -> a -> Text Source #

Convert object to textual representation.