mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-19 11:30:22 -07:00
X.U.Run: Add >&&> and >||>
This commit is contained in:
parent
0ca3ce7a18
commit
1b7fd6d8c9
@ -172,6 +172,8 @@
|
|||||||
|
|
||||||
- Added `toList` to easily lift a `String` to an `X Input`.
|
- Added `toList` to easily lift a `String` to an `X Input`.
|
||||||
|
|
||||||
|
- Added `>&&>` and `>||>` to glue together different inputs.
|
||||||
|
|
||||||
* `XMonad.Util.Parser`
|
* `XMonad.Util.Parser`
|
||||||
|
|
||||||
- Added the `gather`, `count`, `between`, `option`, `optionally`,
|
- Added the `gather`, `count`, `between`, `option`, `optionally`,
|
||||||
|
@ -60,6 +60,8 @@ module XMonad.Util.Run (
|
|||||||
-- ** General Combinators
|
-- ** General Combinators
|
||||||
(>->),
|
(>->),
|
||||||
(>-$),
|
(>-$),
|
||||||
|
(>&&>),
|
||||||
|
(>||>),
|
||||||
inWorkingDir,
|
inWorkingDir,
|
||||||
eval,
|
eval,
|
||||||
execute,
|
execute,
|
||||||
@ -361,6 +363,24 @@ infixr 3 >->
|
|||||||
(>-$) xi xs = xi >-> fmap mkDList xs
|
(>-$) xi xs = xi >-> fmap mkDList xs
|
||||||
infixr 3 >-$
|
infixr 3 >-$
|
||||||
|
|
||||||
|
-- | @a >&&> b@ glues the different inputs @a@ and @b@ by means of @&&@.
|
||||||
|
-- For example,
|
||||||
|
--
|
||||||
|
-- @
|
||||||
|
-- pure "do something" >&&> pure "do another thing"
|
||||||
|
-- @
|
||||||
|
--
|
||||||
|
-- would result in @do something && do another thing@ being executed by a
|
||||||
|
-- shell.
|
||||||
|
(>&&>) :: X Input -> X Input -> X Input
|
||||||
|
a >&&> b = comp3 <$> a <*> toInput " && " <*> b
|
||||||
|
infixr 2 >&&>
|
||||||
|
|
||||||
|
-- | Like '(>&&>)', but with @||@.
|
||||||
|
(>||>) :: X Input -> X Input -> X Input
|
||||||
|
a >||> b = comp3 <$> a <*> toInput " || " <*> b
|
||||||
|
infixr 2 >||>
|
||||||
|
|
||||||
-- | Spawn a completed input.
|
-- | Spawn a completed input.
|
||||||
proc :: X Input -> X ()
|
proc :: X Input -> X ()
|
||||||
proc xi = spawn =<< getInput xi
|
proc xi = spawn =<< getInput xi
|
||||||
@ -540,3 +560,6 @@ tryQuote :: String -> String
|
|||||||
tryQuote s = case dropWhile (== ' ') s of
|
tryQuote s = case dropWhile (== ' ') s of
|
||||||
'\'' : _ -> s
|
'\'' : _ -> s
|
||||||
_ -> "'" <> s <> "'"
|
_ -> "'" <> s <> "'"
|
||||||
|
|
||||||
|
comp3 :: (c -> d) -> (b -> c) -> (a -> b) -> a -> d
|
||||||
|
comp3 f g h = f . g . h
|
||||||
|
Loading…
x
Reference in New Issue
Block a user