toml-parser-1.1.0.0: TOML 1.0.0 parser
Copyright(c) Eric Mertens 2023
LicenseISC
Maintaineremertens@gmail.com
Safe HaskellSafe-Inferred
LanguageHaskell2010

Toml.ToValue

Description

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.

Synopsis

Documentation

class ToValue a where Source #

Class for types that can be embedded into Value

Minimal complete definition

toValue

Methods

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

Instances details
ToValue Int16 Source # 
Instance details

Defined in Toml.ToValue

ToValue Int32 Source # 
Instance details

Defined in Toml.ToValue

ToValue Int64 Source # 
Instance details

Defined in Toml.ToValue

ToValue Int8 Source # 
Instance details

Defined in Toml.ToValue

ToValue Word16 Source # 
Instance details

Defined in Toml.ToValue

ToValue Word32 Source # 
Instance details

Defined in Toml.ToValue

ToValue Word64 Source # 
Instance details

Defined in Toml.ToValue

ToValue Word8 Source # 
Instance details

Defined in Toml.ToValue

ToValue Day Source # 
Instance details

Defined in Toml.ToValue

ToValue LocalTime Source # 
Instance details

Defined in Toml.ToValue

ToValue TimeOfDay Source # 
Instance details

Defined in Toml.ToValue

ToValue ZonedTime Source # 
Instance details

Defined in Toml.ToValue

ToValue Value Source # 
Instance details

Defined in Toml.ToValue

ToValue Integer Source # 
Instance details

Defined in Toml.ToValue

ToValue Natural Source # 
Instance details

Defined in Toml.ToValue

ToValue Bool Source # 
Instance details

Defined in Toml.ToValue

ToValue Char Source #

Single characters are encoded as singleton strings. Lists of characters are encoded as a single string value.

Instance details

Defined in Toml.ToValue

ToValue Double Source # 
Instance details

Defined in Toml.ToValue

ToValue Float Source # 
Instance details

Defined in Toml.ToValue

ToValue Int Source # 
Instance details

Defined in Toml.ToValue

ToValue Word Source # 
Instance details

Defined in Toml.ToValue

ToValue a => ToValue [a] Source #

This instance defers to the list element's toValueList implementation.

Instance details

Defined in Toml.ToValue

Methods

toValue :: [a] -> Value Source #

toValueList :: [[a]] -> Value Source #

(k ~ String, ToValue v) => ToValue (Map k v) Source #

Since: 1.0.1.0

Instance details

Defined in Toml.ToValue

Methods

toValue :: Map k v -> Value Source #

toValueList :: [Map k v] -> Value Source #

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.

Methods

toTable :: a -> Table Source #

Convert a single value into a table

Instances

Instances details
(k ~ String, ToValue v) => ToTable (Map k v) Source #

Since: 1.0.1.0

Instance details

Defined in Toml.ToValue

Methods

toTable :: Map k v -> Table Source #

defaultTableToValue :: ToTable a => a -> Value Source #

Convenience function for building ToValue instances.

table :: [(String, Value)] -> Value Source #

Build a Table from a list of key-value pairs.

Use .= for a convenient way to build the pairs.

(.=) :: ToValue a => String -> a -> (String, Value) Source #

Convenience function for building key-value pairs while constructing a Table.

table [a .= b, c .= d]