Toml.Syntax.Types

toml-parser-2.0.1.0: TOML 1.0.0 parser

Copyright | (c) Eric Mertens 2023
License | ISC
Maintainer | emertens@gmail.com
Safe Haskell | None
Language | Haskell2010

Toml.Syntax.Types

Description

This module provides a raw representation of TOML files as a list of table definitions and key-value assignments.

These values use the raw dotted keys and have no detection for overlapping assignments.

Further processing will happen in the Semantics module.

Synopsis

- type Key a = NonEmpty (a, Text)
- data Expr a
  - = KeyValExpr (Key a) (Val a)
  - | TableExpr (Key a)
  - | ArrayTableExpr (Key a)
- data Val a
  - = ValInteger a Integer
  - | ValFloat a Double
  - | ValArray a [Val a]
  - | ValTable a [(Key a, Val a)]
  - | ValBool a Bool
  - | ValString a Text
  - | ValTimeOfDay a TimeOfDay
  - | ValZonedTime a ZonedTime
  - | ValLocalTime a LocalTime
  - | ValDay a Day
- data SectionKind
  - = TableKind
  - | ArrayTableKind

# Documentation

type Key a = NonEmpty (a, Text) #

Non-empty sequence of dotted simple keys

data Expr a #

Headers and assignments corresponding to lines of a TOML file

Constructors

KeyValExpr (Key a) (Val a) | key value assignment: `key = value`
TableExpr (Key a) | table: `[key]`
ArrayTableExpr (Key a) | array of tables: `[[key]]`

#### Instances

Instances details

Read a => Read (Expr a) # |
Instance details Defined in Toml.Syntax.Types Methods readsPrec :: Int -> ReadS (Expr a) # readList :: ReadS [Expr a] # readPrec :: ReadPrec (Expr a) # readListPrec :: ReadPrec [Expr a] #
Show a => Show (Expr a) # |
Instance details Defined in Toml.Syntax.Types Methods showsPrec :: Int -> Expr a -> ShowS # show :: Expr a -> String # showList :: [Expr a] -> ShowS #

data Val a #

Unvalidated TOML values. Table are represented as a list of assignments rather than as resolved maps.

Constructors

ValInteger a Integer |
ValFloat a Double |
ValArray a [Val a] |
ValTable a [(Key a, Val a)] |
ValBool a Bool |
ValString a Text |
ValTimeOfDay a TimeOfDay |
ValZonedTime a ZonedTime |
ValLocalTime a LocalTime |
ValDay a Day |

#### Instances

Instances details

Read a => Read (Val a) # |
Instance details Defined in Toml.Syntax.Types Methods readsPrec :: Int -> ReadS (Val a) # readList :: ReadS [Val a] # readPrec :: ReadPrec (Val a) # readListPrec :: ReadPrec [Val a] #
Show a => Show (Val a) # |
Instance details Defined in Toml.Syntax.Types Methods showsPrec :: Int -> Val a -> ShowS # show :: Val a -> String # showList :: [Val a] -> ShowS #

data SectionKind #

Kinds of table headers

Constructors

TableKind | table
ArrayTableKind | [array of tables ]

#### Instances

Instances details

Read SectionKind # |
Instance details Defined in Toml.Syntax.Types Methods readsPrec :: Int -> ReadS SectionKind # readList :: ReadS [SectionKind] # readPrec :: ReadPrec SectionKind # readListPrec :: ReadPrec [SectionKind] #
Show SectionKind # |
Instance details Defined in Toml.Syntax.Types Methods showsPrec :: Int -> SectionKind -> ShowS # show :: SectionKind -> String # showList :: [SectionKind] -> ShowS #
Eq SectionKind # |
Instance details Defined in Toml.Syntax.Types Methods (==) :: SectionKind -> SectionKind -> Bool # (/=) :: SectionKind -> SectionKind -> Bool #