diff options
| author | Josh Rahm <rahm@google.com> | 2021-11-12 11:06:37 -0700 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2022-10-09 12:19:45 -0600 |
| commit | 04d0ab42a39df36acfc84846cc122f0bb9786446 (patch) | |
| tree | 295aaf03057aa56a98148c9c7cdb6ae14404a490 /src/Internal/XPlus.hs | |
| parent | f4d1c466823c8a377b9bc8214bf7d586b6c03c6f (diff) | |
| download | rde-04d0ab42a39df36acfc84846cc122f0bb9786446.tar.gz rde-04d0ab42a39df36acfc84846cc122f0bb9786446.tar.bz2 rde-04d0ab42a39df36acfc84846cc122f0bb9786446.zip | |
Use XMonad's EtensibleState
Change the Marking to use XMonad's extensible state rather than
hand-rolling it myself. Allowed me to delete the XPlus monad.
Diffstat (limited to 'src/Internal/XPlus.hs')
| -rw-r--r-- | src/Internal/XPlus.hs | 53 |
1 files changed, 0 insertions, 53 deletions
diff --git a/src/Internal/XPlus.hs b/src/Internal/XPlus.hs deleted file mode 100644 index c546665..0000000 --- a/src/Internal/XPlus.hs +++ /dev/null @@ -1,53 +0,0 @@ -module Internal.XPlus where - -import Internal.Marking -import XMonad - --- The X Monad with additional information. Used for configuring the system. - -data XPlusState l = - XPlusState { - markContext :: MarkContext - , xConfig :: XConfig l - } - -data XPlus l a = XPlus (XPlusState l -> X (a, XPlusState l)) - -instance Functor (XPlus l) where - fmap fn (XPlus xfn) = - XPlus $ \st -> do - (a, b) <- xfn st - return (fn a, b) - -instance Applicative (XPlus l) where - pure = return - (<*>) afn aarg = do - fn <- afn - arg <- aarg - return (fn arg) - -instance Monad (XPlus l) where - -- (>>=) :: XPlus l a -> (a -> XPlus l b) -> XPlus l b - (>>=) (XPlus afn) bfn = do - XPlus $ \s0 -> do - (a, s1) <- afn s0 - let (XPlus xBFn) = bfn a - xBFn s1 - - return x = XPlus $ \s -> return (x, s) - -getXPlusState :: XPlus l (XPlusState l) -getXPlusState = XPlus $ \s -> return (s, s) - -getXConfig :: XPlus l (XConfig l) -getXConfig = xConfig <$> getXPlusState - -getMarkContext :: XPlus l MarkContext -getMarkContext = markContext <$> getXPlusState - -runXPlus :: MarkContext -> XConfig l -> XPlus l a -> X a -runXPlus markCtx cfg (XPlus fn) = do - fst <$> fn (XPlusState markCtx cfg) - -liftXPlus :: X a -> XPlus l a -liftXPlus xa = XPlus $ \s -> (\a -> (a, s)) <$> xa |