optparse-simple 0.0.4 → 0.1.0
raw patch · 3 files changed
+66/−41 lines, 3 filesdep −eitherdep ~transformers
Dependencies removed: either
Dependency ranges changed: transformers
Files
- ChangeLog.md +5/−0
- optparse-simple.cabal +54/−34
- src/Options/Applicative/Simple.hs +7/−7
ChangeLog.md view
@@ -1,3 +1,8 @@+## 0.1.0++* Migrate from `EitherT` to `ExceptT`+ [#8](https://github.com/fpco/optparse-simple/issues/8)+ ## 0.0.4 * Support `--help` on subcommands
optparse-simple.cabal view
@@ -1,39 +1,59 @@-name: optparse-simple-version: 0.0.4-synopsis: Simple interface to optparse-applicative-description: Simple interface to optparse-applicative-license: BSD3-license-file: LICENSE-author: FP Complete-maintainer: chrisdone@fpcomplete.com-copyright: 2015 FP Complete-category: Options-build-type: Simple-cabal-version: >=1.8-extra-source-files: README.md ChangeLog.md+-- This file has been generated from package.yaml by hpack version 0.20.0.+--+-- see: https://github.com/sol/hpack+--+-- hash: 5955f8eb9562e24b8a68ecf2cb4c0674a9de7508574a10a44469d8e88bbebdb9 +name: optparse-simple+version: 0.1.0+synopsis: Simple interface to optparse-applicative+description: Please see the README at <https://www.stackage.org/package/optparse-simple>+category: Options+homepage: https://github.com/fpco/optparse-simple#readme+bug-reports: https://github.com/fpco/optparse-simple/issues+author: FP Complete+maintainer: chrisdone@fpcomplete.com+copyright: 2015-2017 FP Complete+license: BSD3+license-file: LICENSE+build-type: Simple+cabal-version: >= 1.10++extra-source-files:+ ChangeLog.md+ README.md++source-repository head+ type: git+ location: https://github.com/fpco/optparse-simple+ library- hs-source-dirs: src/- ghc-options: -Wall- exposed-modules: Options.Applicative.Simple- build-depends: base >= 4 && <5- , template-haskell- , transformers- , optparse-applicative- , gitrev- , either+ hs-source-dirs:+ src/+ ghc-options: -Wall+ build-depends:+ base >=4 && <5+ , gitrev+ , optparse-applicative+ , template-haskell+ , transformers >=0.4+ exposed-modules:+ Options.Applicative.Simple+ other-modules:+ Paths_optparse_simple+ default-language: Haskell2010 test-suite test- type: exitcode-stdio-1.0- main-is: Main.hs+ type: exitcode-stdio-1.0+ main-is: Main.hs+ hs-source-dirs:+ test+ ghc-options: -Wall build-depends:- base -any- , optparse-simple- , directory -any- , bytestring -any- hs-source-dirs: test- ghc-options: -Wall--source-repository head- type: git- location: https://github.com/fpco/optparse-simple+ base+ , bytestring+ , directory+ , optparse-simple+ other-modules:+ Paths_optparse_simple+ default-language: Haskell2010
src/Options/Applicative/Simple.hs view
@@ -39,7 +39,7 @@ ) where import Control.Monad.Trans.Class (lift)-import Control.Monad.Trans.Either+import Control.Monad.Trans.Except import Control.Monad.Trans.Writer import Data.Monoid import Data.Version@@ -59,7 +59,7 @@ -- ^ program description -> Parser a -- ^ global settings- -> EitherT b (Writer (Mod CommandFields b)) ()+ -> ExceptT b (Writer (Mod CommandFields b)) () -- ^ commands (use 'addCommand') -> IO (a,b) simpleOptions versionString h pd globalParser commandParser =@@ -98,7 +98,7 @@ -> String -- ^ title of command -> (a -> b) -- ^ constructor to wrap up command in common data type -> Parser a -- ^ command parser- -> EitherT b (Writer (Mod CommandFields b)) ()+ -> ExceptT b (Writer (Mod CommandFields b)) () addCommand cmd title constr inner = lift (tell (command cmd (info (constr <$> (helper <*> inner))@@ -128,9 +128,9 @@ -- ^ command string -> String -- ^ title of command- -> EitherT b (Writer (Mod CommandFields b)) ()+ -> ExceptT b (Writer (Mod CommandFields b)) () -- ^ sub-commands (use 'addCommand')- -> EitherT b (Writer (Mod CommandFields b)) ()+ -> ExceptT b (Writer (Mod CommandFields b)) () addSubCommands cmd title commandParser = addCommand cmd title@@ -160,7 +160,7 @@ simpleParser :: Parser a -- ^ common settings- -> EitherT b (Writer (Mod CommandFields b)) ()+ -> ExceptT b (Writer (Mod CommandFields b)) () -- ^ commands (use 'addCommand') -> Parser (a,b) simpleParser commonParser commandParser =@@ -171,6 +171,6 @@ help "Show this help text" config = (,) <$> commonParser <*>- case runWriter (runEitherT commandParser) of+ case runWriter (runExceptT commandParser) of (Right (),d) -> subparser d (Left b,_) -> pure b