Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Type-generic versions of lookupStr, together with lenses #2

Open
clord opened this issue Apr 6, 2016 · 0 comments
Open

Type-generic versions of lookupStr, together with lenses #2

clord opened this issue Apr 6, 2016 · 0 comments

Comments

@clord
Copy link
Member

clord commented Apr 6, 2016

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"
@clord clord changed the title Type-generic versions of lookupStr, etc Type-generic versions of lookupStr, together with lenses Apr 15, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant