From 88d9c4a76e27ddee2170bb21e90e0f0fcf77b44c Mon Sep 17 00:00:00 2001 From: defanor Date: Mon, 4 Dec 2017 19:14:06 +0300 Subject: Introduce the omitNamedOptions option It is nice to omit them, but may lead to ambiguity -- so better to provide a safer option. --- README.md | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 898bb9e..bcefff4 100644 --- a/README.md +++ b/README.md @@ -14,9 +14,10 @@ e.g. [optparse-generic](https://hackage.haskell.org/package/optparse-generic), but the aim here is to handle more or less arbitrary types. -Warning: it is currently possible to run into ambiguity by defining a -recursive structure with optional named elements. Unit type can be -used to avoid that, see the `RecursiveRecordMaybe` test. +Warning: it is possible to run into ambiguity by defining a recursive +structure with optional named elements while using default options. +Unit type can be used to avoid that, or `omitNamedOptions` can be +disabled. Not production-ready yet, merely a prototype. @@ -32,7 +33,7 @@ Input { something = Nothing , fooBar2 = Bar} ``` -With the default modifiers, its serialized version should look like +With the default options, its serialized version should look like this: ```haskell @@ -45,9 +46,11 @@ What would look like this in a shell: --foobar foo 1 'a string' bar ``` -A more verbose version can be produced and parsed with -`alwaysUseSelName = True`: +More verbose versions can be produced and parsed with +`alwaysUseSelName = True` and/or `omitNamedOptions = False`: ```sh --foobar foo --arg1 1 --arg2 'a string' --foobar2 bar +nothing just foo 1 'a string' bar +--something nothing --foobar just foo --arg1 1 --arg2 'a string' --foobar2 bar ``` -- cgit v1.2.3