mirror of
https://github.com/xmonad/xmonad.git
synced 2025-05-19 08:30:21 -07:00
X.ManageHook: Define infix operators in an infix way
As discussed in #401, while hlint complains on a definition like (<||>) x y = ifM x (pure True) y because it could be eta reduced, actually doing that and writing (<||>) x = ifM x (pure True) feels a bit awkward. The solution is to always actually define these kinds of infix operators in an infix way; i.e., we write x <||> y = ifM x (pure True) y instead. For the sake of consistency, it now seems prudent to define all infix operators in this way (with exceptions for literal aliases, like `(<+>) = mappend`). Related: https://github.com/xmonad/xmonad/pull/401
This commit is contained in:
parent
45a89130d9
commit
521e8356fc
@ -58,11 +58,11 @@ infixr 3 <&&>, <||>
|
|||||||
|
|
||||||
-- | '&&' lifted to a 'Monad'.
|
-- | '&&' lifted to a 'Monad'.
|
||||||
(<&&>) :: Monad m => m Bool -> m Bool -> m Bool
|
(<&&>) :: Monad m => m Bool -> m Bool -> m Bool
|
||||||
(<&&>) x y = ifM x y (pure False)
|
x <&&> y = ifM x y (pure False)
|
||||||
|
|
||||||
-- | '||' lifted to a 'Monad'.
|
-- | '||' lifted to a 'Monad'.
|
||||||
(<||>) :: Monad m => m Bool -> m Bool -> m Bool
|
(<||>) :: Monad m => m Bool -> m Bool -> m Bool
|
||||||
(<||>) x = ifM x (pure True)
|
x <||> y = ifM x (pure True) y
|
||||||
|
|
||||||
-- | If-then-else lifted to a 'Monad'.
|
-- | If-then-else lifted to a 'Monad'.
|
||||||
ifM :: Monad m => m Bool -> m a -> m a -> m a
|
ifM :: Monad m => m Bool -> m a -> m a -> m a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user