sorted-list 0.1.1.0 → 0.1.2.0
raw patch · 2 files changed
+21/−2 lines, 2 filesPVP ok
version bump matches the API change (PVP)
API changes (from Hackage documentation)
+ Data.SortedList: map :: Ord b => (a -> b) -> SortedList a -> SortedList b
Files
- Data/SortedList.hs +20/−1
- sorted-list.cabal +1/−1
Data/SortedList.hs view
@@ -29,13 +29,14 @@ , null , elemOrd -- * Others+ , map , nub ) where import Prelude hiding ( take, drop, splitAt, filter , repeat, replicate, iterate- , null+ , null, map #if !MIN_VERSION_base(4,8,0) , foldr #endif@@ -179,3 +180,21 @@ [] -> error "SortedList.maximum: empty list" _ -> last xs #endif++-- | Map a function over all the elements of a sorted list.+-- Note that 'map' will hang if the argument is an infinite list.+--+-- Even though 'SortedList' can't be made an instance of 'Functor',+-- 'map' /does/ hold the 'Functor' laws. The problem to write the+-- the instance is the 'Ord' instance requirement on the type of+-- the elements of the result list. Therefore, while 'SortedList'+-- is not a functor type in general, it is when restricted to elements of+-- orderable types.+map :: Ord b => (a -> b) -> SortedList a -> SortedList b+{-# INLINE[1] map #-}+map f = foldr (insert . f) mempty++{-# RULES+"SortedList:map/map" forall f g xs. map f (map g xs) = map (f . g) xs+"SortedList:map/id" forall xs. map id xs = xs+ #-}
sorted-list.cabal view
@@ -1,5 +1,5 @@ name: sorted-list-version: 0.1.1.0+version: 0.1.2.0 synopsis: Type-enforced sorted lists and related functions. description: Type-enforced sorted lists and related functions. .