Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Replace (&) with (<>) everywhere (fixes #37).

  • Loading branch information...
commit 01309607832b473636a0b8a09f68f1ed1d3b5d55 1 parent 45d3954
@pcapriotti authored
View
6 Options/Applicative/BashCompletion.hs
@@ -23,11 +23,11 @@ bashCompletionParser parser pprefs = complParser
complParser = asum
[ failure <$>
( bashCompletionQuery parser pprefs
- <$> (many . strOption) (long "bash-completion-word" & internal)
- <*> option (long "bash-completion-index" & internal) )
+ <$> (many . strOption) (long "bash-completion-word" <> internal)
+ <*> option (long "bash-completion-index" <> internal) )
, failure <$>
(bashCompletionScript <$>
- strOption (long "bash-completion-script" & internal)) ]
+ strOption (long "bash-completion-script" <> internal)) ]
bashCompletionQuery :: Parser a -> ParserPrefs -> [String] -> Int -> String -> IO [String]
bashCompletionQuery parser pprefs ws i _ = case runCompletion compl pprefs of
View
13 Options/Applicative/Builder.hs
@@ -12,8 +12,8 @@ module Options.Applicative.Builder (
--
-- > out = strOption
-- > ( long "output"
- -- > & short 'o'
- -- > & metavar "FILENAME" )
+ -- > <> short 'o'
+ -- > <> metavar "FILENAME" )
--
-- creates a parser for an option called \"output\".
subparser,
@@ -47,6 +47,7 @@ module Options.Applicative.Builder (
completer,
idm,
(&),
+ (<>),
-- * Readers
--
@@ -73,7 +74,7 @@ module Options.Applicative.Builder (
) where
import Control.Applicative (pure, (<|>))
-import Data.Monoid (Monoid (..))
+import Data.Monoid (Monoid (..), (<>))
import Options.Applicative.Builder.Completer
import Options.Applicative.Builder.Arguments
@@ -170,7 +171,7 @@ completer f = fieldMod $ modCompleter (`mappend` f)
subparser :: Mod CommandFields a -> Parser a
subparser m = mkParser d g rdr
where
- Mod f d g = m & metavar "COMMAND"
+ Mod f d g = m <> metavar "COMMAND"
CommandFields cmds = f (CommandFields [])
rdr = CmdReader (map fst cmds) (`lookup` cmds)
-- | Builder for a flag parser.
@@ -220,11 +221,11 @@ nullOption m = mkParser d g rdr
-- | Builder for an option taking a 'String' argument.
strOption :: Mod OptionFields String -> Parser String
-strOption m = nullOption $ reader str & m
+strOption m = nullOption $ reader str <> m
-- | Builder for an option using the 'auto' reader.
option :: Read a => Mod OptionFields a -> Parser a
-option m = nullOption $ reader auto & m
+option m = nullOption $ reader auto <> m
-- | Modifier for 'ParserInfo'.
newtype InfoMod a = InfoMod
View
14 Options/Applicative/Extra.hs
@@ -28,13 +28,13 @@ import Options.Applicative.Types
helper :: Parser (a -> a)
helper = nullOption
( long "help"
- & reader (const (Left ShowHelpText))
- & noArgError ShowHelpText
- & short 'h'
- & help "Show this help text"
- & value id
- & metavar ""
- & hidden )
+ <> reader (const (Left ShowHelpText))
+ <> noArgError ShowHelpText
+ <> short 'h'
+ <> help "Show this help text"
+ <> value id
+ <> metavar ""
+ <> hidden )
-- | Run a program description.
--
View
26 tests/Examples/Cabal.hs
@@ -39,13 +39,13 @@ parser = runA $ proc () -> do
( command "install"
(info installParser
(progDesc "Installs a list of packages"))
- & command "update"
+ <> command "update"
(info updateParser
(progDesc "Updates list of known packages"))
- & command "configure"
+ <> command "configure"
(info configureParser
(progDesc "Prepare to build the package"))
- & command "build"
+ <> command "build"
(info buildParser
(progDesc "Make this package ready for installation")) ) -< ()
A helper -< Args opts cmds
@@ -54,10 +54,10 @@ commonOpts :: Parser CommonOpts
commonOpts = CommonOpts
<$> option
( short 'v'
- & long "verbose"
- & metavar "LEVEL"
- & help "Set verbosity to LEVEL"
- & value 0 )
+ <> long "verbose"
+ <> metavar "LEVEL"
+ <> help "Set verbosity to LEVEL"
+ <> value 0 )
installParser :: Parser Command
installParser = runA $ proc () -> do
@@ -86,12 +86,12 @@ configureOpts :: Parser ConfigureOpts
configureOpts = runA $ proc () -> do
tests <- (asA . switch)
( long "enable-tests"
- & help "Enable compilation of test suites" ) -< ()
+ <> help "Enable compilation of test suites" ) -< ()
flags <- (asA . many . strOption)
( short 'f'
- & long "flags"
- & metavar "FLAGS"
- & help "Enable the given flag" ) -< ()
+ <> long "flags"
+ <> metavar "FLAGS"
+ <> help "Enable the given flag" ) -< ()
returnA -< ConfigureOpts tests flags
buildParser :: Parser Command
@@ -103,8 +103,8 @@ buildOpts :: Parser BuildOpts
buildOpts = runA $ proc () -> do
bdir <- (asA . strOption)
( long "builddir"
- & metavar "DIR"
- & value "dist" ) -< ()
+ <> metavar "DIR"
+ <> value "dist" ) -< ()
returnA -< BuildOpts bdir
pinfo :: ParserInfo Args
View
2  tests/Examples/Commands.hs
@@ -16,7 +16,7 @@ sample = subparser
( command "hello"
(info hello
(progDesc "Print greeting"))
- & command "goodbye"
+ <> command "goodbye"
(info (pure Goodbye)
(progDesc "Say goodbye"))
)
View
10 tests/Examples/Hello.hs
@@ -11,11 +11,11 @@ sample :: Parser Sample
sample = Sample
<$> strOption
( long "hello"
- & metavar "TARGET"
- & help "Target for the greeting" )
+ <> metavar "TARGET"
+ <> help "Target for the greeting" )
<*> switch
( long "quiet"
- & help "Whether to be quiet" )
+ <> help "Whether to be quiet" )
greet :: Sample -> IO ()
greet (Sample h False) = putStrLn $ "Hello, " ++ h
@@ -27,5 +27,5 @@ main = execParser opts >>= greet
opts :: ParserInfo Sample
opts = info (sample <**> helper)
( fullDesc
- & progDesc "Print a greeting for TARGET"
- & header "hello - a test for optparse-applicative" )
+ <> progDesc "Print a greeting for TARGET"
+ <> header "hello - a test for optparse-applicative" )
View
24 tests/Tests.hs
@@ -87,9 +87,9 @@ case_alts = do
case_show_default :: Assertion
case_show_default = do
let p = option ( short 'n'
- & help "set count"
- & value (0 :: Int)
- & showDefault)
+ <> help "set count"
+ <> value (0 :: Int)
+ <> showDefault)
i = info (p <**> helper) idm
result = run i ["--help"]
case result of
@@ -114,19 +114,19 @@ case_alt_help = do
let p = p1 <|> p2 <|> p3
p1 = (Just . Left)
<$> strOption ( long "virtual-machine"
- & metavar "VM"
- & help "Virtual machine name" )
+ <> metavar "VM"
+ <> help "Virtual machine name" )
p2 = (Just . Right)
<$> strOption ( long "cloud-service"
- & metavar "CS"
- & help "Cloud service name" )
+ <> metavar "CS"
+ <> help "Cloud service name" )
p3 = flag' Nothing ( long "dry-run" )
i = info (p <**> helper) idm
checkHelpText "alt" i ["--help"]
case_nested_commands :: Assertion
case_nested_commands = do
- let p3 = strOption (short 'a' & metavar "A")
+ let p3 = strOption (short 'a'<> metavar "A")
p2 = subparser (command "b" (info p3 idm))
p1 = subparser (command "c" (info p2 idm))
i = info (p1 <**> helper) idm
@@ -167,8 +167,8 @@ case_ambiguous = do
case_completion :: Assertion
case_completion = do
let p = (,)
- <$> strOption (long "foo" & value "")
- <*> strOption (long "bar" & value "")
+ <$> strOption (long "foo"<> value "")
+ <*> strOption (long "bar"<> value "")
i = info p idm
result = run i ["--bash-completion-index", "0"]
case result of
@@ -195,8 +195,8 @@ case_issue_19 :: Assertion
case_issue_19 = do
let p = option
( short 'x'
- & reader (fmap Just . str)
- & value Nothing )
+ <> reader (fmap Just . str)
+ <> value Nothing )
i = info (p <**> helper) idm
result = run i ["-x", "foo"]
case result of
Please sign in to comment.
Something went wrong with that request. Please try again.