From 6769de07f7e06ddf6eea728bd7072ebfe6eff017 Mon Sep 17 00:00:00 2001 From: Daniel Wagner Date: Tue, 28 May 2013 03:39:09 +0200 Subject: use Data.Default wherever possible, and deprecate the things it replaces Ignore-this: 898458b1d2868a70dfb09faf473dc7aa darcs-hash:20130528013909-76d51-863278165b6f149c47b08b31b34e85ddcab19f1f.gz --- XMonad/Actions/GridSelect.hs | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'XMonad/Actions/GridSelect.hs') diff --git a/XMonad/Actions/GridSelect.hs b/XMonad/Actions/GridSelect.hs index e7ba0b7..1543644 100644 --- a/XMonad/Actions/GridSelect.hs +++ b/XMonad/Actions/GridSelect.hs @@ -27,6 +27,7 @@ module XMonad.Actions.GridSelect ( -- * Configuration GSConfig(..), + def, defaultGSConfig, TwoDPosition, buildDefaultGSConfig, @@ -167,7 +168,7 @@ import Data.Word (Word8) -- -- You can then define @gsconfig3@ which may be used in exactly the same manner as @gsconfig1@: -- --- > gsconfig3 = defaultGSConfig +-- > gsconfig3 = def -- > { gs_cellheight = 30 -- > , gs_cellwidth = 100 -- > , gs_navigate = myNavigation @@ -183,6 +184,11 @@ import Data.Word (Word8) -- -- <> +-- | The 'Default' instance gives a basic configuration for 'gridselect', with +-- the colorizer chosen based on the type. +-- +-- If you want to replace the 'gs_colorizer' field, use 'buildDefaultGSConfig' +-- instead of 'def' to avoid ambiguous type variables. data GSConfig a = GSConfig { gs_cellheight :: Integer, gs_cellwidth :: Integer, @@ -212,12 +218,12 @@ instance HasColorizer a where let getColor = if isFg then focusedBorderColor else normalBorderColor in asks $ flip (,) "black" . getColor . config --- | A basic configuration for 'gridselect', with the colorizer chosen based on the type. --- --- If you want to replace the 'gs_colorizer' field, use 'buildDefaultGSConfig' --- instead, to avoid ambiguous type variables. +instance HasColorizer a => Default (GSConfig a) where + def = buildDefaultGSConfig defaultColorizer + +{-# DEPRECATED defaultGSConfig "Use def (from Data.Default, and re-exported from XMonad.Actions.GridSelect) instead." #-} defaultGSConfig :: HasColorizer a => GSConfig a -defaultGSConfig = buildDefaultGSConfig defaultColorizer +defaultGSConfig = def type TwoDPosition = (Integer, Integer) -- cgit v1.2.3