Copyright | (c) Eric Mertens 2023 |
---|---|
License | ISC |
Maintainer | emertens@gmail.com |
Safe Haskell | Safe-Inferred |
Language | Haskell2010 |
The ToValue
class provides a conversion function from
application-specific to TOML values.
Because the top-level TOML document is always a table,
the ToTable
class is for types that specifically support
conversion from a Table
.
Toml.ToValue.Generic can be used to derive instances of ToTable
automatically for record types.
Documentation
class ToValue a where Source #
Class for types that can be embedded into Value
toValue :: a -> Value Source #
Embed a single thing into a TOML value.
toValueList :: [a] -> Value Source #
Helper for converting a list of things into a value. This is typically left to be defined by its default implementation and exists to help define the encoding for TOML arrays.
Instances
ToValue Int16 Source # | |
ToValue Int32 Source # | |
ToValue Int64 Source # | |
ToValue Int8 Source # | |
ToValue Word16 Source # | |
ToValue Word32 Source # | |
ToValue Word64 Source # | |
ToValue Word8 Source # | |
ToValue Day Source # | |
ToValue LocalTime Source # | |
ToValue TimeOfDay Source # | |
ToValue ZonedTime Source # | |
ToValue Value Source # | |
ToValue Integer Source # | |
ToValue Natural Source # | |
ToValue Bool Source # | |
ToValue Char Source # | Single characters are encoded as singleton strings. Lists of characters are encoded as a single string value. |
ToValue Double Source # | |
ToValue Float Source # | |
ToValue Int Source # | |
ToValue Word Source # | |
ToValue a => ToValue [a] Source # | This instance defers to the list element's |
Defined in Toml.ToValue | |
(k ~ String, ToValue v) => ToValue (Map k v) Source # | Since: 1.0.1.0 |
Table construction
class ToValue a => ToTable a where Source #
Class for things that can be embedded into a TOML table.
Implement this for things that embed into a Table
and then
the ToValue
instance can be derived with defaultTableToValue
.
defaultTableToValue :: ToTable a => a -> Value Source #
Convenience function for building ToValue
instances.