mirror of
https://github.com/github/semantic.git
synced 2024-11-28 18:23:44 +03:00
Revert "Add a filter
function to OrderedMap
."
This reverts commit 6c5ad05a702cf612cab9bbbc779f4cac7af44462.
This commit is contained in:
parent
3ca7042ed1
commit
627d050f86
@ -11,7 +11,6 @@ module OrderedMap (
|
|||||||
, unions
|
, unions
|
||||||
, intersectionWith
|
, intersectionWith
|
||||||
, difference
|
, difference
|
||||||
, OrderedMap.filter
|
|
||||||
) where
|
) where
|
||||||
|
|
||||||
import qualified Data.Maybe as Maybe
|
import qualified Data.Maybe as Maybe
|
||||||
@ -44,7 +43,7 @@ empty :: OrderedMap key value
|
|||||||
empty = OrderedMap []
|
empty = OrderedMap []
|
||||||
|
|
||||||
union :: Eq key => OrderedMap key value -> OrderedMap key value -> OrderedMap key value
|
union :: Eq key => OrderedMap key value -> OrderedMap key value -> OrderedMap key value
|
||||||
union (OrderedMap a) (OrderedMap b) = OrderedMap $ a ++ Prelude.filter (not . (`elem` extant) . fst) b
|
union (OrderedMap a) (OrderedMap b) = OrderedMap $ a ++ filter (not . (`elem` extant) . fst) b
|
||||||
where extant = fst <$> a
|
where extant = fst <$> a
|
||||||
|
|
||||||
unions :: Eq key => [OrderedMap key value] -> OrderedMap key value
|
unions :: Eq key => [OrderedMap key value] -> OrderedMap key value
|
||||||
@ -54,8 +53,5 @@ intersectionWith :: Eq key => (a -> b -> c) -> OrderedMap key a -> OrderedMap ke
|
|||||||
intersectionWith combine (OrderedMap a) (OrderedMap b) = OrderedMap $ a >>= (\ (key, value) -> maybe [] (pure . (,) key . combine value) $ Prelude.lookup key b)
|
intersectionWith combine (OrderedMap a) (OrderedMap b) = OrderedMap $ a >>= (\ (key, value) -> maybe [] (pure . (,) key . combine value) $ Prelude.lookup key b)
|
||||||
|
|
||||||
difference :: Eq key => OrderedMap key a -> OrderedMap key b -> OrderedMap key a
|
difference :: Eq key => OrderedMap key a -> OrderedMap key b -> OrderedMap key a
|
||||||
difference (OrderedMap a) (OrderedMap b) = OrderedMap $ Prelude.filter (not . (`elem` extant) . fst) a
|
difference (OrderedMap a) (OrderedMap b) = OrderedMap $ filter (not . (`elem` extant) . fst) a
|
||||||
where extant = fst <$> b
|
where extant = fst <$> b
|
||||||
|
|
||||||
filter :: (a -> Bool) -> OrderedMap key a -> OrderedMap key a
|
|
||||||
filter predicate (OrderedMap pairs) = OrderedMap $ Prelude.filter (predicate . snd) pairs
|
|
||||||
|
Loading…
Reference in New Issue
Block a user