Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New -Wx-partial warnings with ghc 9.8 #830

Closed
3 tasks done
geekosaur opened this issue Sep 17, 2023 · 2 comments · Fixed by #839
Closed
3 tasks done

New -Wx-partial warnings with ghc 9.8 #830

geekosaur opened this issue Sep 17, 2023 · 2 comments · Fixed by #839
Assignees

Comments

@geekosaur
Copy link
Contributor

Problem Description

ghc 9.8 produces a great many warnings about partial functions, mostly head and tail.

Steps to Reproduce

Build xmonad-contrib with ghc 9.8 alpha3. (I will repeat this with alpha4 when it is available.)
This currently requires a patched setlocale package and an allow-newer on hsc2hs, which I am taking up with the respective upstreams.

A possibly useful cabal.project is:

packages: */*.cabal
-- setlocale and xmonad-contrib packages
with-compiler: ghc-9.8
allow-newer: hsc2hs:base

Configuration File

Please include the smallest full configuration file that reproduces
the problem you are experiencing:

module Main (main) where

import XMonad

main :: IO ()
main = xmonad def

Checklist

  • I've read CONTRIBUTING.md

  • I tested my configuration

    • With xmonad version 0.17.2
    • With xmonad-contrib version 0.17.1.9 (commit 51ba23b if using git)
@geekosaur
Copy link
Contributor Author

XMonad/Layout/Grid.hs:64:69: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
64 |     chop n m = ((0, m - k * fromIntegral (pred n)) :) . map (, k) . tail . reverse . take n . tail . iterate (subtract k') $ m'
   |                                                                     ^^^^

XMonad/Layout/Grid.hs:64:95: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
64 |     chop n m = ((0, m - k * fromIntegral (pred n)) :) . map (, k) . tail . reverse . take n . tail . iterate (subtract k') $ m'
   |                                                                                               ^^^^

XMonad/Layout/OneBig.hs:68:22: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
68 |             master = head ws
   |                      ^^^^

XMonad/Layout/OneBig.hs:69:22: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
69 |             other  = tail ws
   |                      ^^^^

XMonad/Layout/Spiral.hs:48:34: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
48 | fibs = 1 : 1 : zipWith (+) fibs (tail fibs)
   |                                  ^^^^

XMonad/Layout/Spiral.hs:85:82: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
85 |               ratios = blend scale . reverse . take (length ws - 1) . mkRatios $ tail fibs
   |                                                                                  ^^^^

XMonad/Layout/MultiColumns.hs:99:90: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
99 |                   incmastern (IncMasterN x) = l { multiColNWin = take a n ++ [newval] ++ tail r }
   |                                                                                          ^^^^

XMonad/Layout/MultiColumns.hs:100:47: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
100 |                       where newval =  max 0 $ head r + x
    |                                               ^^^^

XMonad/Layout/CenteredMaster.hs:86:21: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
86 |        let firstW = head ws
   |                     ^^^^

XMonad/Layout/CenteredMaster.hs:87:21: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
87 |        let other  = tail ws
   |                     ^^^^

XMonad/Hooks/InsertPosition.hs:86:27: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
86 |     in W.Stack (last ws) (tail $ reverse ws) []
   |                           ^^^^

XMonad/Actions/RotSlaves.hs:47:54: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
47 | rotSlavesUp   = windows $ modify' (rotSlaves' (\l -> tail l++[head l]))
   |                                                      ^^^^

XMonad/Actions/RotSlaves.hs:47:63: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
47 | rotSlavesUp   = windows $ modify' (rotSlaves' (\l -> tail l++[head l]))
   |                                                               ^^^^

XMonad/Actions/RotSlaves.hs:60:48: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
60 | rotAllUp   = windows $ modify' (rotAll' (\l -> tail l++[head l]))
   |                                                ^^^^

XMonad/Actions/RotSlaves.hs:60:57: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
60 | rotAllUp   = windows $ modify' (rotAll' (\l -> tail l++[head l]))
   |                                                         ^^^^

XMonad/Actions/OnScreen.hs:145:23: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
145 |     return $ f (tag . head $ st') st
    |                       ^^^^

XMonad/Actions/MessageFeedback.hs:50:39: warning: [GHC-38856] [-Wunused-imports]
    The import of ‘liftA2’ from module ‘XMonad.Prelude’ is redundant
   |
50 | import XMonad.Prelude       ( isJust, liftA2, void )
   |                                       ^^^^^^

XMonad/Actions/CycleSelectedLayouts.hs:45:28: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
45 |     let newld = fromMaybe (head lst) (cycleToNext lst ld)
   |                            ^^^^

XMonad/Util/DebugWindow.hs:62:64: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
62 |                                                           else tail s''
   |                                                                ^^^^

XMonad/Hooks/DebugEvents.hs:36:1: warning: [GHC-66111] [-Wunused-imports]
    The import of ‘Control.Monad.Fail’ is redundant
      except perhaps to import instances from ‘Control.Monad.Fail’
    To import instances alone, use: import Control.Monad.Fail()
   |
36 | import           Control.Monad.Fail
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

XMonad/Hooks/DebugEvents.hs:692:75: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
692 |                                                                      else tail s''
    |                                                                           ^^^^

XMonad/Util/Image.hs:45:26: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
45 | imageDims img = (length (head img), length img)
   |                          ^^^^

XMonad/Hooks/WorkspaceHistory.hs:93:23: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
93 |   map (\wss -> (fst $ head wss, map snd wss)) .
   |                       ^^^^

XMonad/Hooks/WallpaperSetter.hs:143:42: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
143 |             let files' = filter ((/='.').head) files
    |                                          ^^^^

XMonad/Hooks/CurrentWorkspaceOnTop.hs:67:33: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
67 |             io $ raiseWindow d (head wins)  -- raise first window of current workspace to the very top,
   |                                 ^^^^

XMonad/Actions/Workscreen.hs:112:40: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
112 |                               let ws = head . workspaces $ a !! wscrId
    |                                        ^^^^

XMonad/Actions/SwapPromote.hs:243:30: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
243 |                 mh = let w = head . W.integrate $ s3
    |                              ^^^^

XMonad/Actions/MostRecentlyUsed.hs:40:1: warning: [GHC-66111] [-Wunused-imports]
    The import of ‘Control.Applicative’ is redundant
      except perhaps to import instances from ‘Control.Applicative’
    To import instances alone, use: import Control.Applicative()
   |
40 | import Control.Applicative (liftA2)
   | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

XMonad/Hooks/ServerMode.hs:95:35: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
95 |          let atom = fromIntegral (head dt)
   |                                   ^^^^

XMonad/Util/Stack.hs:165:66: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
165 | focusUpZ (Just (W.Stack f _ down)) = Just $ W.Stack (last down) (tail (reverse down) ++ [f]) []
    |                                                                  ^^^^

XMonad/Util/Stack.hs:172:67: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
172 | focusDownZ (Just (W.Stack f up _)) = Just $ W.Stack (last up) [] (tail (reverse up) ++ [f])
    |                                                                   ^^^^

XMonad/Util/Stack.hs:178:36: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
178 |     = Just $ W.Stack (last up) [] (tail (reverse up) ++ [f] ++ down)
    |                                    ^^^^

XMonad/Layout/Groups.hs:201:71: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
201 |                        defaultGroups = fromJust $ singletonZ $ G (ID (head ids) $ baseLayout g) emptyZ
    |                                                                       ^^^^

XMonad/Layout/Groups.hs:209:54: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
209 |       defaultGroups = fromJust $ singletonZ $ G (ID (head ids) $ baseLayout g) emptyZ
    |                                                      ^^^^

XMonad/Layout/Groups.hs:226:61: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
226 |                                         >>> addWindows (ID (head ids) $ baseLayout g)
    |                                                             ^^^^

XMonad/Layout/Groups.hs:383:43: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
383 |         g' = flip modifyGroups g $ f (ID (head ids) $ baseLayout g)
    |                                           ^^^^

XMonad/Layout/Groups.hs:385:57: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
385 |                                    >>> foldr (reID g) ((tail ids, []), [])
    |                                                         ^^^^

XMonad/Layout/Groups.hs:395:41: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
395 |     g' <- flip modifyGroupsX g $ f (ID (head ids) $ baseLayout g)
    |                                         ^^^^

XMonad/Layout/Groups.hs:397:60: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
397 |                                 >>> fmap (foldr (reID g) ((tail ids, []), []))
    |                                                            ^^^^

XMonad/Layout/Groups/Helpers.hs:158:31: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
158 |                  let (before, tail -> after) = span (/=w) ws
    |                               ^^^^

XMonad/Actions/WorkspaceCursors.hs:53:47: warning: [GHC-38856] [-Wunused-imports]
    The import of ‘liftA2’ from module ‘XMonad.Prelude’ is redundant
   |
53 | import XMonad.Prelude (find, fromJust, guard, liftA2, toList, when, (<=<))
   |                                               ^^^^^^

XMonad/Actions/WorkspaceCursors.hs:100:34: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
100 |     where x = end $ map return $ head a
    |                                  ^^^^

XMonad/Actions/WorkspaceCursors.hs:101:35: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
101 |           xs = map (map return) $ tail a
    |                                   ^^^^

XMonad/Util/Timer.hs:56:43: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
56 |   if mt == a && dt /= [] && fromIntegral (head dt) == ti
   |                                           ^^^^

XMonad/Layout/Dwindle.hs:162:19: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
162 |         totals  = tail totals'
    |                   ^^^^

XMonad/Layout/Dwindle.hs:163:24: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
163 |         splits  = zip (tail sizes) totals
    |                        ^^^^

XMonad/Hooks/Place.hs:196:49: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
196 |                       let (workspace, screen) = head infos
    |                                                 ^^^^

XMonad/Prompt.hs:537:21: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
537 |   let defaultMode = head modes
    |                     ^^^^

XMonad/Prompt.hs:540:38: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
540 |                           , W.down = tail modes -- Other modes
    |                                      ^^^^

XMonad/Prompt.hs:646:50: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
646 |                 modify $ \s -> s { eventBuffer = tail l }
    |                                                  ^^^^

XMonad/Prompt.hs:647:26: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
647 |                 return $ head l
    |                          ^^^^

XMonad/Prompt.hs:779:76: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
779 |               if command st == hlCompl then put st else replaceCompletion (head cs)
    |                                                                            ^^^^

XMonad/Prompt.hs:1302:51: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
     |
1302 |             | oo <  length oc && d == Next = f ++ tail ss
     |                                                   ^^^^

XMonad/Prompt.hs:1386:13: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
     |
1386 |     let c = head s
     |             ^^^^

XMonad/Prompt.hs:1510:38: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
     |
1510 |                       in (prt ++ a, [head b], tail b)
     |                                      ^^^^

XMonad/Prompt.hs:1510:47: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
     |
1510 |                       in (prt ++ a, [head b], tail b)
     |                                               ^^^^

XMonad/Prompt.hs:1594:43: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
     |
1594 |   (asc, desc) <- io $ textExtentsXMF fs $ head compl
     |                                           ^^^^

XMonad/Prompt.hs:1767:40: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
     |
1767 |             (s1',s2') = breakAtSpace $ tail s2
     |                                        ^^^^

XMonad/Prompt.hs:1795:25: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
     |
1795 | deleteConsecutive = map head . group
     |                         ^^^^

XMonad/Prompt/Shell.hs:200:44: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
200 |     return . uniqSort . filter ((/= '.') . head) . concat $ es
    |                                            ^^^^

XMonad/Actions/WindowGo.hs:93:70: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
93 | ifWindow qry mh = ifWindows qry (windows . appEndo <=< runQuery mh . head)
   |                                                                      ^^^^

XMonad/Actions/WindowGo.hs:168:30: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
168 |     _ -> windows . focusFn . head $ ws
    |                              ^^^^

XMonad/Prompt/RunOrRaise.hs:25:47: warning: [GHC-38856] [-Wunused-imports]
    The import of ‘liftA2’ from module ‘XMonad.Prelude’ is redundant
   |
25 | import XMonad.Prelude (isNothing, isSuffixOf, liftA2)
   |                                               ^^^^^^

XMonad/Prompt/OrgMode.hs:528:26: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
528 |       str  <- munch  (/= head ptn)
    |                          ^^^^

XMonad/Layout/LayoutBuilder.hs:460:45: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
460 |                                 , W.down  = tail $ dropWhile (/=f) w
    |                                             ^^^^

XMonad/Hooks/StatusBar/PP.hs:404:16: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
404 |       | '^' == head x       = strip keep (drop 1 . dropWhile (/= ')') $ x)
    |                ^^^^

XMonad/Hooks/StatusBar/PP.hs:467:14: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
467 |     in fst $ head $ dropWhile (uncurry (/=)) $ zip xs $ tail xs
    |              ^^^^

XMonad/Hooks/StatusBar/PP.hs:467:57: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
467 |     in fst $ head $ dropWhile (uncurry (/=)) $ zip xs $ tail xs
    |                                                         ^^^^

XMonad/Hooks/Minimize.hs:47:36: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
47 |       let message = fromIntegral . head $ dt
   |                                    ^^^^

XMonad/Util/ExclusiveScratchpads.hs:42:42: warning: [GHC-38856] [-Wunused-imports]
    The import of ‘liftA2’ from module ‘XMonad.Prelude’ is redundant
   |
42 | import XMonad.Prelude (appEndo, filterM, liftA2, (<=<))
   |                                          ^^^^^^

XMonad/Util/ExclusiveScratchpads.hs:177:11: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
177 |     mh <- head . map hook <$> ys  -- ys /= [], so `head` is fine
    |           ^^^^

XMonad/Util/ExclusiveScratchpads.hs:178:11: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
178 |     n  <- head . map name <$> ys  -- same
    |           ^^^^

XMonad/Layout/ComboP.hs:187:63: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
187 |                                                      , down = tail $ dropWhile (/=z) xs }
    |                                                               ^^^^

XMonad/Layout/Combo.hs:91:69: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
91 |                   do let w2' = case origws `intersect` w2 of [] -> [head origws]
   |                                                                     ^^^^

XMonad/Layout/Combo.hs:124:63: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
124 |                                                  (maybe super head msuper')
    |                                                               ^^^^

XMonad/Layout/Combo.hs:125:60: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
125 |                                                  (maybe l1 head ml1')
    |                                                            ^^^^

XMonad/Layout/Combo.hs:126:60: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
126 |                                                  (maybe l2 head ml2')
    |                                                            ^^^^

XMonad/Layout/Combo.hs:135:63: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
135 |                                                      , down = tail $ dropWhile (/=z) xs }
    |                                                               ^^^^

XMonad/Layout/TallMastersCombo.hs:247:61: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
247 |         let subMaster = if null w2 then Nothing else Just $ head w2
    |                                                             ^^^^

XMonad/Layout/TallMastersCombo.hs:254:61: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
254 |         let subMaster = if null w2 then Nothing else Just $ head w2
    |                                                             ^^^^

XMonad/Layout/TallMastersCombo.hs:314:63: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
314 |                                                      , down = tail $ dropWhile (/=z) xs }
    |                                                               ^^^^

XMonad/Actions/GridSelect.hs:661:61: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
661 |                                 s = TwoDState { td_curpos = head coords,
    |                                                             ^^^^

XMonad/Util/EZConfig.hs:441:23: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
441 |         combine ks = (head . fst . head $ ks,
    |                       ^^^^

XMonad/Util/EZConfig.hs:441:36: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
441 |         combine ks = (head . fst . head $ ks,
    |                                    ^^^^

XMonad/Util/EZConfig.hs:442:59: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
442 |                       subm . mkSubmaps' subm $ map (first tail) ks)
    |                                                           ^^^^

XMonad/Util/EZConfig.hs:443:29: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
443 |         fstKey = (==) `on` (head . fst)
    |                             ^^^^

XMonad/Util/EZConfig.hs:547:27: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
547 |         dups = map (snd . head)
    |                           ^^^^

XMonad/Actions/Navigation2D.hs:786:14: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from Data.List, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
786 |     onCtr' = L.tail $ L.dropWhile ((cur /=) . fst) onCtr
    |              ^^^^^^

XMonad/Actions/Navigation2D.hs:887:38: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
887 |     newwinset = winset { W.current = head newscrs
    |                                      ^^^^

XMonad/Actions/Navigation2D.hs:888:38: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
888 |                        , W.visible = tail newscrs
    |                                      ^^^^

XMonad/Actions/Prefix.hs:169:37: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
169 |               Raw a -> replicate a (head events) ++ [key]
    |                                     ^^^^

XMonad/Actions/ShowText.hs:91:44: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘head’
    (imported from Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
   |
91 |          (whenJust (lookup (fromIntegral $ head d) m) deleteWindow)
   |                                            ^^^^

XMonad/Actions/EasyMotion.hs:390:35: warning: [GHC-63394] [-Wx-partial]
    In the use of ‘tail’
    (imported from XMonad.Prelude, but defined in GHC.List):
    "This is a partial function, it throws an error on empty lists. Replace it with drop 1, or use pattern matching or Data.List.uncons instead. Consider refactoring to use Data.List.NonEmpty."
    |
390 |     trim = map (\o -> o { chord = tail $ chord o })
    |                                   ^^^^

@geekosaur
Copy link
Contributor Author

There turn out to be a few in the core as well, I'll create an issue for that.

@slotThe slotThe self-assigned this Sep 20, 2023
slotThe added a commit to xmonad/X11 that referenced this issue Oct 24, 2023
GHC 9.8 comes with new and shiny warnings.

Related: #89
Related: xmonad/xmonad-contrib#830
liskin added a commit to xmonad/X11-xft that referenced this issue Oct 24, 2023
GHC 9.8 comes with new and shiny warnings.

Related: #6
Related: xmonad/xmonad-contrib#830
slotThe added a commit to slotThe/xmonad-contrib that referenced this issue Oct 27, 2023
slotThe added a commit to slotThe/xmonad-contrib that referenced this issue Oct 27, 2023
slotThe added a commit that referenced this issue Oct 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants