1
1
mirror of https://github.com/github/semantic.git synced 2024-12-22 06:11:49 +03:00

📝 storeInsert.

This commit is contained in:
Rob Rix 2017-12-20 17:19:29 -05:00
parent fd14bb4672
commit 82468ec491

View File

@ -32,6 +32,7 @@ storeLookup (Address address) = Map.lookup address . unStore
storeLookupAll :: (Ord l, Foldable (Cell l)) => Address l a -> Store l a -> Maybe [a]
storeLookupAll address = fmap toList . storeLookup address
-- | Append a value onto the cell for a given address, inserting a new cell if none existed.
storeInsert :: (Ord l, Semigroup (Cell l a), Pointed (Cell l)) => Address l a -> a -> Store l a -> Store l a
storeInsert (Address address) value = Store . Map.insertWith (<>) address (point value) . unStore