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:
Tony Zorman 2022-06-29 09:36:51 +02:00
parent 45a89130d9
commit 521e8356fc

View File

@ -58,11 +58,11 @@ infixr 3 <&&>, <||>
-- | '&&' lifted to a 'Monad'.
(<&&>) :: 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'.
(<||>) :: 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'.
ifM :: Monad m => m Bool -> m a -> m a -> m a