From 7f62b27a5adf65b21577c461a42c0f33f2049751 Mon Sep 17 00:00:00 2001 From: ndwarshuis Date: Sat, 19 Jun 2021 00:54:01 -0400 Subject: [PATCH] REF apply latest stylish formatting --- .stylish-haskell.yaml | 111 ++++++++++++++++++-- bin/xmobar.hs | 2 +- bin/xmonad.hs | 14 +-- lib/XMonad/Internal/Command/DMenu.hs | 2 +- lib/XMonad/Internal/Command/Desktop.hs | 2 +- lib/XMonad/Internal/Concurrent/ACPIEvent.hs | 2 +- lib/XMonad/Internal/DBus/Screensaver.hs | 2 +- lib/Xmobar/Plugins/Bluetooth.hs | 4 +- lib/Xmobar/Plugins/Device.hs | 2 +- lib/Xmobar/Plugins/Screensaver.hs | 2 +- lib/Xmobar/Plugins/VPN.hs | 2 +- 11 files changed, 119 insertions(+), 26 deletions(-) diff --git a/.stylish-haskell.yaml b/.stylish-haskell.yaml index e877d08..26770c1 100644 --- a/.stylish-haskell.yaml +++ b/.stylish-haskell.yaml @@ -15,16 +15,91 @@ steps: # # true. # add_language_pragma: true - # Format record definitions - - records: {} + # Format module header + # + # Currently, this option is not configurable and will format all exports and + # module declarations to minimize diffs + # + # - module_header: + # # How many spaces use for indentation in the module header. + # indent: 4 + # + # # Should export lists be sorted? Sorting is only performed within the + # # export section, as delineated by Haddock comments. + # sort: true + # + # # See `separate_lists` for the `imports` step. + # separate_lists: true + + # Format record definitions. This is disabled by default. + # + # You can control the layout of record fields. The only rules that can't be configured + # are these: + # + # - "|" is always aligned with "=" + # - "," in fields is always aligned with "{" + # - "}" is likewise always aligned with "{" + # + # - records: + # # How to format equals sign between type constructor and data constructor. + # # Possible values: + # # - "same_line" -- leave "=" AND data constructor on the same line as the type constructor. + # # - "indent N" -- insert a new line and N spaces from the beginning of the next line. + # equals: "indent 2" + # + # # How to format first field of each record constructor. + # # Possible values: + # # - "same_line" -- "{" and first field goes on the same line as the data constructor. + # # - "indent N" -- insert a new line and N spaces from the beginning of the data constructor + # first_field: "indent 2" + # + # # How many spaces to insert between the column with "," and the beginning of the comment in the next line. + # field_comment: 2 + # + # # How many spaces to insert before "deriving" clause. Deriving clauses are always on separate lines. + # deriving: 2 + # + # # How many spaces to insert before "via" clause counted from indentation of deriving clause + # # Possible values: + # # - "same_line" -- "via" part goes on the same line as "deriving" keyword. + # # - "indent N" -- insert a new line and N spaces from the beginning of "deriving" keyword. + # via: "indent 2" + # + # # Sort typeclass names in the "deriving" list alphabetically. + # sort_deriving: true + # + # # Wheter or not to break enums onto several lines + # # + # # Default: false + # break_enums: false + # + # # Whether or not to break single constructor data types before `=` sign + # # + # # Default: true + # break_single_constructors: true + # + # # Whether or not to curry constraints on function. + # # + # # E.g: @allValues :: Enum a => Bounded a => Proxy a -> [a]@ + # # + # # Instead of @allValues :: (Enum a, Bounded a) => Proxy a -> [a]@ + # # + # # Default: false + # curried_context: false # Align the right hand side of some elements. This is quite conservative # and only applies to statements where each element occupies a single - # line. All default to true. + # line. + # Possible values: + # - always - Always align statements. + # - adjacent - Align statements that are on adjacent lines in groups. + # - never - Never align statements. + # All default to always. - simple_align: - cases: true - top_level_patterns: true - records: true + cases: always + top_level_patterns: always + records: always + multi_way_if: always # Import cleanup - imports: @@ -76,6 +151,11 @@ steps: # > import qualified Data.List as List # > (concat, foldl, foldr, head, init, last, length) # + # - repeat: Repeat the module name to align the import list. + # + # > import qualified Data.List as List (concat, foldl, foldr, head) + # > import qualified Data.List as List (init, last, length) + # # Default: after_alias list_align: after_alias @@ -178,6 +258,22 @@ steps: # Default: false space_surround: false + # Enabling this argument will use the new GHC lib parse to format imports. + # + # This currently assumes a few things, it will assume that you want post + # qualified imports. It is also not as feature complete as the old + # imports formatting. + # + # It does not remove redundant lines or merge lines. As such, the full + # feature scope is still pending. + # + # It _is_ however, a fine alternative if you are using features that are + # not parseable by haskell src extensions and you're comfortable with the + # presets. + # + # Default: false + ghc_lib_parser: false + # Language pragmas - language_pragmas: # We can generate different styles of language pragma lists. @@ -225,9 +321,6 @@ steps: # simple_align but is a bit less conservative. # - squash: {} -# A common indentation setting. Different steps take this into account. -indent: 4 - # A common setting is the number of columns (parts of) code will be wrapped # to. Different steps take this into account. # diff --git a/bin/xmobar.hs b/bin/xmobar.hs index 0348bde..8ccb615 100644 --- a/bin/xmobar.hs +++ b/bin/xmobar.hs @@ -19,10 +19,10 @@ import Xmobar.Plugins.IntelBacklight import Xmobar.Plugins.Screensaver import Xmobar.Plugins.VPN -import Xmobar import XMonad (getXMonadDir) import XMonad.Hooks.DynamicLog (wrap, xmobarColor) import qualified XMonad.Internal.Theme as T +import Xmobar sep :: String sep = xmobarColor T.backdropFgColor "" " : " diff --git a/bin/xmonad.hs b/bin/xmonad.hs index 5deb25b..51d4611 100644 --- a/bin/xmonad.hs +++ b/bin/xmonad.hs @@ -37,8 +37,8 @@ import XMonad.Hooks.DynamicLog import XMonad.Hooks.EwmhDesktops import XMonad.Hooks.ManageDocks import XMonad.Hooks.ManageHelpers -import XMonad.Internal.Command.Desktop import XMonad.Internal.Command.DMenu +import XMonad.Internal.Command.Desktop import XMonad.Internal.Command.Power import XMonad.Internal.Concurrent.ACPIEvent import XMonad.Internal.Concurrent.ClientMessage @@ -57,8 +57,8 @@ import XMonad.Layout.Tabbed import qualified XMonad.Operations as O import qualified XMonad.StackSet as W import XMonad.Util.Cursor -import qualified XMonad.Util.ExtensibleState as E import XMonad.Util.EZConfig +import qualified XMonad.Util.ExtensibleState as E import XMonad.Util.NamedActions import XMonad.Util.WorkspaceCompare @@ -444,13 +444,13 @@ mkNamedSubmap c KeyGroup { kgHeader = h, kgBindings = b } = <$> b data KeyBinding a = KeyBinding - { kbSyms :: String - , kbDesc :: String + { kbSyms :: String + , kbDesc :: String , kbAction :: a } data KeyGroup a = KeyGroup - { kgHeader :: String + { kgHeader :: String , kgBindings :: [KeyBinding a] } @@ -469,7 +469,7 @@ filterExternal = fmap go go k@KeyGroup { kgBindings = bs } = k { kgBindings = mapMaybe go' bs } go' k@KeyBinding { kbAction = Installed x } = Just $ k { kbAction = x } - go' _ = Nothing + go' _ = Nothing externalBindings :: ThreadState -> [KeyGroup (IO MaybeX)] externalBindings ts = @@ -508,7 +508,7 @@ externalBindings ts = , KeyBinding "" "volume up" runVolumeUp , KeyBinding "" "volume mute" runVolumeMute ] - + , KeyGroup "System" [ KeyBinding "M-." "backlight up" $ noCheck runIncBacklight , KeyBinding "M-," "backlight down" $ noCheck runDecBacklight diff --git a/lib/XMonad/Internal/Command/DMenu.hs b/lib/XMonad/Internal/Command/DMenu.hs index bc17e56..2fe1694 100644 --- a/lib/XMonad/Internal/Command/DMenu.hs +++ b/lib/XMonad/Internal/Command/DMenu.hs @@ -17,8 +17,8 @@ import Control.Monad.Reader import Graphics.X11.Types +import System.Directory (XdgDirectory (..), getXdgDirectory) import System.IO -import System.Directory (getXdgDirectory, XdgDirectory(..)) import XMonad.Core hiding (spawn) import XMonad.Internal.Process diff --git a/lib/XMonad/Internal/Command/Desktop.hs b/lib/XMonad/Internal/Command/Desktop.hs index 3436067..fce7c30 100644 --- a/lib/XMonad/Internal/Command/Desktop.hs +++ b/lib/XMonad/Internal/Command/Desktop.hs @@ -241,7 +241,7 @@ runDesktopCapture = runFlameshot "full" runScreenCapture :: IO MaybeX runScreenCapture = runFlameshot "screen" - + runCaptureBrowser :: IO MaybeX runCaptureBrowser = runIfInstalled [myImageBrowser] $ do dir <- io getCaptureDir diff --git a/lib/XMonad/Internal/Concurrent/ACPIEvent.hs b/lib/XMonad/Internal/Concurrent/ACPIEvent.hs index 7fd1c3c..a3d8d73 100644 --- a/lib/XMonad/Internal/Concurrent/ACPIEvent.hs +++ b/lib/XMonad/Internal/Concurrent/ACPIEvent.hs @@ -23,8 +23,8 @@ import System.IO.Streams.UnixSocket import XMonad.Core import XMonad.Internal.Command.Power -import XMonad.Internal.Shell import XMonad.Internal.Concurrent.ClientMessage +import XMonad.Internal.Shell -------------------------------------------------------------------------------- -- | Data structure to hold the ACPI events I care about diff --git a/lib/XMonad/Internal/DBus/Screensaver.hs b/lib/XMonad/Internal/DBus/Screensaver.hs index 993f002..34c538b 100644 --- a/lib/XMonad/Internal/DBus/Screensaver.hs +++ b/lib/XMonad/Internal/DBus/Screensaver.hs @@ -15,8 +15,8 @@ import Control.Monad (void) import DBus import DBus.Client -import Graphics.X11.Xlib.Display import Graphics.X11.XScreenSaver +import Graphics.X11.Xlib.Display import XMonad.Internal.DBus.Common import XMonad.Internal.Process diff --git a/lib/Xmobar/Plugins/Bluetooth.hs b/lib/Xmobar/Plugins/Bluetooth.hs index 7c5ade7..ea07fef 100644 --- a/lib/Xmobar/Plugins/Bluetooth.hs +++ b/lib/Xmobar/Plugins/Bluetooth.hs @@ -11,8 +11,8 @@ module Xmobar.Plugins.Bluetooth (Bluetooth(..)) where import DBus import DBus.Client -import Xmobar import XMonad.Hooks.DynamicLog (xmobarColor) +import Xmobar data Bluetooth = Bluetooth (String, String, String) Int deriving (Read, Show) @@ -36,5 +36,5 @@ instance Exec Bluetooth where Right r -> fromVariant r Left _ -> Nothing fmtState = \case - Just s -> xmobarColor (if s then colorOn else colorOff) "" text + Just s -> xmobarColor (if s then colorOn else colorOff) "" text Nothing -> "N/A" diff --git a/lib/Xmobar/Plugins/Device.hs b/lib/Xmobar/Plugins/Device.hs index c1b8c60..02d6eb5 100644 --- a/lib/Xmobar/Plugins/Device.hs +++ b/lib/Xmobar/Plugins/Device.hs @@ -17,8 +17,8 @@ import Data.Word import DBus import DBus.Client -import Xmobar import XMonad.Hooks.DynamicLog (xmobarColor) +import Xmobar data Device = Device (String, String, String, String) Int deriving (Read, Show) diff --git a/lib/Xmobar/Plugins/Screensaver.hs b/lib/Xmobar/Plugins/Screensaver.hs index e4c1a6b..be72b0f 100644 --- a/lib/Xmobar/Plugins/Screensaver.hs +++ b/lib/Xmobar/Plugins/Screensaver.hs @@ -27,6 +27,6 @@ instance Exec Screensaver where forever (threadDelay 5000000) where fmtState = \case - Just s -> xmobarColor (if s then colorOn else colorOff) "" text + Just s -> xmobarColor (if s then colorOn else colorOff) "" text Nothing -> "N/A" diff --git a/lib/Xmobar/Plugins/VPN.hs b/lib/Xmobar/Plugins/VPN.hs index e833693..b566492 100644 --- a/lib/Xmobar/Plugins/VPN.hs +++ b/lib/Xmobar/Plugins/VPN.hs @@ -11,8 +11,8 @@ module Xmobar.Plugins.VPN (VPN(..)) where import DBus import DBus.Client -import Xmobar import XMonad.Hooks.DynamicLog (xmobarColor) +import Xmobar data VPN = VPN (String, String, String) Int deriving (Read, Show)