| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Toml.Printer
Description
Contains functions for pretty printing toml types.
Synopsis
- data PrintOptions = PrintOptions {
- shouldSort :: Bool
- indent :: Int
- defaultOptions :: PrintOptions
- pretty :: TOML -> Text
- prettyOptions :: PrintOptions -> TOML -> Text
- prettyTomlInd :: PrintOptions -> Int -> Text -> TOML -> Text
Documentation
data PrintOptions Source #
Configures the pretty printer.
Constructors
| PrintOptions | |
Fields
| |
Instances
| Show PrintOptions Source # | |
Defined in Toml.Printer Methods showsPrec :: Int -> PrintOptions -> ShowS # show :: PrintOptions -> String # showList :: [PrintOptions] -> ShowS # | |
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