sorted-list 0.1.0.0 → 0.1.1.0
raw patch · 2 files changed
+20/−1 lines, 2 filesdep ~basePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base
API changes (from Hackage documentation)
- Data.SortedList: instance Data.Foldable.Foldable Data.SortedList.SortedList
- Data.SortedList: instance GHC.Classes.Ord a => GHC.Base.Monoid (Data.SortedList.SortedList a)
- Data.SortedList: instance GHC.Show.Show a => GHC.Show.Show (Data.SortedList.SortedList a)
+ Data.SortedList: instance Foldable SortedList
+ Data.SortedList: instance Ord a => Monoid (SortedList a)
+ Data.SortedList: instance Show a => Show (SortedList a)
+ Data.SortedList: null :: SortedList a -> Bool
Files
- Data/SortedList.hs +19/−0
- sorted-list.cabal +1/−1
Data/SortedList.hs view
@@ -1,4 +1,6 @@ +{-# LANGUAGE CPP #-}+ -- | This module defines a type for sorted lists, together -- with several functions to create and use values of that -- type. Many operations are optimized to take advantage@@ -24,6 +26,7 @@ , splitAt , filter -- * Queries+ , null , elemOrd -- * Others , nub@@ -32,10 +35,20 @@ import Prelude hiding ( take, drop, splitAt, filter , repeat, replicate, iterate+ , null+#if !MIN_VERSION_base(4,8,0)+ , foldr+#endif ) import qualified Data.List as List import Data.Monoid ((<>)) import Data.Foldable (toList)+-- GHC 7.8.3 compatibility+#if !MIN_VERSION_base(4,8,0)+import Data.Monoid (Monoid (..))+import Data.Foldable (Foldable, foldr)+#endif+-- -- | Type of sorted lists. Any (non-bottom) value of this type -- is a sorted list.@@ -44,6 +57,10 @@ instance Show a => Show (SortedList a) where show = show . fromSortedList +-- | Check if a sorted list is empty.+null :: SortedList a -> Bool+null = List.null . fromSortedList+ -- | Decompose a sorted list into its minimal element and the rest. -- If the list is empty, it returns 'Nothing'. uncons :: SortedList a -> Maybe (a, SortedList a)@@ -150,6 +167,7 @@ instance Foldable SortedList where {-# INLINE foldr #-} foldr f e (SortedList xs) = foldr f e xs+#if MIN_VERSION_base(4,8,0) {-# INLINE toList #-} toList = fromSortedList minimum (SortedList xs) =@@ -160,3 +178,4 @@ case xs of [] -> error "SortedList.maximum: empty list" _ -> last xs+#endif
sorted-list.cabal view
@@ -1,5 +1,5 @@ name: sorted-list-version: 0.1.0.0+version: 0.1.1.0 synopsis: Type-enforced sorted lists and related functions. description: Type-enforced sorted lists and related functions. .