Safe Haskell | None |
---|---|
Language | Haskell2010 |
Contains TOML-specific combinators for converting between TOML and user data types.
- type BiToml a = Bi Env St a
- type Env = ExceptT EncodeException (Reader TOML)
- type St = ExceptT DecodeException (State TOML)
- data EncodeException
- data DecodeException
- encode :: BiToml a -> Text -> Either EncodeException a
- decode :: BiToml a -> a -> Either DecodeException Text
- unsafeDecode :: BiToml a -> a -> Text
- bijectionMaker :: forall a t. Text -> (forall f. Value f -> Maybe a) -> (a -> Value t) -> Key -> BiToml a
- dimapNum :: forall n r w. (Integral n, Functor r, Functor w) => Bi r w Integer -> Bi r w n
- bool :: Key -> BiToml Bool
- int :: Key -> BiToml Int
- integer :: Key -> BiToml Integer
- double :: Key -> BiToml Double
- str :: Key -> BiToml Text
- arrayOf :: forall a t. Valuer t a -> Key -> BiToml [a]
- maybeP :: forall a. (Key -> BiToml a) -> Key -> BiToml (Maybe a)
- data Valuer (tag :: ValueType) a = Valuer {}
- boolV :: Valuer TBool Bool
- integerV :: Valuer TInt Integer
- doubleV :: Valuer TFloat Double
- strV :: Valuer TString Text
- arrV :: forall a t. Valuer t a -> Valuer TArray [a]
Types
type Env = ExceptT EncodeException (Reader TOML) Source #
Immutable environment for Toml
conversion.
This is r
type variable in Bijection
data type.
type St = ExceptT DecodeException (State TOML) Source #
Mutable context for Toml
conversion.
This is w
type variable in Bijection
data type.
Exceptions
data EncodeException Source #
Type of exception for converting from Toml
to user custom data type.
data DecodeException Source #
Write exception for convertion to Toml
from user custom data type.
Encode/Decode
encode :: BiToml a -> Text -> Either EncodeException a Source #
Convert textual representation of toml into user data type.
decode :: BiToml a -> a -> Either DecodeException Text Source #
Convert object to textual representation.
unsafeDecode :: BiToml a -> a -> Text Source #
Unsafe version of decode
function if you're sure that you decoding
of structure is correct.
Converters
:: Text | Name of expected type |
-> (forall f. Value f -> Maybe a) | How to convert from |
-> (a -> Value t) | Convert |
-> Key | Key of the value |
-> BiToml a |
General function to create bidirectional converters for values.
Toml parsers
arrayOf :: forall a t. Valuer t a -> Key -> BiToml [a] Source #
Parser for array of values. Takes converter for single array element and returns list of values.
maybeP :: forall a. (Key -> BiToml a) -> Key -> BiToml (Maybe a) Source #
Bidirectional converter for Maybe smth
values.