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

Toml

Description

This module parses TOML into semantically meaningful values.

This parser implements TOML 1.0.0 https://toml.io/en/v1.0.0 as carefully as possible.

Synopsis

types

type Table = Map String Value Source #

Representation of a TOML key-value table.

data Value Source #

Semantic TOML value with all table assignments resolved.

Instances

Instances details
Read Value Source # 
Instance details

Defined in Toml.Value

Show Value Source # 
Instance details

Defined in Toml.Value

Methods

showsPrec :: Int -> Value -> ShowS #

show :: Value -> String #

showList :: [Value] -> ShowS #

Eq Value Source # 
Instance details

Defined in Toml.Value

Methods

(==) :: Value -> Value -> Bool #

(/=) :: Value -> Value -> Bool #

FromValue Value Source # 
Instance details

Defined in Toml.FromValue

ToValue Value Source # 
Instance details

Defined in Toml.ToValue

parsing

parse :: String -> Either String Table Source #

Parse a TOML formatted Value or report an error message.

printing

prettyToml :: Table -> TomlDoc Source #

Render a complete TOML document using top-level table and array of table sections where appropriate.

data DocClass Source #

Annotation used to enable styling pretty-printed TOML

Constructors

TableClass

top-level [key] and [[key]]

KeyClass

dotted keys, left-hand side of assignments

StringClass

string literals

NumberClass

number literals

DateClass

date and time literals

BoolClass

boolean literals

Instances

Instances details
Read DocClass Source # 
Instance details

Defined in Toml.Pretty

Show DocClass Source # 
Instance details

Defined in Toml.Pretty

Eq DocClass Source # 
Instance details

Defined in Toml.Pretty

Ord DocClass Source # 
Instance details

Defined in Toml.Pretty

Serialization

decode :: FromTable a => String -> Result a Source #

Use the FromTable instance to decode a value from a TOML string.

encode :: ToTable a => a -> TomlDoc Source #

Use the ToTable instance to encode a value to a TOML string.

data Result a Source #

Computation outcome with error and warning messages.

Constructors

Failure String 
Success [String] a 

Instances

Instances details
Read a => Read (Result a) Source # 
Instance details

Defined in Toml.FromValue.Matcher

Show a => Show (Result a) Source # 
Instance details

Defined in Toml.FromValue.Matcher

Methods

showsPrec :: Int -> Result a -> ShowS #

show :: Result a -> String #

showList :: [Result a] -> ShowS #

Eq a => Eq (Result a) Source # 
Instance details

Defined in Toml.FromValue.Matcher

Methods

(==) :: Result a -> Result a -> Bool #

(/=) :: Result a -> Result a -> Bool #

Ord a => Ord (Result a) Source # 
Instance details

Defined in Toml.FromValue.Matcher

Methods

compare :: Result a -> Result a -> Ordering #

(<) :: Result a -> Result a -> Bool #

(<=) :: Result a -> Result a -> Bool #

(>) :: Result a -> Result a -> Bool #

(>=) :: Result a -> Result a -> Bool #

max :: Result a -> Result a -> Result a #

min :: Result a -> Result a -> Result a #