dependent-map 0.2.0.1 → 0.2.1.0
raw patch · 2 files changed
+22/−17 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Data.Dependent.Map: instance [safe] (GCompare k, ReadTag k f) => Read (DMap k f)
- Data.Dependent.Map: instance [safe] EqTag k f => Eq (DMap k f)
- Data.Dependent.Map: instance [safe] GCompare k => Monoid (DMap k f)
- Data.Dependent.Map: instance [safe] OrdTag k f => Ord (DMap k f)
- Data.Dependent.Map: instance [safe] ShowTag k f => Show (DMap k f)
+ Data.Dependent.Map: instance forall (k :: BOX) (k1 :: k -> *) (f :: k -> *). (Data.GADT.Compare.GCompare k1, Data.Dependent.Sum.ReadTag k1 f) => GHC.Read.Read (Data.Dependent.Map.Internal.DMap k1 f)
+ Data.Dependent.Map: instance forall (k :: BOX) (k1 :: k -> *) (f :: k -> *). Data.Dependent.Sum.EqTag k1 f => GHC.Classes.Eq (Data.Dependent.Map.Internal.DMap k1 f)
+ Data.Dependent.Map: instance forall (k :: BOX) (k1 :: k -> *) (f :: k -> *). Data.Dependent.Sum.OrdTag k1 f => GHC.Classes.Ord (Data.Dependent.Map.Internal.DMap k1 f)
+ Data.Dependent.Map: instance forall (k :: BOX) (k1 :: k -> *) (f :: k -> *). Data.Dependent.Sum.ShowTag k1 f => GHC.Show.Show (Data.Dependent.Map.Internal.DMap k1 f)
+ Data.Dependent.Map: instance forall (k :: BOX) (k1 :: k -> *) (f :: k -> *). Data.GADT.Compare.GCompare k1 => GHC.Base.Monoid (Data.Dependent.Map.Internal.DMap k1 f)
- Data.Dependent.Map: GEQ :: GOrdering k t t
+ Data.Dependent.Map: GEQ :: GOrdering k b b
- Data.Dependent.Map: difference :: GCompare k => DMap k f -> DMap k f -> DMap k f
+ Data.Dependent.Map: difference :: GCompare k => DMap k f -> DMap k g -> DMap k f
- Data.Dependent.Map: differenceWithKey :: GCompare k => (forall v. k v -> f v -> f v -> Maybe (f v)) -> DMap k f -> DMap k f -> DMap k f
+ Data.Dependent.Map: differenceWithKey :: GCompare k => (forall v. k v -> f v -> g v -> Maybe (f v)) -> DMap k f -> DMap k g -> DMap k f
- Data.Dependent.Map: intersectionWithKey :: GCompare k => (forall v. k v -> f v -> f v -> f v) -> DMap k f -> DMap k f -> DMap k f
+ Data.Dependent.Map: intersectionWithKey :: GCompare k => (forall v. k v -> f v -> g v -> h v) -> DMap k f -> DMap k g -> DMap k h
- Data.Dependent.Map: isProperSubmapOfBy :: GCompare k => (forall v. k v -> k v -> f v -> f v -> Bool) -> DMap k f -> DMap k f -> Bool
+ Data.Dependent.Map: isProperSubmapOfBy :: GCompare k => (forall v. k v -> k v -> f v -> g v -> Bool) -> DMap k f -> DMap k g -> Bool
- Data.Dependent.Map: isSubmapOfBy :: GCompare k => (forall v. k v -> k v -> f v -> f v -> Bool) -> DMap k f -> DMap k f -> Bool
+ Data.Dependent.Map: isSubmapOfBy :: GCompare k => (forall v. k v -> k v -> f v -> g v -> Bool) -> DMap k f -> DMap k g -> Bool
- Data.Dependent.Map: mapAccumLWithKey :: (forall v. a -> k v -> f v -> (a, f v)) -> a -> DMap k f -> (a, DMap k f)
+ Data.Dependent.Map: mapAccumLWithKey :: (forall v. a -> k v -> f v -> (a, g v)) -> a -> DMap k f -> (a, DMap k g)
- Data.Dependent.Map: mapAccumRWithKey :: (forall v. a -> k v -> f v -> (a, f v)) -> a -> DMap k f -> (a, DMap k f)
+ Data.Dependent.Map: mapAccumRWithKey :: (forall v. a -> k v -> f v -> (a, g v)) -> a -> DMap k f -> (a, DMap k g)
- Data.Dependent.Map: mapEitherWithKey :: GCompare k => (forall v. k v -> f v -> Either (f v) (f v)) -> DMap k f -> (DMap k f, DMap k f)
+ Data.Dependent.Map: mapEitherWithKey :: GCompare k => (forall v. k v -> f v -> Either (g v) (h v)) -> DMap k f -> (DMap k g, DMap k h)
- Data.Dependent.Map: mapMaybeWithKey :: GCompare k => (forall v. k v -> f v -> Maybe (f v)) -> DMap k f -> DMap k f
+ Data.Dependent.Map: mapMaybeWithKey :: GCompare k => (forall v. k v -> f v -> Maybe (g v)) -> DMap k f -> DMap k g
- Data.Dependent.Map: mapWithKey :: (forall v. k v -> f v -> f v) -> DMap k f -> DMap k f
+ Data.Dependent.Map: mapWithKey :: (forall v. k v -> f v -> g v) -> DMap k f -> DMap k g
Files
- dependent-map.cabal +3/−3
- src/Data/Dependent/Map.hs +19/−14
dependent-map.cabal view
@@ -1,5 +1,5 @@ name: dependent-map-version: 0.2.0.1+version: 0.2.1.0 stability: provisional cabal-version: >= 1.6@@ -21,9 +21,9 @@ GHC == 7.2.2, GHC == 7.4.2, GHC == 7.6.3,- GHC == 7.8.3, GHC == 7.8.4,- GHC == 7.10.1+ GHC == 7.10.1,+ GHC == 7.11 source-repository head type: git
src/Data/Dependent/Map.hs view
@@ -6,6 +6,9 @@ #if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 702 {-# LANGUAGE Safe #-} #endif+#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 708+{-# LANGUAGE PolyKinds #-}+#endif module Data.Dependent.Map ( DMap , DSum(..), Some(..)@@ -139,7 +142,9 @@ import Data.Dependent.Sum import Data.GADT.Compare import Data.Maybe (isJust)+#if !MIN_VERSION_base(4,8,0) import Data.Monoid+#endif import Data.Some import Text.Read @@ -594,13 +599,13 @@ -- | /O(n+m)/. Difference of two maps. -- Return elements of the first map not existing in the second map. -- The implementation uses an efficient /hedge/ algorithm comparable with /hedge-union/.-difference :: GCompare k => DMap k f -> DMap k f -> DMap k f+difference :: GCompare k => DMap k f -> DMap k g -> DMap k f difference Tip _ = Tip difference t1 Tip = t1 difference t1 t2 = hedgeDiff (const LT) (const GT) t1 t2 hedgeDiff :: GCompare k- => (Some k -> Ordering) -> (Some k -> Ordering) -> DMap k f -> DMap k f+ => (Some k -> Ordering) -> (Some k -> Ordering) -> DMap k f -> DMap k g -> DMap k f hedgeDiff _ _ Tip _ = Tip@@ -617,15 +622,15 @@ -- If it returns 'Nothing', the element is discarded (proper set difference). If -- it returns (@'Just' y@), the element is updated with a new value @y@. -- The implementation uses an efficient /hedge/ algorithm comparable with /hedge-union/.-differenceWithKey :: GCompare k => (forall v. k v -> f v -> f v -> Maybe (f v)) -> DMap k f -> DMap k f -> DMap k f+differenceWithKey :: GCompare k => (forall v. k v -> f v -> g v -> Maybe (f v)) -> DMap k f -> DMap k g -> DMap k f differenceWithKey _ Tip _ = Tip differenceWithKey _ t1 Tip = t1 differenceWithKey f t1 t2 = hedgeDiffWithKey f (const LT) (const GT) t1 t2 hedgeDiffWithKey :: GCompare k- => (forall v. k v -> f v -> f v -> Maybe (f v))+ => (forall v. k v -> f v -> g v -> Maybe (f v)) -> (Some k -> Ordering) -> (Some k -> Ordering)- -> DMap k f -> DMap k f+ -> DMap k f -> DMap k g -> DMap k f hedgeDiffWithKey _ _ _ Tip _ = Tip@@ -663,7 +668,7 @@ -- | /O(n+m)/. Intersection with a combining function. -- Intersection is more efficient on (bigset \``intersection`\` smallset).-intersectionWithKey :: GCompare k => (forall v. k v -> f v -> f v -> f v) -> DMap k f -> DMap k f -> DMap k f+intersectionWithKey :: GCompare k => (forall v. k v -> f v -> g v -> h v) -> DMap k f -> DMap k g -> DMap k h intersectionWithKey _ Tip _ = Tip intersectionWithKey _ _ Tip = Tip intersectionWithKey f t1@(Bin s1 k1 x1 l1 r1) t2@(Bin s2 k2 x2 l2 r2) =@@ -697,11 +702,11 @@ all keys in @t1@ are in tree @t2@, and when @f@ returns 'True' when applied to their respective keys and values. -}-isSubmapOfBy :: GCompare k => (forall v. k v -> k v -> f v -> f v -> Bool) -> DMap k f -> DMap k f -> Bool+isSubmapOfBy :: GCompare k => (forall v. k v -> k v -> f v -> g v -> Bool) -> DMap k f -> DMap k g -> Bool isSubmapOfBy f t1 t2 = (size t1 <= size t2) && (submap' f t1 t2) -submap' :: GCompare k => (forall v. k v -> k v -> f v -> f v -> Bool) -> DMap k f -> DMap k f -> Bool+submap' :: GCompare k => (forall v. k v -> k v -> f v -> g v -> Bool) -> DMap k f -> DMap k g -> Bool submap' _ Tip _ = True submap' _ _ Tip = False submap' f (Bin _ kx x l r) t@@ -723,7 +728,7 @@ all keys in @m1@ are in @m2@, and when @f@ returns 'True' when applied to their respective keys and values. -}-isProperSubmapOfBy :: GCompare k => (forall v. k v -> k v -> f v -> f v -> Bool) -> DMap k f -> DMap k f -> Bool+isProperSubmapOfBy :: GCompare k => (forall v. k v -> k v -> f v -> g v -> Bool) -> DMap k f -> DMap k g -> Bool isProperSubmapOfBy f t1 t2 = (size t1 < size t2) && (submap' f t1 t2) @@ -753,7 +758,7 @@ (r1,r2) = partitionWithKey p r -- | /O(n)/. Map keys\/values and collect the 'Just' results.-mapMaybeWithKey :: GCompare k => (forall v. k v -> f v -> Maybe (f v)) -> DMap k f -> DMap k f+mapMaybeWithKey :: GCompare k => (forall v. k v -> f v -> Maybe (g v)) -> DMap k f -> DMap k g mapMaybeWithKey f = go where go Tip = Tip@@ -763,7 +768,7 @@ -- | /O(n)/. Map keys\/values and separate the 'Left' and 'Right' results. mapEitherWithKey :: GCompare k =>- (forall v. k v -> f v -> Either (f v) (f v)) -> DMap k f -> (DMap k f, DMap k f)+ (forall v. k v -> f v -> Either (g v) (h v)) -> DMap k f -> (DMap k g, DMap k h) mapEitherWithKey _ Tip = (Tip, Tip) mapEitherWithKey f (Bin _ kx x l r) = case f kx x of Left y -> (combine kx y l1 r1, merge l2 r2)@@ -777,7 +782,7 @@ --------------------------------------------------------------------} -- | /O(n)/. Map a function over all values in the map.-mapWithKey :: (forall v. k v -> f v -> f v) -> DMap k f -> DMap k f+mapWithKey :: (forall v. k v -> f v -> g v) -> DMap k f -> DMap k g mapWithKey f = go where go Tip = Tip@@ -785,7 +790,7 @@ -- | /O(n)/. The function 'mapAccumLWithKey' threads an accumulating -- argument throught the map in ascending order of keys.-mapAccumLWithKey :: (forall v. a -> k v -> f v -> (a, f v)) -> a -> DMap k f -> (a, DMap k f)+mapAccumLWithKey :: (forall v. a -> k v -> f v -> (a, g v)) -> a -> DMap k f -> (a, DMap k g) mapAccumLWithKey f = go where go a Tip = (a,Tip)@@ -797,7 +802,7 @@ -- | /O(n)/. The function 'mapAccumRWithKey' threads an accumulating -- argument through the map in descending order of keys.-mapAccumRWithKey :: (forall v. a -> k v -> f v -> (a, f v)) -> a -> DMap k f -> (a, DMap k f)+mapAccumRWithKey :: (forall v. a -> k v -> f v -> (a, g v)) -> a -> DMap k f -> (a, DMap k g) mapAccumRWithKey f = go where go a Tip = (a,Tip)