Given a Parser a and a value of type a is it possible to generate the relevant command-line (in textual format)? (Basically, the exact reverse of what optparse-applicative is generally used for!)
For example, given something like...
data Args = {userName :: Text, userGroups :: Text }
parser :: Parser Args
parser = Args
<$> (strOption $ long "name")
<*> (many $ strOption $ long "group")
...how does one convert the following...
let args = Args { userName :: "testUser", userGroups :: ["system", "sudo"] }
...to...
--name=testUser --group=system --group=sudo
No, there is no way in general. The relevant bits are:
Since the
xs ofMultPandBindPare existentially quantified, the information about the suitablexs that could be used to produce yourais lost at runtime.