Safe Haskell | None |
---|---|
Language | Haskell2010 |
Contains TOML-specific combinators for converting between TOML and user data types.
Synopsis
- bool :: Key -> TomlCodec Bool
- integer :: Key -> TomlCodec Integer
- natural :: Key -> TomlCodec Natural
- int :: Key -> TomlCodec Int
- word :: Key -> TomlCodec Word
- double :: Key -> TomlCodec Double
- float :: Key -> TomlCodec Float
- text :: Key -> TomlCodec Text
- lazyText :: Key -> TomlCodec Text
- byteString :: Key -> TomlCodec ByteString
- lazyByteString :: Key -> TomlCodec ByteString
- string :: Key -> TomlCodec String
- zonedTime :: Key -> TomlCodec ZonedTime
- localTime :: Key -> TomlCodec LocalTime
- day :: Key -> TomlCodec Day
- timeOfDay :: Key -> TomlCodec TimeOfDay
- arrayOf :: TomlBiMap a AnyValue -> Key -> TomlCodec [a]
- arraySetOf :: Ord a => TomlBiMap a AnyValue -> Key -> TomlCodec (Set a)
- arrayIntSet :: Key -> TomlCodec IntSet
- arrayHashSetOf :: (Hashable a, Eq a) => TomlBiMap a AnyValue -> Key -> TomlCodec (HashSet a)
- arrayNonEmptyOf :: TomlBiMap a AnyValue -> Key -> TomlCodec (NonEmpty a)
- textBy :: (a -> Text) -> (Text -> Either Text a) -> Key -> TomlCodec a
- read :: (Show a, Read a) => Key -> TomlCodec a
- table :: forall a. TomlCodec a -> Key -> TomlCodec a
- nonEmpty :: forall a. TomlCodec a -> Key -> TomlCodec (NonEmpty a)
- list :: forall a. TomlCodec a -> Key -> TomlCodec [a]
- match :: forall a. TomlBiMap a AnyValue -> Key -> TomlCodec a
Basic codecs for primitive values
Boolean
Integral numbers
Floating point numbers
Text types
byteString :: Key -> TomlCodec ByteString Source #
Codec for text values as ByteString
.
lazyByteString :: Key -> TomlCodec ByteString Source #
Codec for text values as ByteString
.
Time types
Codecs for containers of primitives
arrayOf :: TomlBiMap a AnyValue -> Key -> TomlCodec [a] Source #
Codec for list of values. Takes converter for single value and returns a list of values.
arraySetOf :: Ord a => TomlBiMap a AnyValue -> Key -> TomlCodec (Set a) Source #
Codec for sets. Takes converter for single value and returns a set of values.
arrayIntSet :: Key -> TomlCodec IntSet Source #
Codec for sets of ints. Takes converter for single value and returns a set of ints.
arrayHashSetOf :: (Hashable a, Eq a) => TomlBiMap a AnyValue -> Key -> TomlCodec (HashSet a) Source #
Codec for hash sets. Takes converter for single hashable value and returns a set of hashable values.
arrayNonEmptyOf :: TomlBiMap a AnyValue -> Key -> TomlCodec (NonEmpty a) Source #
Codec for non- empty lists of values. Takes converter for single value and returns a non-empty list of values.
Additional codecs for custom types
textBy :: (a -> Text) -> (Text -> Either Text a) -> Key -> TomlCodec a Source #
Codec for text values with custom error messages for parsing.
Combinators for tables
table :: forall a. TomlCodec a -> Key -> TomlCodec a Source #
Codec for tables. Use it when when you have nested objects.
list :: forall a. TomlCodec a -> Key -> TomlCodec [a] Source #
Codec
for list of values. Represented in TOML as array of tables.
General construction of codecs
match :: forall a. TomlBiMap a AnyValue -> Key -> TomlCodec a Source #
General function to create bidirectional converters for key-value pairs. In
order to use this function you need to create TomlBiMap
for your type and
AnyValue
:
_MyType ::TomlBiMap
MyTypeAnyValue
And then you can create codec for your type using match
function:
myType ::Key
->TomlCodec
MyType myType =match
_MyType