summaryrefslogtreecommitdiff
path: root/testsuite/tests
diff options
context:
space:
mode:
authorBodigrim <andrew.lelechenko@gmail.com>2022-09-28 00:15:53 +0100
committerMarge Bot <ben+marge-bot@smart-cactus.org>2022-09-28 17:50:28 -0400
commit2f050687e75ffe6fbf140cacd15fd916d2997499 (patch)
treeacd68576f0210c85f69b392cb10a7048ee97d17e /testsuite/tests
parentb0c89dfaf9f8aeda9dd69a9583fd29150099aa27 (diff)
downloadhaskell-2f050687e75ffe6fbf140cacd15fd916d2997499.tar.gz
Avoid Data.List.group; prefer Data.List.NonEmpty.group
This allows to avoid further partiality, e. g., map head . group is replaced by map NE.head . NE.group, and there are less panic calls.
Diffstat (limited to 'testsuite/tests')
-rw-r--r--testsuite/tests/lib/integer/integerGmpInternals.hs4
-rw-r--r--testsuite/tests/numeric/should_run/CarryOverflow.hs5
2 files changed, 5 insertions, 4 deletions
diff --git a/testsuite/tests/lib/integer/integerGmpInternals.hs b/testsuite/tests/lib/integer/integerGmpInternals.hs
index 982e4dcaba..0dbf8dd4e4 100644
--- a/testsuite/tests/lib/integer/integerGmpInternals.hs
+++ b/testsuite/tests/lib/integer/integerGmpInternals.hs
@@ -2,7 +2,7 @@
module Main (main) where
-import Data.List (group)
+import qualified Data.List.NonEmpty as NE
import Data.Bits
import Data.Word
import Control.Monad
@@ -40,7 +40,7 @@ main = do
b1024 = roll (map fromIntegral (take 128 [0x80::Int .. ]))
- rle = map (\x -> (length x, head x)) . group
+ rle = map (\x -> (length x, NE.head x)) . NE.group
roll :: [Word8] -> Integer
diff --git a/testsuite/tests/numeric/should_run/CarryOverflow.hs b/testsuite/tests/numeric/should_run/CarryOverflow.hs
index bcbcf121bc..d188ca9e38 100644
--- a/testsuite/tests/numeric/should_run/CarryOverflow.hs
+++ b/testsuite/tests/numeric/should_run/CarryOverflow.hs
@@ -5,7 +5,8 @@ import GHC.Exts
import Control.Monad
import Data.Bits
-import Data.List (sort, group)
+import Data.List (sort)
+import qualified Data.List.NonEmpty as NE
import System.Exit
allEqual :: Eq a => [a] -> Bool
@@ -13,7 +14,7 @@ allEqual [] = error "allEqual: nothing to compare"
allEqual (x:xs) = all (== x) xs
testWords :: [Word]
-testWords = map head . group . sort $
+testWords = map NE.head . NE.group . sort $
concatMap (\w -> [w - 1, w, w + 1]) $
concatMap (\w -> [w, maxBound - w]) $
trailingOnes ++ randoms