From cbcd42dc83d7b5a2283826e9241197e96fceff86 Mon Sep 17 00:00:00 2001 From: Devin Mullins Date: Wed, 24 Sep 2014 19:15:09 +0000 Subject: [PATCH] X.C.Prime: add ifThenElse binding This is necessary for if-then-else support in the user's config. --- XMonad/Config/Prime.hs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/XMonad/Config/Prime.hs b/XMonad/Config/Prime.hs index 04f19852..2a617f59 100644 --- a/XMonad/Config/Prime.hs +++ b/XMonad/Config/Prime.hs @@ -87,6 +87,7 @@ module Prelude, -- Regular people shouldn't need to know about these. Prime, (>>), +ifThenElse, -- * Example config -- $example @@ -138,6 +139,12 @@ type Prime l l' = XConfig l -> IO (XConfig l') (>>) :: Prime l l' -> Prime l' l'' -> Prime l l'' (>>) x y c = (P.>>=) (x c) y +-- | Because of RebindableSyntax, this is necessary to enable you to use +-- if-then-else expressions. No need to call it directly. +ifThenElse :: Bool -> a -> a -> a +ifThenElse True a _ = a +ifThenElse False _ b = b + -- | This is the xmonad main function. It passes 'XMonad.Config.def' (the -- default 'XConfig') into your do-block, takes the modified config out of your -- do-block, and then runs xmonad.