packages feed

collections 0.3 → 0.3.1

raw patch · 5 files changed

+20/−15 lines, 5 filesdep +arraydep +bytestringdep +containersdep ~basenew-uploader

Dependencies added: array, bytestring, containers

Dependency ranges changed: base

Files

Data/Collections.hs view
@@ -742,7 +742,7 @@     difference = Map.difference     delete = Map.delete     intersection = Map.intersection-    lookup = Map.lookup+    lookup x y = lifted $ Map.lookup x y     alter = Map.alter     insertWith = Map.insertWith     unionWith = Map.unionWith@@ -751,9 +751,13 @@     mapWithKey = Map.mapWithKey  instance Ord k => SortingCollection (Map.Map k a) (k,a) where-    minView x = return swap `ap` Map.minView x+    minView x = lifted $ Map.minViewWithKey x         where swap (x,y) = (y,x) +lifted :: Monad m => Maybe a -> m a+lifted action = +    case action of Nothing -> fail "missing key (probably)" ; Just x -> return x+ ----------------------------------------------------------------------------- -- Data.AvlMap instance Foldable (AvlMap.Map k a) (k,a) where@@ -822,7 +826,7 @@     difference = IntMap.difference     delete = IntMap.delete     intersection = IntMap.intersection-    lookup = IntMap.lookup+    lookup x y = lifted $ IntMap.lookup x y     alter = IntMap.alter     insertWith = IntMap.insertWith     unionWith = IntMap.unionWith
Data/Collections/Properties.hs view
@@ -84,6 +84,8 @@  infix 1 <== +{- +-- no longer needed since this is in quickcheck now instance Arbitrary a => Arbitrary (Maybe a)     where arbitrary = do test <- arbitrary                          if test @@ -91,6 +93,7 @@                             else return Just `ap` arbitrary           coarbitrary Nothing = variant 0           coarbitrary (Just x) = variant 1 . coarbitrary x+-}  instance Show (a->b) where     show _ = "<func>"
Data/Ranged/Ranges.hs view
@@ -1,5 +1,5 @@ {-# OPTIONS_GHC -cpp -fglasgow-exts #-}------------------------------------------------------------------------------+ -- | -- Module      :  Data.Ranged.Ranges -- Copyright   :  (c) Paul Johnson 2006@@ -7,11 +7,8 @@ -- Maintainer  :  paul@cogito.org.uk -- Stability   :  experimental -- Portability :  portable----------------------------------------------------------------------------------+-- A range has an upper and lower boundary. --- | A range has an upper and lower boundary. module Data.Ranged.Ranges (    -- ** Construction    Range (..),
Data/Trie.hs view
@@ -117,9 +117,9 @@ toMaybe f b = if f b then Nothing else Just b  alter :: forall s k v. (C.Foldable s k, Ord k) => (Maybe v -> Maybe v) -> s -> Trie s k v -> Trie s k v-alter f s t = C.foldr rec zero s t+alter f s t = C.foldr rek zero s t     where zero (Trie v cs) = (Trie (f v) cs) -          rec k sub (Trie v cs) = Trie v (C.alter (f' sub) k cs)+          rek k sub (Trie v cs) = Trie v (C.alter (f' sub) k cs)           f' sub t = toMaybe null (sub (fromMaybe empty t))           -- recursive application: need to "create" empty nodes in case f creates a leaf node. @@ -131,10 +131,10 @@ --           f' ks (Just t) = toMaybe (alter f ks t)  adjust :: forall s k v. (C.Foldable s k, Ord k) => (v -> v) -> s -> Trie s k v -> Trie s k v-adjust f s t = C.foldr rec zero s t+adjust f s t = C.foldr rek zero s t     where zero t@(Trie Nothing _) = t           zero (Trie (Just v) cs) = (Trie (Just (f v)) cs) -          rec k sub (Trie v cs) = Trie v (C.adjust sub k cs)+          rek k sub (Trie v cs) = Trie v (C.adjust sub k cs)          -- | Modify the 'children' field of a trie. value_u :: (Maybe v -> Maybe v) -> Trie s k v -> Trie s k v
collections.cabal view
@@ -1,5 +1,5 @@ name:		collections-version:	0.3+version:	0.3.1 category:       Data Structures description:             This package provides a suite of data structures types, with a consistent API. @@ -48,6 +48,7 @@ 	Data.Tree.AVL.Internals.HeightUtils include-dirs: 	include extra-source-files: include/Typeable.h include/ghcdefs.h include/h98defs.h-build-depends:	base >= 2.0, QuickCheck+build-type: Simple+build-depends:	base >=3 && < 4, QuickCheck, containers, array, bytestring extensions:	CPP-ghc-options:    -O -Wall -fno-warn-name-shadowing -fno-warn-incomplete-patterns+ghc-options:    -Wall -fno-warn-name-shadowing -fno-warn-incomplete-patterns