diff options
| author | Josh Rahm <rahm@google.com> | 2022-03-28 10:26:20 -0600 |
|---|---|---|
| committer | Josh Rahm <joshuarahm@gmail.com> | 2022-10-09 12:19:45 -0600 |
| commit | db91a7d1f64d244106144cfb9e8d26c3d8aaccbe (patch) | |
| tree | 0f4229b88df38d7c8e7d762c2c19007e7c01a442 /src/Internal | |
| parent | 5c5db5090ea1c8c62cdd04ab18ee2a3a12cb4c40 (diff) | |
| download | rde-db91a7d1f64d244106144cfb9e8d26c3d8aaccbe.tar.gz rde-db91a7d1f64d244106144cfb9e8d26c3d8aaccbe.tar.bz2 rde-db91a7d1f64d244106144cfb9e8d26c3d8aaccbe.zip | |
Add NoPersist and use it in Logger.hs
Diffstat (limited to 'src/Internal')
| -rw-r--r-- | src/Internal/NoPersist.hs | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/Internal/NoPersist.hs b/src/Internal/NoPersist.hs new file mode 100644 index 0000000..a67e649 --- /dev/null +++ b/src/Internal/NoPersist.hs @@ -0,0 +1,23 @@ +-- Module for not persisting XMonad state. To be used with ExtensibleState +-- for data types that cannot be persisted. +module Internal.NoPersist where + +import Data.Default (Default, def) +import Data.Typeable + +import XMonad (ExtensionClass(..)) + +newtype NoPersist a = NoPersist a + deriving (Typeable) + +instance Show (NoPersist a) where + show (NoPersist _) = show () + +instance (Default a) => Read (NoPersist a) where + readsPrec i s = map (\(_, s) -> (NoPersist def, s)) (readsPrec i s :: [((), String)]) + +instance (Default a) => Default (NoPersist a) where + def = NoPersist def + +instance (Default a, Typeable a) => ExtensionClass (NoPersist a) where + initialValue = NoPersist def |