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

Shared arguments across subcommands #79

Open
GregorySchwartz opened this issue Jun 7, 2021 · 1 comment
Open

Shared arguments across subcommands #79

GregorySchwartz opened this issue Jun 7, 2021 · 1 comment

Comments

@GregorySchwartz
Copy link

Is something like this possible, with shared arguments across subcommands?

@Gabriella439
Copy link
Owner

@GregorySchwartz: Not easily with the current API. I think what this package would be missing is something like the :. type from the postgresql-simple package with an instance of the form:

instance (ParseRecord a, ParseRecord b) => ParseRecord (a :. b)

… because if you had that then you could do something like:

data UniqueOptions = SumPayments { user :: Text } | ListUsersSeen | SumQueries

data SharedOptions = SharedOptions{ start :: Text, end :: Text }

main :: IO ()
main = do
    (uniqueOptions :. sharedOptions) <- getRecord "Example"

    

I haven't thought through all of the details for that, though

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

2 participants