Skip to content

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

@clord

Description

@clord

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions