safe 0.3.18 → 0.3.19
raw patch · 5 files changed
+37/−30 lines, 5 files
Files
- CHANGES.txt +2/−0
- LICENSE +1/−1
- Safe.hs +9/−6
- Safe/Foldable.hs +21/−19
- safe.cabal +4/−4
CHANGES.txt view
@@ -1,5 +1,7 @@ Changelog for Safe +0.3.19, released 2020-05-24+ #30, undeprecate maximumDef and friends, fold*1Def 0.3.18, released 2019-12-04 #27, deprecate maximumDef and friends, fold*1Def #27, add maximumBounded and friends
LICENSE view
@@ -1,4 +1,4 @@-Copyright Neil Mitchell 2007-2019.+Copyright Neil Mitchell 2007-2020. All rights reserved. Redistribution and use in source and binary forms, with or without
Safe.hs view
@@ -53,7 +53,7 @@ succMay, succDef, succNote, succSafe, predMay, predDef, predNote, predSafe, indexMay, indexDef, indexNote,- -- * Deprecated+ -- * Discouraged minimumDef, maximumDef, minimumByDef, maximumByDef ) where @@ -366,20 +366,23 @@ indexNote :: (Partial, Ix a) => String -> (a, a) -> a -> Int indexNote note x y = withFrozenCallStack $ fromNote note "indexNote, out of range" $ indexMay x y + ------------------------------------------------------------------------ DEPRECATED+-- DISCOURAGED -{-# DEPRECATED minimumDef "Use @minimumBound@ instead." #-}-{-# DEPRECATED maximumDef "Use @maximumBound@ instead." #-}+-- | New users are recommended to use 'minimumBound' or 'maximumBound' instead. minimumDef, maximumDef :: Ord a => a -> [a] -> a minimumDef def = fromMaybe def . minimumMay maximumDef def = fromMaybe def . maximumMay -{-# DEPRECATED minimumByDef "Use @minimumBoundBy@ instead." #-}-{-# DEPRECATED maximumByDef "Use @maximumBoundBy@ instead." #-}+-- | New users are recommended to use 'minimumBoundBy' or 'maximumBoundBy' instead. minimumByDef, maximumByDef :: a -> (a -> a -> Ordering) -> [a] -> a minimumByDef def = fromMaybe def .^ minimumByMay maximumByDef def = fromMaybe def .^ maximumByMay+++---------------------------------------------------------------------+-- DEPRECATED {-# DEPRECATED foldr1Def "Use @foldr1May@ instead." #-} {-# DEPRECATED foldl1Def "Use @foldl1May@ instead." #-}
Safe/Foldable.hs view
@@ -17,9 +17,10 @@ maximumBoundBy, minimumBoundBy, maximumBounded, maximumBound, minimumBounded, minimumBound,+ -- * Discouraged+ minimumDef, maximumDef, minimumByDef, maximumByDef, -- * Deprecated foldl1Safe, foldr1Safe, findJustSafe,- minimumDef, maximumDef, minimumByDef, maximumByDef ) where import Safe.Util@@ -107,6 +108,25 @@ ---------------------------------------------------------------------+-- DISCOURAGED++-- | New users are recommended to use 'minimumBound' or 'maximumBound' instead.+minimumDef, maximumDef :: (Foldable t, Ord a) => a -> t a -> a+minimumDef def = fromMaybe def . minimumMay+maximumDef def = fromMaybe def . maximumMay++-- | New users are recommended to use 'minimumBoundBy' or 'maximumBoundBy' instead.+minimumByDef, maximumByDef :: Foldable t => a -> (a -> a -> Ordering) -> t a -> a+minimumByDef def = fromMaybe def .^ minimumByMay+maximumByDef def = fromMaybe def .^ maximumByMay++-- | New users are recommended to use 'foldr1May' or 'foldl1May' instead.+foldl1Def, foldr1Def :: Foldable t => a -> (a -> a -> a) -> t a -> a+foldl1Def def = fromMaybe def .^ foldl1May+foldr1Def def = fromMaybe def .^ foldr1May+++--------------------------------------------------------------------- -- DEPRECATED {-# DEPRECATED foldl1Safe "Use @foldl f mempty@ instead." #-}@@ -120,21 +140,3 @@ {-# DEPRECATED findJustSafe "Use @findJustDef mempty@ instead." #-} findJustSafe :: (Monoid m, Foldable t) => (m -> Bool) -> t m -> m findJustSafe = findJustDef mempty--{-# DEPRECATED minimumDef "Use @minimumBound@ instead." #-}-{-# DEPRECATED maximumDef "Use @maximumBound@ instead." #-}-minimumDef, maximumDef :: (Foldable t, Ord a) => a -> t a -> a-minimumDef def = fromMaybe def . minimumMay-maximumDef def = fromMaybe def . maximumMay--{-# DEPRECATED minimumByDef "Use @minimumBoundBy@ instead." #-}-{-# DEPRECATED maximumByDef "Use @maximumBoundBy@ instead." #-}-minimumByDef, maximumByDef :: Foldable t => a -> (a -> a -> Ordering) -> t a -> a-minimumByDef def = fromMaybe def .^ minimumByMay-maximumByDef def = fromMaybe def .^ maximumByMay--{-# DEPRECATED foldr1Def "Use @foldr1May@ instead." #-}-{-# DEPRECATED foldl1Def "Use @foldl1May@ instead." #-}-foldl1Def, foldr1Def :: Foldable t => a -> (a -> a -> a) -> t a -> a-foldl1Def def = fromMaybe def .^ foldl1May-foldr1Def def = fromMaybe def .^ foldr1May
safe.cabal view
@@ -1,17 +1,17 @@ cabal-version: >= 1.18 build-type: Simple name: safe-version: 0.3.18+version: 0.3.19 license: BSD3 license-file: LICENSE category: Unclassified author: Neil Mitchell <ndmitchell@gmail.com> maintainer: Neil Mitchell <ndmitchell@gmail.com>-copyright: Neil Mitchell 2007-2019+copyright: Neil Mitchell 2007-2020 homepage: https://github.com/ndmitchell/safe#readme synopsis: Library of safe (exception free) functions bug-reports: https://github.com/ndmitchell/safe/issues-tested-with: GHC==8.8.1, GHC==8.6.5, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2, GHC==7.10.3+tested-with: GHC==8.10.1, GHC==8.8.3, GHC==8.6.5, GHC==8.4.4, GHC==8.2.2, GHC==8.0.2 description: A library wrapping @Prelude@/@Data.List@ functions that can throw exceptions, such as @head@ and @!!@. Each unsafe function has up to four variants, e.g. with @tail@:@@ -44,7 +44,7 @@ library default-language: Haskell2010 build-depends:- base >= 4.5 && < 5+ base >= 4.8 && < 5 exposed-modules: Safe