| Copyright | (c) 2018-2022 Kowainik |
|---|---|
| License | MPL-2.0 |
| Maintainer | Kowainik <xrom.xkov@gmail.com> |
| Stability | Stable |
| Portability | Portable |
| Safe Haskell | Safe-Inferred |
| Language | Haskell2010 |
Toml.Codec.Code
Description
Synopsis
- decode :: TomlCodec a -> Text -> Either [TomlDecodeError] a
- decodeExact :: TomlCodec a -> Text -> Either [TomlDecodeError] a
- decodeValidation :: TomlCodec a -> Text -> Validation [TomlDecodeError] a
- decodeFileEither :: forall a m. MonadIO m => TomlCodec a -> FilePath -> m (Either [TomlDecodeError] a)
- decodeFile :: forall a m. MonadIO m => TomlCodec a -> FilePath -> m a
- decodeFileExact :: forall a m. MonadIO m => TomlCodec a -> FilePath -> m (Either [TomlDecodeError] a)
- encode :: TomlCodec a -> a -> Text
- encodeToFile :: forall a m. MonadIO m => TomlCodec a -> FilePath -> a -> m Text
- runTomlCodec :: TomlCodec a -> TOML -> Validation [TomlDecodeError] a
- execTomlCodec :: TomlCodec a -> a -> TOML
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
decodeExact :: TomlCodec a -> Text -> Either [TomlDecodeError] a Source #
Convert textual representation of TOML into user data type by the
provided codec.
Unlike decode, this function returns NotExactDecode error in case if given
TOML has redundant fields and other elements.
Since: 1.3.2.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
decodeFileExact :: forall a m. MonadIO m => TomlCodec a -> FilePath -> m (Either [TomlDecodeError] a) Source #
Similar to decodeExact, but takes a path to a file with textual TOML
values from which it decodes them with the provided codec.
Since: 1.3.2.0
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.