Is it possible to have both positional and named CLI options using optparse-generic?

Viewed 29

I'd like to make a CLI using the Haskell library optparse-generic. The documentation shows an example for positional arguments, and another for options (e.g. --flag=True), but I can't figure out how to combine the two. I've tried something like this:

data CLI = CLI Options Files deriving (Generic, Show)

data Files = Files [String] deriving (Generic, Show)

data Options = Options { colorMap :: String <?> "Color mapping to use."
                       } deriving (Generic, Show)

instance ParseRecord CLI

But that doesn't seem to be legal.

0 Answers
Related