package toml
All checked builds passInstall
dune-project
Dependency
Authors
Maintainers
Sources
sha256=1d4e9c16ed9e24d46dd757ce94adc7fc8b2068eb5ff7cd2a70fce08135a752ef
sha512=9cb98e4a9c4a01acf5ceeac836fe0dc4d341662f9b3ce6803e9d14499bcb450441111247159bdbc5c25d4618b8c1f088d206da702bef12ea1ca8781607d26774
Description
toml is an OCaml library providing a parser, a serializer and a printer for TOML, a minimal configuration file format. Helpful getters to retrieve data as OCaml primitive types are also supplied.
Added to opam-repository:
README
toml

Documentation
Have a look at the online documentation. Otherwise, here's a quickstart guide.
Reading TOML data
# (* This will return either `Ok $tomltable or `Error $error_with_location *)
let ok_or_error = Toml.Parser.from_string "key=[1,2]";;
val ok_or_error : Toml.Parser.result = `Ok <abstr>
# (* You can use the 'unsafe' combinator to get the result directly, or an
exception if a parsing error occurred *)
let parsed_toml = Toml.Parser.(from_string "key=[1,2]" |> unsafe);;
val parsed_toml : Toml.Types.table = <abstr>
# (* Use simple pattern matching to read the value *)
Toml.Types.Table.find (Toml.Min.key "key") parsed_toml;;
- : Toml.Types.value = Toml.Types.TArray (Toml.Types.NodeInt [1; 2])Writing TOML data
# let toml_data = Toml.Min.of_key_values [
Toml.Min.key "ints", Toml.Types.TArray (Toml.Types.NodeInt [1; 2]);
Toml.Min.key "string", Toml.Types.TString "string value";
];;
val toml_data : Toml.Types.table = <abstr>
# Toml.Printer.string_of_table toml_data;;
- : string = "ints = [1, 2]\nstring = \"string value\"\n"Lenses
Through lenses, it is possible to read/write deeply nested data with ease. The Toml.Lenses module provides partial lenses (that is, lenses returning option types) to manipulate TOML data structures.
# let toml_data = Toml.Parser.(from_string
"[this.is.a.deeply.nested.table] answer=42" |> unsafe);;
val toml_data : Toml.Types.table = <abstr>
# Toml.Lenses.(get toml_data (
key "this" |-- table
|-- key "is" |-- table
|-- key "a" |-- table
|-- key "deeply" |-- table
|-- key "nested" |-- table
|-- key "table" |-- table
|-- key "answer"|-- int ));;
- : int option = Some 42
# let maybe_toml_data' = Toml.Lenses.(set 2015 toml_data (
key "this" |-- table
|-- key "is" |-- table
|-- key "a" |-- table
|-- key "deeply" |-- table
|-- key "nested" |-- table
|-- key "table" |-- table
|-- key "answer"|-- int ));;
val maybe_toml_data' : Toml.Types.table option = Some <abstr>
# Toml.Printer.string_of_table (Option.get maybe_toml_data');;
- : string = "[this.is.a.deeply.nested.table]\nanswer = 2015\n"Limitations
- Keys don't quite follow the TOML standard. Both section keys (eg,
[key1.key2]) and ordinary keys (key=...) may not contain the following characters: space,\t,\n,\r,.,[,],"and#.
Projects using toml
If you want to add your project, feel free to open a PR.
Dev Dependencies (5)
-
odoc
with-doc -
ocb
with-test & >= "0.1" & dev -
bisect_ppx
with-test & >= "2.5" & dev -
mdx
with-test & >= "2.1" -
ounit2
with-test
Optional Dependencies
None
Used by (15)
-
alice
< "0.4.0" - autofonce_config
-
binsec
>= "0.6.0" -
camyll
>= "0.2.0" & < "0.4.0" - comby
-
drom_lib
>= "0.6.0" & < "0.8.0" -
forester
>= "4.0.0" -
fromager
< "0.5.0" - gendarme-toml
- gradescope_submit
-
hll
>= "4.3" -
pds
>= "5.42" - rust-staticlib-gen
-
soupault
>= "2.3.1" & < "3.0.0" - toml_cconv
Conflicts
None
Build status
Results of building toml with each compiler on check.ci.ocaml.org, run of against opam-repository 7cdc698. All results for this package.
Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.
| Version | OCaml 4.11 | OCaml 4.14 | OCaml 5.2 | OCaml 5.4 | OCaml 5.5 |
|---|---|---|---|---|---|
| 7.1.0 (this version) | good | good | good | good | good |
- good Package successfully built
- partial One of the dependencies failed to build
- bad Package failed to build
- n/a Package is not available in this environment
- internal Internal failure