mirror of
https://github.com/xmonad/xmonad.git
synced 2025-05-19 08:30:21 -07:00
Merge pull request #337 from slotThe/lazy-lifted-boolean-ops
Make `(<&&>)` and `(<||>)` lazy in their second argument
This commit is contained in:
commit
b5b95e27ce
@ -68,6 +68,11 @@
|
||||
* Added `withUnfocused` function to `XMonad.Operations`, allowing for
|
||||
`X` operations to be applied to unfocused windows.
|
||||
|
||||
* Made `(<&&>)` and `(<||>)` non-strict in their right operand; i.e.,
|
||||
these operators now implement short-circuit evaluation so the right
|
||||
operand is evaluated only if the left operand does not suffice to
|
||||
determine the result.
|
||||
|
||||
## 0.15 (September 30, 2018)
|
||||
|
||||
* Reimplement `sendMessage` to deal properly with windowset changes made
|
||||
|
@ -61,11 +61,15 @@ infixr 3 <&&>, <||>
|
||||
|
||||
-- | '&&' lifted to a 'Monad'.
|
||||
(<&&>) :: Monad m => m Bool -> m Bool -> m Bool
|
||||
(<&&>) = liftM2 (&&)
|
||||
(<&&>) x y = ifM x y (pure False)
|
||||
|
||||
-- | '||' lifted to a 'Monad'.
|
||||
(<||>) :: Monad m => m Bool -> m Bool -> m Bool
|
||||
(<||>) = liftM2 (||)
|
||||
(<||>) x y = ifM x (pure True) y
|
||||
|
||||
-- | If-then-else lifted to a 'Monad'.
|
||||
ifM :: Monad m => m Bool -> m a -> m a -> m a
|
||||
ifM mb t f = mb >>= \b -> if b then t else f
|
||||
|
||||
-- | Return the window title.
|
||||
title :: Query String
|
||||
|
Loading…
x
Reference in New Issue
Block a user