| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Toml.Bi.Code
Contents
Synopsis
- type BiToml a = Bi 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 :: BiToml a -> Text -> Either DecodeException a
- decodeFile :: MonadIO m => BiToml a -> FilePath -> m a
- encode :: BiToml a -> a -> Text
Types
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 |
Instances
| Eq DecodeException Source # | |
Defined in Toml.Bi.Code Methods (==) :: DecodeException -> DecodeException -> Bool # (/=) :: DecodeException -> DecodeException -> Bool # | |
| Show DecodeException Source # | |
Defined in Toml.Bi.Code Methods showsPrec :: Int -> DecodeException -> ShowS # show :: DecodeException -> String # showList :: [DecodeException] -> ShowS # | |
| Semigroup DecodeException Source # | |
Defined in Toml.Bi.Code Methods (<>) :: DecodeException -> DecodeException -> DecodeException # sconcat :: NonEmpty DecodeException -> DecodeException # stimes :: Integral b => b -> DecodeException -> DecodeException # | |
| Monoid DecodeException Source # | |
Defined in Toml.Bi.Code Methods mappend :: DecodeException -> DecodeException -> DecodeException # mconcat :: [DecodeException] -> DecodeException # | |
data LoadTomlException Source #
File loading error data type.
Constructors
| LoadTomlException FilePath Text |
Instances
| Show LoadTomlException Source # | |
Defined in Toml.Bi.Code Methods showsPrec :: Int -> LoadTomlException -> ShowS # show :: LoadTomlException -> String # showList :: [LoadTomlException] -> ShowS # | |
| Exception LoadTomlException Source # | |
Defined in Toml.Bi.Code Methods toException :: LoadTomlException -> SomeException # | |
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.