@@ -13,7 +13,7 @@ module Options.Applicative.Complicated
1313 ) where
1414
1515import Control.Monad.Trans.Class (lift )
16- import Control.Monad.Trans.Either
16+ import Control.Monad.Trans.Except
1717import Control.Monad.Trans.Writer
1818import Data.Monoid
1919import Data.Version
@@ -42,7 +42,7 @@ complicatedOptions
4242 -> Maybe (ParserFailure ParserHelp -> [String ] -> IO (a ,(b ,a )))
4343 -- ^ optional handler for parser failure; 'handleParseResult' is called by
4444 -- default
45- -> EitherT b (Writer (Mod CommandFields (b ,a ))) ()
45+ -> ExceptT b (Writer (Mod CommandFields (b ,a ))) ()
4646 -- ^ commands (use 'addCommand')
4747 -> IO (a ,b )
4848complicatedOptions numericVersion versionString numericHpackVersion h pd footerStr commonParser mOnFailure commandParser =
@@ -82,7 +82,7 @@ addCommand :: String -- ^ command string
8282 -> (a -> b ) -- ^ constructor to wrap up command in common data type
8383 -> Parser c -- ^ common parser
8484 -> Parser a -- ^ command parser
85- -> EitherT b (Writer (Mod CommandFields (b ,c ))) ()
85+ -> ExceptT b (Writer (Mod CommandFields (b ,c ))) ()
8686addCommand cmd title footerStr constr =
8787 addCommand' cmd title footerStr (\ a c -> (constr a,c))
8888
@@ -97,9 +97,9 @@ addSubCommands
9797 -- ^ footer of command help
9898 -> Parser c
9999 -- ^ common parser
100- -> EitherT b (Writer (Mod CommandFields (b ,c ))) ()
100+ -> ExceptT b (Writer (Mod CommandFields (b ,c ))) ()
101101 -- ^ sub-commands (use 'addCommand')
102- -> EitherT b (Writer (Mod CommandFields (b ,c ))) ()
102+ -> ExceptT b (Writer (Mod CommandFields (b ,c ))) ()
103103addSubCommands cmd title footerStr commonParser commandParser =
104104 addCommand' cmd
105105 title
@@ -115,7 +115,7 @@ addCommand' :: String -- ^ command string
115115 -> (a -> c -> (b ,c )) -- ^ constructor to wrap up command in common data type
116116 -> Parser c -- ^ common parser
117117 -> Parser a -- ^ command parser
118- -> EitherT b (Writer (Mod CommandFields (b ,c ))) ()
118+ -> ExceptT b (Writer (Mod CommandFields (b ,c ))) ()
119119addCommand' cmd title footerStr constr commonParser inner =
120120 lift (tell (command cmd
121121 (info (constr <$> inner <*> commonParser)
@@ -128,13 +128,13 @@ complicatedParser
128128 -- ^ metavar for the sub-command
129129 -> Parser a
130130 -- ^ common settings
131- -> EitherT b (Writer (Mod CommandFields (b ,a ))) ()
131+ -> ExceptT b (Writer (Mod CommandFields (b ,a ))) ()
132132 -- ^ commands (use 'addCommand')
133133 -> Parser (a ,(b ,a ))
134134complicatedParser commandMetavar commonParser commandParser =
135135 (,) <$>
136136 commonParser <*>
137- case runWriter (runEitherT commandParser) of
137+ case runWriter (runExceptT commandParser) of
138138 (Right () ,d) -> hsubparser' commandMetavar d
139139 (Left b,_) -> pure (b,mempty )
140140
0 commit comments