tomland-0.2.0: TOML parser

Safe HaskellNone
LanguageHaskell2010

Toml.Printer

Description

Contains functions for pretty printing toml types.

Synopsis

Documentation

prettyToml :: TOML -> Text Source #

Converts TOML type into Text.

For example, this

TOML
    { tomlPairs  = HashMap.fromList [(Key "title", String "TOML example")]
    , tomlTables = HashMap.fromList
          [( TableId (NonEmpty.fromList ["example", "owner"])
           , TOML
                 { tomlPairs  = HashMap.fromList [(Key "name", String Kowainik)]
                 , tomlTables = mempty
                 , tomlTableArrays = mempty
                 }
           )]
    , tomlTableArrays = mempty
    }

will be translated to this

title = "TOML Example"

[example.owner]
  name = Kowainik

prettyTomlInd Source #

Arguments

:: Int

Number of spaces for indentation

-> Text

Accumulator for table names

-> TOML

Given TOML

-> Text

Pretty result

Converts TOML into Text with the given indent.