A generic method to call in cases where the type is known to the compiler already, perhaps called simply query or perhaps even an operator. Also, it should have the Toml document as it's first argument for easy currying. (in fact, not sure why I put the Toml argument second everywhere... perhaps consistency with Data.Map?)
query :: Toml -> TomlPath -> Maybe a
And also one that has a default value provided:
queryDef :: Toml -> a -> TomlPath -> a
Then users can do something like:
let webserverASection = queryDef config Toml.empty "webservers.serverA"
let webserverSocket = queryDef webserverASection 8080 "port"
A generic method to call in cases where the type is known to the compiler already, perhaps called simply
query
or perhaps even an operator. Also, it should have theToml
document as it's first argument for easy currying. (in fact, not sure why I put theToml
argument second everywhere... perhaps consistency withData.Map
?)And also one that has a default value provided:
Then users can do something like: