tomland-1.3.1.0: Bidirectional TOML serialization
Copyright(c) 2018-2020 Kowainik
LicenseMPL-2.0
MaintainerKowainik <xrom.xkov@gmail.com>
Safe HaskellNone
LanguageHaskell2010

Toml.Codec.Code

Description

Conversion from textual representation of TOML values to the Haskell data types by the given TomlCodec.

This module includes coding functions like decode and encode.

Synopsis

Decode

decode :: TomlCodec a -> Text -> Either [TomlDecodeError] a Source #

Convert textual representation of TOML into user data type by the provided codec.

Since: 0.0.0

decodeValidation :: TomlCodec a -> Text -> Validation [TomlDecodeError] a Source #

Convert textual representation of TOML into user data type by the provided codec.

Since: 1.3.0.0

decodeFileEither :: forall a m. MonadIO m => TomlCodec a -> FilePath -> m (Either [TomlDecodeError] a) Source #

Similar to decode, but takes a path to a file with textual TOML values from which it decodes them with the provided codec.

Since: 1.3.0.0

decodeFile :: forall a m. MonadIO m => TomlCodec a -> FilePath -> m a Source #

Similar to decodeFileEither, throws LoadTomlException in case of parse errors (TomlDecodeError).

Since: 0.3.1

Encode

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

Convert data type to the textual representation of TOML values.

Since: 0.0.0

encodeToFile :: forall a m. MonadIO m => TomlCodec a -> FilePath -> a -> m Text Source #

Convert data type to the textual representation of TOML values. and write it info the given file.

Since: 1.3.0.0

Run

runTomlCodec :: TomlCodec a -> TOML -> Validation [TomlDecodeError] a Source #

Convert toml into user data type.

execTomlCodec :: TomlCodec a -> a -> TOML Source #

Runs codecWrite of TomlCodec and returns intermediate TOML AST.