Added a new function, filterMapByKey, to the Utils module
This commit is contained in:
parent
2ecd91e36f
commit
56a10b403f
|
@ -346,6 +346,9 @@ mapMapWithKeyM f m = liftM Map.fromAscList $ mapM f' $ Map.toAscList m
|
|||
f' (x,y) = do y' <- f x y
|
||||
return (x, y')
|
||||
|
||||
filterMapByKey :: Ord k => (k -> Bool) -> Map.Map k v -> Map.Map k v
|
||||
filterMapByKey f = Map.filterWithKey (\k _ -> f k)
|
||||
|
||||
-- | Transforms an Either into a Maybe. If it's a Left value, it is transformed
|
||||
-- into Nothing. If it is a Right value, it is transformed into Just.
|
||||
eitherToMaybe :: Either a b -> Maybe b
|
||||
|
|
Loading…
Reference in New Issue
Block a user