Last change
on this file since 1 was 1, checked in by fox, 9 years ago |
initial simple example with omd
|
File size:
691 bytes
|
Line | |
---|
1 | type t = TomlTypes.table
|
---|
2 |
|
---|
3 | let from_path path =
|
---|
4 | match Toml.Parser.from_filename (Fpath.to_string path) with
|
---|
5 | | `Error (str, _loc) -> Error str
|
---|
6 | | `Ok toml -> Ok toml
|
---|
7 |
|
---|
8 | open TomlLenses
|
---|
9 | let (/) a b = (key a |-- table |-- key b)
|
---|
10 | let (//) a b = (key a |-- table |-- key b |-- table)
|
---|
11 |
|
---|
12 | let int toml path = get toml (path |-- int)
|
---|
13 |
|
---|
14 | let float toml path = get toml (path |-- float)
|
---|
15 |
|
---|
16 | let string toml path = get toml (path |-- string)
|
---|
17 |
|
---|
18 | let strings toml path = get toml (path |-- array |-- strings)
|
---|
19 |
|
---|
20 | let path toml path = match string toml path with Some s -> Some (Fpath.v s) | None -> None
|
---|
21 |
|
---|
22 | let paths toml path = match strings toml path with
|
---|
23 | Some ss -> Some (List.map Fpath.v ss) | None -> None
|
---|
Note:
See
TracBrowser
for help on using the repository browser.