You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi, I wanted to use a sum type in my command line parsing, and I came up with this:
dataFrontendLanguage=Typescript | Swiftderiving (Eq, Show, Read, Generic)
instanceParseFieldFrontendLanguageinstanceParseRecordFrontendLanguageinstanceParseFieldsFrontendLanguagedataTasks=GenerateRoutes{language::FrontendLanguage<?>"Options are: Typescript, Swift"
, frontendRepo::FilePath<?>"Path to the root of the frontend repo"}deriving (Generic, Show)
instanceParseRecordTasks
It works fine in the success case, though there isn't a specific error message if you provide an invalid sum type, just the generic help text.
Is this the best way to do this? I couldn't find anything in the documentation about this (could have missed it, though). If it is the best way, I'll submit a PR to document this use-case in the Haddocks if you'd like.
The text was updated successfully, but these errors were encountered:
Yeah, that's about the best you can do within this library. You can do better if you use the underlying optparse-applicative library to define the ParseFields instance for FrontendLanguage because then you can define it to be something like ( --typescript | --swift )
Hi, I wanted to use a sum type in my command line parsing, and I came up with this:
It works fine in the success case, though there isn't a specific error message if you provide an invalid sum type, just the generic help text.
Is this the best way to do this? I couldn't find anything in the documentation about this (could have missed it, though). If it is the best way, I'll submit a PR to document this use-case in the Haddocks if you'd like.
The text was updated successfully, but these errors were encountered: