Add map creating utility after merge confligt
This commit is contained in:
parent
bf88b19f1c
commit
7b486702f4
@ -932,6 +932,11 @@ mapFromSetM = (sequenceA .) . Map.fromSet
|
||||
setToMap :: (Ord k) => (v -> k) -> Set v -> Map k v
|
||||
setToMap mkKey = Map.fromList . fmap (\x -> (mkKey x, x)) . Set.toList
|
||||
|
||||
-- Create a Map given a key-computation
|
||||
-- For Entity, use Utils.DB.entities2map instead
|
||||
mapFromFoldable :: (Ord k, Foldable t) => (v -> k) -> t v -> Map k v
|
||||
mapFromFoldable getKey = foldMap (Map.singleton =<< getKey)
|
||||
|
||||
mapFM :: (Applicative m, Ord k, Finite k) => (k -> m v) -> m (Map k v)
|
||||
mapFM = sequenceA . mapF
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user