packages feed

sorted-list 0.1.5.0 → 0.1.6.0

raw patch · 2 files changed

+32/−3 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

+ Data.SortedList: filterGT :: Ord a => a -> SortedList a -> SortedList a
+ Data.SortedList: filterLT :: Ord a => a -> SortedList a -> SortedList a
+ Data.SortedList: instance GHC.Classes.Ord a => GHC.Exts.IsList (Data.SortedList.SortedList a)

Files

Data/SortedList.hs view
@@ -1,5 +1,5 @@ -{-# LANGUAGE CPP #-}+{-# LANGUAGE CPP, TypeFamilies #-}  -- | This module defines a type for sorted lists, together --   with several functions to create and use values of that@@ -30,6 +30,8 @@   , dropWhile   , span   , filter+  , filterLT+  , filterGT   , partition     -- * Queries #if !MIN_VERSION_base(4,8,0)@@ -59,15 +61,21 @@ #endif     ) import qualified Data.List as List-import Data.Foldable (Foldable (..)) import Control.DeepSeq (NFData (..))+import Data.Foldable (Foldable (..)) -- #if MIN_VERSION_base(4,5,0) import Data.Monoid ((<>)) #endif+-- #if MIN_VERSION_base(4,6,0) import Data.Ord (Down (..)) #endif+--+#if MIN_VERSION_base(4,7,0)+import qualified GHC.Exts as Exts+#endif+-- #if !MIN_VERSION_base(4,8,0) import Data.Monoid (Monoid (..)) #endif@@ -84,6 +92,13 @@   {-# INLINE rnf #-}   rnf (SortedList xs) = rnf xs +#if MIN_VERSION_base(4,7,0)+instance Ord a => Exts.IsList (SortedList a) where+  type (Item (SortedList a)) = a+  fromList = toSortedList+  toList = fromSortedList+#endif+ #if !MIN_VERSION_base(4,8,0) -- | Check if a sorted list is empty. --@@ -210,6 +225,20 @@ -- | /O(n)/. Extract the elements of a list that satisfy the predicate. filter :: (a -> Bool) -> SortedList a -> SortedList a filter f = fst . partition f++-- | /O(n)/. Select only elements less or equal to the argument.+filterLT :: Ord a => a -> SortedList a -> SortedList a+filterLT a (SortedList l) = SortedList $ go l+  where+    go (x:xs) = if x <= a then x : go xs else []+    go [] = []++-- | /O(n)/. Select only elements greater or equal to the argument.+filterGT :: Ord a => a -> SortedList a -> SortedList a+filterGT a (SortedList l) = SortedList $ go l+  where+    go (x:xs) = if a <= x then x : xs else go xs+    go [] = []  -- | /O(n)/. An efficient implementation of 'elem', using the 'Ord' --   instance of the elements in a sorted list. It only traverses
sorted-list.cabal view
@@ -1,5 +1,5 @@ name:                sorted-list-version:             0.1.5.0+version:             0.1.6.0 synopsis:            Type-enforced sorted lists and related functions. description:         Type-enforced sorted lists and related functions.                      .