Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- type TomlCodec a = BiCodec Env St a
- type Env = ExceptT DecodeException (Reader TOML)
- type St = MaybeT (State TOML)
- data DecodeException
- data LoadTomlException = LoadTomlException FilePath Text
- prettyException :: DecodeException -> Text
- decode :: TomlCodec a -> Text -> Either DecodeException a
- decodeFile :: MonadIO m => TomlCodec a -> FilePath -> m a
- runTomlCodec :: TomlCodec a -> TOML -> Either DecodeException a
- encode :: TomlCodec a -> a -> Text
- execTomlCodec :: TomlCodec a -> a -> TOML
Types
type Env = ExceptT DecodeException (Reader TOML) Source #
Immutable environment for TOML conversion.
This is r
type variable in Codec
data type.
type St = MaybeT (State TOML) Source #
Mutable context for TOML conversion.
This is w
type variable in Codec
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.
TrivialError | |
BiMapError TomlBiMapError | |
KeyNotFound Key | No such key |
TableNotFound Key | No such table |
TypeMismatch Key Text TValue | Expected type vs actual type |
ParseError ParseException | Exception during parsing |
Instances
data LoadTomlException Source #
File loading error data type.
Instances
Show LoadTomlException Source # | |
Defined in Toml.Bi.Code showsPrec :: Int -> LoadTomlException -> ShowS # show :: LoadTomlException -> String # showList :: [LoadTomlException] -> ShowS # | |
Exception LoadTomlException Source # | |
Defined in Toml.Bi.Code |
prettyException :: DecodeException -> Text Source #
Converts DecodeException
into pretty human-readable text.
Encode/Decode
decode :: TomlCodec a -> Text -> Either DecodeException a Source #
Convert textual representation of toml into user data type.
decodeFile :: MonadIO m => TomlCodec a -> FilePath -> m a Source #
Decode a value from a file. In case of parse errors, throws LoadTomlException
.
runTomlCodec :: TomlCodec a -> TOML -> Either DecodeException a Source #
Convert toml into user data type.
execTomlCodec :: TomlCodec a -> a -> TOML Source #
Runs codecWrite
of TomlCodec
and returns intermediate TOML AST.