tomland-0.5.0: Bidirectional TOML parser

Safe HaskellNone
LanguageHaskell2010

Toml.Printer

Description

Contains functions for pretty printing toml types.

Synopsis

Documentation

data PrintOptions Source #

Configures the pretty printer.

Constructors

PrintOptions 

Fields

Instances
Show PrintOptions Source # 
Instance details

Defined in Toml.Printer

defaultOptions :: PrintOptions Source #

Default printing options.

pretty :: TOML -> Text Source #

Converts TOML type into Value (using defaultOptions).

For example, this

TOML
    { tomlPairs  = HashMap.fromList
          [("title", AnyValue $ Text "TOML example")]
    , tomlTables = PrefixTree.fromList
          [( "example" <| "owner"
           , mempty
                 { tomlPairs  = HashMap.fromList
                       [("name", AnyValue $ Text Kowainik)]
                 }
           )]
    }

will be translated to this

title = "TOML Example"

[example.owner]
  name = Kowainik

prettyOptions :: PrintOptions -> TOML -> Text Source #

Converts TOML type into Value using provided PrintOptions

prettyTomlInd Source #

Arguments

:: PrintOptions

Printing options

-> Int

Current indentation

-> Text

Accumulator for table names

-> TOML

Given TOML

-> Text

Pretty result

Converts TOML into Value with the given indent.