From 521e8356fc17a9dfb3f78c975aa6ee0523fce7ad Mon Sep 17 00:00:00 2001 From: Tony Zorman Date: Wed, 29 Jun 2022 09:36:51 +0200 Subject: [PATCH] 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 --- src/XMonad/ManageHook.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/XMonad/ManageHook.hs b/src/XMonad/ManageHook.hs index 5e59d1b..b0628d4 100644 --- a/src/XMonad/ManageHook.hs +++ b/src/XMonad/ManageHook.hs @@ -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