Skip to content

eklavya/tomladris

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

tomladris

TOML parser for Idris

OMG that's poor, poor choice for a project name!!

Yeah. I pronounce it 'to'-'m'-'la'-'dris'.

State

Incomplete and buggy. Your help and contribution are much needed :)

Usage

Install make install then include by -p tomladris

parseToml : String  -> SortedMap String TomlValue

Give it a toml string and it will give back a map of all keys with their values.

Types

data TomlValue =   TComment String
                 | TString String
                 | TInteger Integer
                 | TDouble Double
                 | TBoolean Bool
                 | TArray (List TomlValue)
                 | TTableKV TomlValue TomlValue

Example

title="TOML Example"
[owner]
name="Tom Preston-Werner"
[database]
server="192.168.1.1"
ports=[8001,8001,8002]
connection_max=5000
enabled=true
testing=0.23
[servers.alpha]
ip="10.0.0.1"
dc="eqdc10"
[servers.beta]
ip="10.0.0.2"
dc="eqdc10"

In this toml snippet,

let tomlMap = parseToml tomlString

-- title
lookup "title" tomlMap
-- Just (TString "TOML Example")

-- database.ports
lookup "database.ports" tomlMap
-- Just (TArray [TInteger 8001, TInteger 8001, TInteger 8002])

-- servers.beta.ip
lookup "servers.beta.ip" tomlMap
-- Just (TString "10.0.0.2")

About

TOML parser for Idris

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published