Simplify instance declarations

Many instance declarations can now be derived either by DerivingVia or
GeneralizedNewtypeDeriving.
This commit is contained in:
Tony Zorman
2022-11-19 09:10:57 +01:00
parent 5d0013ef53
commit b96bb908db
4 changed files with 20 additions and 47 deletions

View File

@@ -1,3 +1,4 @@
{-# LANGUAGE DerivingVia #-}
-----------------------------------------------------------------------------
-- |
-- Module : XMonad.Hooks.WorkspaceHistory
@@ -63,14 +64,9 @@ import qualified XMonad.Util.ExtensibleState as XS
newtype WorkspaceHistory = WorkspaceHistory
{ history :: [(ScreenId, WorkspaceId)] -- ^ Workspace Screens in
-- reverse-chronological order.
} deriving (Read, Show)
-- @ScreenId@ is not an instance of NFData, but is a newtype on @Int@. @seq@
-- is enough for forcing it. This requires us to provide an instance.
instance NFData WorkspaceHistory where
rnf (WorkspaceHistory hist) =
let go = liftRnf2 rwhnf rwhnf
in liftRnf go hist
}
deriving (Read, Show)
deriving NFData via [(Int, WorkspaceId)]
instance ExtensionClass WorkspaceHistory where
initialValue = WorkspaceHistory []