HORIZON HASKELLDocslts/ghc-9.10.xc74966e2026-09-27Search names, modules, packages, or :: a typeCtrl K

GHC 9.10.3 · lts/ghc-9.10.x · c74966e · 2026-09-27

Moduletoml-parser-2.0.0.0Haskell2010

Toml.Semantics.Ordered

This module can help build a key ordering projection given an existing TOML file. This could be useful for applying a transformation to a TOML file before pretty-printing it back in something very close to the original order.

When using the computed order, table keys will be remembered in the order they appeared in the source file. Any key additional keys added to the tables will be ordered alphabetically after all the known keys.

demo =
 do txt <- readFile "demo.toml"
    let Right exprs = Toml.Parser.parseRawToml txt
        to          = extractTableOrder exprs
        Right toml  = semantics exprs
        projection  = projectKey to
    print (prettyTomlOrdered projection toml)
  • 2 types
  • 3 values
newtypenewtype TableOrder
#

Summary of the order of the keys in a TOML document.