extra 1.7.14 → 1.7.15
raw patch · 9 files changed
+21/−8 lines, 9 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
Files
- CHANGES.txt +3/−0
- Generate.hs +6/−1
- LICENSE +1/−1
- README.md +1/−1
- extra.cabal +3/−3
- src/Control/Monad/Extra.hs +1/−1
- src/Data/List/Extra.hs +2/−1
- src/Data/List/NonEmpty/Extra.hs +3/−0
- test/TestGen.hs +1/−0
CHANGES.txt view
@@ -1,5 +1,8 @@ Changelog for Extra +1.7.15, released 2024-05-10+ #111, work with GHC 9.10+ Test with GHC 9.8 1.7.14, released 2023-07-01 #106, add compatibility with GHC 9.7 #103, future-proof against addition of Data.List.unsnoc
Generate.hs view
@@ -1,5 +1,9 @@ -- This module generates the files src/Extra.hs and test/TestGen.hs.--- Either call "runghc Generate" or start "ghci" and use ":generate".+-- Typical usage is run:+--+-- * `cabal test` to install the necessary packages+-- * `cabal exec ghci` to get into GHCi+-- * `:go` or `:generate` to run this generator module Generate(main) where @@ -47,6 +51,7 @@ ,"-- See Generate.hs for details of how to generate" ,"" ,"{-# LANGUAGE ExtendedDefaultRules, ScopedTypeVariables, TypeApplications, ViewPatterns #-}"+ ,"{-# OPTIONS_GHC -Wno-x-partial -Wno-unrecognised-warning-flags #-}" ,"module TestGen(tests) where" ,"import TestUtil" ,"import qualified Data.Ord"
LICENSE view
@@ -1,4 +1,4 @@-Copyright Neil Mitchell 2014-2023.+Copyright Neil Mitchell 2014-2024. All rights reserved. Redistribution and use in source and binary forms, with or without
README.md view
@@ -1,4 +1,4 @@-# Extra [](https://hackage.haskell.org/package/extra) [](https://www.stackage.org/package/extra) [](https://github.com/ndmitchell/extra/actions)+# Extra [](https://hackage.haskell.org/package/extra) [](https://www.stackage.org/package/extra) [](https://github.com/ndmitchell/extra/actions) A library of extra functions for the standard Haskell libraries. Most functions are simple additions, filling out missing functionality. A few functions are available in later versions of GHC, but this package makes them available back to GHC 7.10. A few examples:
extra.cabal view
@@ -1,13 +1,13 @@ cabal-version: 1.18 build-type: Simple name: extra-version: 1.7.14+version: 1.7.15 license: BSD3 license-file: LICENSE category: Development author: Neil Mitchell <ndmitchell@gmail.com> maintainer: Neil Mitchell <ndmitchell@gmail.com>-copyright: Neil Mitchell 2014-2023+copyright: Neil Mitchell 2014-2024 synopsis: Extra functions I use. description: A library of extra functions for the standard Haskell libraries. Most functions are simple additions, filling out missing functionality. A few functions are available in later versions of GHC, but this package makes them available back to GHC 7.2.@@ -15,7 +15,7 @@ The module "Extra" documents all functions provided by this library. Modules such as "Data.List.Extra" provide extra functions over "Data.List" and also reexport "Data.List". Users are recommended to replace "Data.List" imports with "Data.List.Extra" if they need the extra functionality. homepage: https://github.com/ndmitchell/extra#readme bug-reports: https://github.com/ndmitchell/extra/issues-tested-with: GHC==9.6, GHC==9.4, GHC==9.2, GHC==9.0, GHC==8.10, GHC==8.8+tested-with: GHC==9.8, GHC==9.6, GHC==9.4, GHC==9.2, GHC==9.0, GHC==8.10, GHC==8.8 extra-doc-files: CHANGES.txt
src/Control/Monad/Extra.hs view
@@ -52,7 +52,7 @@ pureIf b a = if b then pure a else empty -- | Like 'when', but return either 'Nothing' if the predicate was 'False',--- of 'Just' with the result of the computation.+-- or 'Just' with the result of the computation. -- -- > whenMaybe True (print 1) == fmap Just (print 1) -- > whenMaybe False (print 1) == pure Nothing
src/Data/List/Extra.hs view
@@ -496,7 +496,8 @@ -- > \xs -> map fst (groupSort xs) == sort (nub (map fst xs)) -- > \xs -> concatMap snd (groupSort xs) == map snd (sortOn fst xs) groupSort :: Ord k => [(k, v)] -> [(k, [v])]-groupSort = map (\x -> (fst $ head x, map snd x)) . groupOn fst . sortOn fst+groupSort = map (\x -> (fst $ headErr x, map snd x)) . groupOn fst . sortOn fst+ where headErr (x:_) = x -- | A combination of 'group' and 'sort', using a part of the value to compare on. --
src/Data/List/NonEmpty/Extra.hs view
@@ -1,4 +1,5 @@ {-# LANGUAGE CPP #-}+{-# OPTIONS_GHC -fno-warn-duplicate-exports #-} -- | Extra functions for working with 'NonEmpty' lists. The package -- also exports the existing "Data.List.NonEmpty" functions.@@ -62,11 +63,13 @@ appendr :: [a] -> NonEmpty a -> NonEmpty a appendr l nel = foldr cons nel l +#if __GLASGOW_HASKELL__ <= 910 -- | Sort by comparing the results of a function applied to each element. -- The sort is stable, and the function is evaluated only once for -- each element. sortOn :: Ord b => (a -> b) -> NonEmpty a -> NonEmpty a sortOn f = fromList . List.sortOn f . toList+#endif -- | Return the union of two non-empty lists. Duplicates, and elements of the -- first list, are removed from the the second list, but if the first list
test/TestGen.hs view
@@ -2,6 +2,7 @@ -- See Generate.hs for details of how to generate {-# LANGUAGE ExtendedDefaultRules, ScopedTypeVariables, TypeApplications, ViewPatterns #-}+{-# OPTIONS_GHC -Wno-x-partial -Wno-unrecognised-warning-flags #-} module TestGen(tests) where import TestUtil import qualified Data.Ord