mirror of
https://github.com/xmonad/xmonad-contrib.git
synced 2025-05-18 19:10:21 -07:00
X.U.ExtensibleConf: Perform 'add' before modifying in once(M)
This better matches the documentation. It is still, however, considered bad practice to rely on the order of these operations. `f` isn't meant to touch any extensible configuration. If it happens to do so anyway, it no longer loops. :-)
This commit is contained in:
parent
e0c7e35b3d
commit
3dbdc51158
@ -117,7 +117,7 @@ once :: forall a l. (Semigroup a, Typeable a)
|
||||
=> (XConfig l -> XConfig l) -- ^ 'XConfig' modification done only once
|
||||
-> a -- ^ configuration to add
|
||||
-> XConfig l -> XConfig l
|
||||
once f x c = add x $ maybe f (const id) (lookup @a c) c
|
||||
once f x c = maybe f (const id) (lookup @a c) $ add x c
|
||||
|
||||
-- | Config-time: Applicative (monadic) variant of 'once', useful if the
|
||||
-- 'XConfig' modification needs to do some 'IO' (e.g. create an
|
||||
@ -126,4 +126,4 @@ onceM :: forall a l m. (Applicative m, Semigroup a, Typeable a)
|
||||
=> (XConfig l -> m (XConfig l)) -- ^ 'XConfig' modification done only once
|
||||
-> a -- ^ configuration to add
|
||||
-> XConfig l -> m (XConfig l)
|
||||
onceM f x c = add x <$> maybe f (const pure) (lookup @a c) c
|
||||
onceM f x c = maybe f (const pure) (lookup @a c) $ add x c
|
||||
|
Loading…
x
Reference in New Issue
Block a user