yaml-pretty-extras: Extra functionality for pretty printing Yaml documents.

[ bsd3, data, library ] [ Propose Tags ]

Extra functionality for pretty printing Yaml documents. Allows precise field ordering.


[Skip to Readme]
Versions [faq] 0.0.1.0, 0.0.1.1, 0.0.1.2, 0.0.1.3, 0.0.2.0, 0.0.2.1, 0.0.2.2
Change log ChangeLog.md
Dependencies base (>=4.7 && <5), microlens-platform, rio, yaml [details]
License BSD-3-Clause
Copyright 2018 Daniel Firth
Author Daniel Firth
Maintainer locallycompact@gmail.com
Category Data
Source repo head: git clone https://gitlab.com/locallycompact/yaml-pretty-extras
Uploaded by locallycompact at Thu Jun 28 15:14:23 UTC 2018
Distributions NixOS:0.0.2.2
Downloads 1022 total (73 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2018-06-28 [all 1 reports]

Modules

[Index]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for yaml-pretty-extras-0.0.2.2

[back to package description]

yaml-pretty-extras

This library adds a toPrettyYaml typeclass and helper functions.

Example Usage

{-# LANGUAGE DeriveAnyClass    #-}
{-# LANGUAGE DeriveGeneric     #-}
{-# LANGUAGE OverloadedStrings #-}

import Data.Yaml.Pretty.Extras
import GHC.Generics

data Foo = Foo {
  bar :: Text,
  quux :: Text
} deriving (Eq, Show, FromJSON, ToJSON)

instance ToPrettyYaml Foo where
  fieldOrder = const ["quux", "bar"]

main = encodeFilePretty "foo.yaml" (Foo "bar" "quux") -- prints out "quux: quux\nbar: bar"