Skip to content

Commit 53bfa66

Browse files
authored
Merge pull request #195 from reflex-frp/rmm-docallthethings2
Another batch of doc comments
2 parents fcdfb5a + 4f96b76 commit 53bfa66

File tree

7 files changed

+182
-43
lines changed

7 files changed

+182
-43
lines changed

src/Data/Map/Misc.hs

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
{-# LANGUAGE LambdaCase #-}
2+
-- | Additional functions for manipulating 'Map's.
23
module Data.Map.Misc
34
(
45
-- * Working with Maps
@@ -10,20 +11,28 @@ module Data.Map.Misc
1011
) where
1112

1213
import Data.Align
13-
import Data.Either (isLeft)
1414
import Data.Map (Map)
1515
import qualified Data.Map as Map
1616
import Data.Maybe
1717
import Data.Set (Set)
1818
import qualified Data.Set as Set
1919
import Data.These
2020

21+
-- |Produce a @'Map' k (Maybe v)@ by comparing two @'Map' k v@s, @old@ and @new@ respectively. @Just@ represents an association present in @new@ and @Nothing@
22+
-- represents an association only present in @old@ but no longer present in @new@.
23+
--
24+
-- Similar to 'diffMap' but doesn't require 'Eq' on the values, thus can't tell if a value has changed or not.
2125
diffMapNoEq :: (Ord k) => Map k v -> Map k v -> Map k (Maybe v)
2226
diffMapNoEq olds news = flip Map.mapMaybe (align olds news) $ \case
2327
This _ -> Just Nothing
2428
These _ new -> Just $ Just new
2529
That new -> Just $ Just new
2630

31+
-- |Produce a @'Map' k (Maybe v)@ by comparing two @'Map' k v@s, @old@ and @new respectively. @Just@ represents an association present in @new@ and either not
32+
-- present in @old@ or where the value has changed. @Nothing@ represents an association only present in @old@ but no longer present in @new@.
33+
--
34+
-- See also 'diffMapNoEq' for a similar but weaker version which does not require 'Eq' on the values but thus can't indicated a value not changing between
35+
-- @old@ and @new@ with @Nothing@.
2736
diffMap :: (Ord k, Eq v) => Map k v -> Map k v -> Map k (Maybe v)
2837
diffMap olds news = flip Map.mapMaybe (align olds news) $ \case
2938
This _ -> Just Nothing
@@ -32,23 +41,29 @@ diffMap olds news = flip Map.mapMaybe (align olds news) $ \case
3241
| otherwise -> Just $ Just new
3342
That new -> Just $ Just new
3443

44+
-- |Given a @'Map' k (Maybe v)@ representing keys to insert/update (@Just@) or delete (@Nothing@), produce a new map from the given input @'Map' k v@.
45+
--
46+
-- See also 'Reflex.Patch.Map' and 'Reflex.Patch.MapWithMove'.
3547
applyMap :: Ord k => Map k (Maybe v) -> Map k v -> Map k v
3648
applyMap patch old = insertions `Map.union` (old `Map.difference` deletions)
3749
where (deletions, insertions) = mapPartitionEithers $ maybeToEither <$> patch
3850
maybeToEither = \case
3951
Nothing -> Left ()
4052
Just r -> Right r
4153

54+
-- |Split a @'Map' k (Either a b)@ into @Map k a@ and @Map k b@, equivalent to @'Map.mapEither' id@
4255
mapPartitionEithers :: Map k (Either a b) -> (Map k a, Map k b)
43-
mapPartitionEithers m = (fromLeft <$> ls, fromRight <$> rs)
44-
where (ls, rs) = Map.partition isLeft m
45-
fromLeft (Left l) = l
46-
fromLeft _ = error "mapPartitionEithers: fromLeft received a Right value; this should be impossible"
47-
fromRight (Right r) = r
48-
fromRight _ = error "mapPartitionEithers: fromRight received a Left value; this should be impossible"
56+
mapPartitionEithers = Map.mapEither id
4957

50-
-- | Apply a map patch to a set
51-
-- > applyMapKeysSet patch (Map.keysSet m) == Map.keysSet (applyMap patch m)
58+
-- |Given a @'Map' k (Maybe v)@ representing keys to insert/update (@Just@) or delete (@Nothing@), produce a new @'Set' k@ from the given input set.
59+
--
60+
-- Equivalent to:
61+
--
62+
-- @
63+
-- applyMapKeysSet patch ('Map.keysSet' m) == 'Map.keysSet' ('applyMap' patch m)
64+
-- @
65+
--
66+
-- but avoids the intervening @Map@ and needs no values.
5267
applyMapKeysSet :: Ord k => Map k (Maybe v) -> Set k -> Set k
5368
applyMapKeysSet patch old = Map.keysSet insertions `Set.union` (old `Set.difference` Map.keysSet deletions)
5469
where (insertions, deletions) = Map.partition isJust patch

src/Reflex/FastWeak.hs

Lines changed: 55 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,15 @@
55
{-# LANGUAGE ForeignFunctionInterface #-}
66
{-# LANGUAGE JavaScriptFFI #-}
77
#endif
8+
9+
-- | 'FastWeak' is a weak pointer to some value, and 'FastWeakTicket' ensures the value
10+
-- referred to by a 'FastWeak' stays live while the ticket is held (live).
11+
--
12+
-- On GHC or GHCJS when not built with the @fast-weak@ cabal flag, 'FastWeak' is a wrapper
13+
-- around the simple version of 'System.Mem.Weak.Weak' where the key and value are the same.
14+
--
15+
-- On GHCJS when built with the @fast-weak@ cabal flag, 'FastWeak' is implemented directly
16+
-- in JS using @h$FastWeak@ and @h$FastWeakTicket@ which are a nonstandard part of the GHCJS RTS.
817
module Reflex.FastWeak
918
( FastWeakTicket
1019
, FastWeak
@@ -35,29 +44,57 @@ import System.Mem.Weak
3544

3645

3746
#ifdef GHCJS_FAST_WEAK
47+
-- | A 'FastWeak' which has been promoted to a strong reference. 'getFastWeakTicketValue'
48+
-- can be used to get the referred to value without fear of @Nothing,
49+
-- and 'getFastWeakTicketWeak' can be used to get the weak version.
50+
--
51+
-- Implemented by way of special support in the GHCJS RTS, @h$FastWeakTicket@.
3852
newtype FastWeakTicket a = FastWeakTicket JSVal
3953

54+
-- | A reference to some value which can be garbage collected if there are only
55+
-- weak references to the value left.
56+
--
57+
-- 'getFastWeakValue' can be used to try and obtain a strong reference to the value.
58+
--
59+
-- The value in a @FastWeak@ can also be kept alive by obtaining a 'FastWeakTicket' using
60+
-- 'getFastWeakTicket' if the value hasn't been collected yet.
61+
--
62+
-- Implemented by way of special support in the GHCJS RTS, @h$FastWeak@.
4063
newtype FastWeak a = FastWeak JSVal
4164

4265
-- Just designed to mirror JSVal, so that we can unsafeCoerce between the two
4366
data Val a = Val { unVal :: a }
4467

45-
-- | Coerce a JSVal that represents the heap object of a value of type 'a' into a value of type 'a'
68+
-- | Coerce a JSVal that represents the heap object of a value of type @a@ into a value of type @a@
4669
unsafeFromRawJSVal :: JSVal -> a
4770
unsafeFromRawJSVal v = unVal (unsafeCoerce v)
4871

72+
-- | Coerce a heap object of type @a@ into a 'JSVal' which represents that object.
4973
unsafeToRawJSVal :: a -> JSVal
5074
unsafeToRawJSVal v = unsafeCoerce (Val v)
5175
#else
76+
-- | A 'FastWeak' which has been promoted to a strong reference. 'getFastWeakTicketValue'
77+
-- can be used to get the referred to value without fear of @Nothing@,
78+
-- and 'getFastWeakTicketWeak' can be used to get the weak version.
5279
data FastWeakTicket a = FastWeakTicket
5380
{ _fastWeakTicket_val :: !a
5481
, _fastWeakTicket_weak :: {-# UNPACK #-} !(Weak a)
5582
}
5683

84+
-- | A reference to some value which can be garbage collected if there are only weak references to the value left.
85+
--
86+
-- 'getFastWeakValue' can be used to try and obtain a strong reference to the value.
87+
--
88+
-- The value in a @FastWeak@ can also be kept alive by obtaining a 'FastWeakTicket' using 'getFastWeakTicket'
89+
-- if the value hasn't been collected yet.
90+
--
91+
-- Synonymous with 'Weak'.
5792
type FastWeak a = Weak a
5893
#endif
5994

60-
-- This needs to be in IO so we know that we've relinquished the ticket
95+
-- | Return the @a@ kept alive by the given 'FastWeakTicket'.
96+
--
97+
-- This needs to be in IO so we know that we've relinquished the ticket.
6198
getFastWeakTicketValue :: FastWeakTicket a -> IO a
6299
#ifdef GHCJS_FAST_WEAK
63100
getFastWeakTicketValue t = do
@@ -69,6 +106,8 @@ foreign import javascript unsafe "$r = $1.val;" js_ticketVal :: FastWeakTicket a
69106
getFastWeakTicketValue = return . _fastWeakTicket_val
70107
#endif
71108

109+
-- | Get the value referred to by a 'FastWeak' if it hasn't yet been collected,
110+
-- or @Nothing@ if it has been collected.
72111
getFastWeakValue :: FastWeak a -> IO (Maybe a)
73112
#ifdef GHCJS_FAST_WEAK
74113
getFastWeakValue w = do
@@ -84,6 +123,9 @@ foreign import javascript unsafe "$r = ($1.ticket === null) ? null : $1.ticket.v
84123
getFastWeakValue = deRefWeak
85124
#endif
86125

126+
-- | Try to create a 'FastWeakTicket' for the given 'FastWeak' which will ensure the value referred
127+
-- remains alive. Returns @Just@ if the value hasn't been collected
128+
-- and a ticket can therefore be obtained, @Nothing@ if it's been collected.
87129
getFastWeakTicket :: forall a. FastWeak a -> IO (Maybe (FastWeakTicket a))
88130
#ifdef GHCJS_FAST_WEAK
89131
getFastWeakTicket w = do
@@ -103,8 +145,11 @@ getFastWeakTicket w = do
103145
}
104146
#endif
105147

106-
-- I think it's fine if this is lazy - it'll retain the 'a', but so would the output; we just need to make sure it's forced before we start relying on the associated FastWeak to actually be weak
148+
-- | Create a 'FastWeakTicket' directly from a value, creating a 'FastWeak' in the process
149+
-- which can be obtained with 'getFastWeakTicketValue'.
107150
mkFastWeakTicket :: a -> IO (FastWeakTicket a)
151+
-- I think it's fine if this is lazy - it'll retain the 'a', but so would the output; we just need to make sure it's forced before we start relying on the
152+
-- associated FastWeak to actually be weak
108153
#ifdef GHCJS_FAST_WEAK
109154
mkFastWeakTicket v = js_fastWeakTicket (unsafeToRawJSVal v)
110155

@@ -119,11 +164,16 @@ mkFastWeakTicket v = do
119164
}
120165
#endif
121166

167+
-- | Demote a 'FastWeakTicket'; which ensures the value is alive, to a 'FastWeak' which doesn't.
168+
-- Note that unless the ticket for the same 'FastWeak' is held in some other way
169+
-- the value might be collected immediately.
170+
getFastWeakTicketWeak :: FastWeakTicket a -> IO (FastWeak a)
122171
-- Needs IO so that it can force the value - otherwise, could end up with a reference to the Ticket, which would retain the value
123172
#ifdef GHCJS_FAST_WEAK
124-
foreign import javascript unsafe "$r = $1.weak;" getFastWeakTicketWeak :: FastWeakTicket a -> IO (FastWeak a)
173+
foreign import javascript unsafe "$r = $1.weak;" getFastWeakTicketWeak' :: FastWeakTicket a -> IO (FastWeak a)
174+
{-# INLINE getFastWeakTicketWeak #-}
175+
getFastWeakTicketWeak = getFastWeakTicketWeak'
125176
#else
126-
getFastWeakTicketWeak :: FastWeakTicket a -> IO (FastWeak a)
127177
getFastWeakTicketWeak = return . _fastWeakTicket_weak
128178
#endif
129179

src/Reflex/Patch/DMap.hs

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
{-# LANGUAGE ScopedTypeVariables #-}
66
{-# LANGUAGE StandaloneDeriving #-}
77
{-# LANGUAGE TypeFamilies #-}
8+
-- | 'Patch'es on 'DMap' that consist only of insertions (or overwrites) and deletions.
89
module Reflex.Patch.DMap where
910

1011
import Reflex.Patch.Class
@@ -20,14 +21,16 @@ import qualified Data.Map as Map
2021
import Data.Semigroup (Semigroup (..))
2122
import Data.Some (Some)
2223

23-
-- | A set of changes to a 'DMap'. Any element may be inserted/updated or
24-
-- deleted.
24+
-- | A set of changes to a 'DMap'. Any element may be inserted/updated or deleted.
25+
-- Insertions are represented as @'ComposeMaybe' (Just value)@,
26+
-- while deletions are represented as @'ComposeMaybe' Nothing@.
2527
newtype PatchDMap k v = PatchDMap { unPatchDMap :: DMap k (ComposeMaybe v) }
2628

2729
deriving instance GCompare k => Semigroup (PatchDMap k v)
2830

2931
deriving instance GCompare k => Monoid (PatchDMap k v)
3032

33+
-- | Apply the insertions or deletions to a given 'DMap'.
3134
instance GCompare k => Patch (PatchDMap k v) where
3235
type PatchTarget (PatchDMap k v) = DMap k v
3336
apply (PatchDMap diff) old = Just $! insertions `DMap.union` (old `DMap.difference` deletions) --TODO: return Nothing sometimes --Note: the strict application here is critical to ensuring that incremental merges don't hold onto all their prerequisite events forever; can we make this more robust?
@@ -37,32 +40,43 @@ instance GCompare k => Patch (PatchDMap k v) where
3740
Nothing -> Just $ Constant ()
3841
Just _ -> Nothing
3942

43+
-- | Map a function @v a -> v' a@ over any inserts/updates in the given
44+
-- @'PatchDMap' k v@ to produce a @'PatchDMap' k v'@.
4045
mapPatchDMap :: (forall a. v a -> v' a) -> PatchDMap k v -> PatchDMap k v'
4146
mapPatchDMap f (PatchDMap p) = PatchDMap $ DMap.map (ComposeMaybe . fmap f . getComposeMaybe) p
4247

43-
traversePatchDMap :: Applicative m => (forall a. v a -> m (v' a)) -> PatchDMap k v -> m (PatchDMap k v')
48+
-- | Map an effectful function @v a -> f (v' a)@ over any inserts/updates in the given
49+
-- @'PatchDMap' k v@ to produce a @'PatchDMap' k v'@.
50+
traversePatchDMap :: Applicative f => (forall a. v a -> f (v' a)) -> PatchDMap k v -> f (PatchDMap k v')
4451
traversePatchDMap f = traversePatchDMapWithKey $ const f
4552

53+
-- | Map an effectful function @k a -> v a -> f (v' a)@ over any inserts/updates
54+
-- in the given @'PatchDMap' k v@ to produce a @'PatchDMap' k v'@.
4655
traversePatchDMapWithKey :: Applicative m => (forall a. k a -> v a -> m (v' a)) -> PatchDMap k v -> m (PatchDMap k v')
4756
traversePatchDMapWithKey f (PatchDMap p) = PatchDMap <$> DMap.traverseWithKey (\k (ComposeMaybe v) -> ComposeMaybe <$> traverse (f k) v) p
4857

58+
-- | Weaken a @'PatchDMap' k v@ to a @'PatchMap' (Some k) v'@ using a function
59+
-- @v a -> v'@ to weaken each value contained in the patch.
4960
weakenPatchDMapWith :: (forall a. v a -> v') -> PatchDMap k v -> PatchMap (Some k) v'
5061
weakenPatchDMapWith f (PatchDMap p) = PatchMap $ weakenDMapWith (fmap f . getComposeMaybe) p
5162

52-
patchDMapToPatchMapWith :: (f v -> v') -> PatchDMap (Const2 k v) f -> PatchMap k v'
63+
-- | Convert a weak @'PatchDMap' ('Const2' k a) v@ where the @a@ is known by way of
64+
-- the @Const2@ into a @'PatchMap' k v'@ using a rank 1 function @v a -> v'@.
65+
patchDMapToPatchMapWith :: (v a -> v') -> PatchDMap (Const2 k a) v -> PatchMap k v'
5366
patchDMapToPatchMapWith f (PatchDMap p) = PatchMap $ dmapToMapWith (fmap f . getComposeMaybe) p
5467

55-
const2PatchDMapWith :: forall k v f a. (v -> f a) -> PatchMap k v -> PatchDMap (Const2 k a) f
68+
-- | Convert a @'PatchMap' k v@ into a @'PatchDMap' ('Const2' k a) v'@ using a function @v -> v' a@.
69+
const2PatchDMapWith :: forall k v v' a. (v -> v' a) -> PatchMap k v -> PatchDMap (Const2 k a) v'
5670
const2PatchDMapWith f (PatchMap p) = PatchDMap $ DMap.fromDistinctAscList $ g <$> Map.toAscList p
57-
where g :: (k, Maybe v) -> DSum (Const2 k a) (ComposeMaybe f)
71+
where g :: (k, Maybe v) -> DSum (Const2 k a) (ComposeMaybe v')
5872
g (k, e) = Const2 k :=> ComposeMaybe (f <$> e)
5973

74+
-- | Convert a @'PatchIntMap' v@ into a @'PatchDMap' ('Const2' Int a) v'@ using a function @v -> v' a@.
6075
const2IntPatchDMapWith :: forall v f a. (v -> f a) -> PatchIntMap v -> PatchDMap (Const2 IntMap.Key a) f
6176
const2IntPatchDMapWith f (PatchIntMap p) = PatchDMap $ DMap.fromDistinctAscList $ g <$> IntMap.toAscList p
6277
where g :: (IntMap.Key, Maybe v) -> DSum (Const2 IntMap.Key a) (ComposeMaybe f)
6378
g (k, e) = Const2 k :=> ComposeMaybe (f <$> e)
6479

65-
-- | Get the values that will be deleted if the given patch is applied to the
66-
-- given 'DMap'. Includes values that will be replaced.
80+
-- | Get the values that will be replaced or deleted if the given patch is applied to the given 'DMap'.
6781
getDeletions :: GCompare k => PatchDMap k v -> DMap k v' -> DMap k v'
6882
getDeletions (PatchDMap p) m = DMap.intersectionWithKey (\_ v _ -> v) m p

src/Reflex/Patch/DMapWithMove.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,7 @@ validationErrorsForPatchDMapWithMove m =
104104
Just $ "unbalanced move at source key " <> gshow src <> " supposedly going to " <> gshow dst <> " but destination key is not moving"
105105
unbalancedMove _ = Nothing
106106

107+
-- |Test whether two @'PatchDMapWithMove' k v@ contain the same patch operations.
107108
instance EqTag k (NodeInfo k v) => Eq (PatchDMapWithMove k v) where
108109
PatchDMapWithMove a == PatchDMapWithMove b = a == b
109110

@@ -341,6 +342,7 @@ const2PatchDMapWithMoveWith f (PatchMapWithMove p) = PatchDMapWithMove $ DMap.fr
341342
, _nodeInfo_to = ComposeMaybe $ Const2 <$> MapWithMove._nodeInfo_to ni
342343
}
343344

345+
-- | Apply the insertions, deletions, and moves to a given 'DMap'.
344346
instance GCompare k => Patch (PatchDMapWithMove k v) where
345347
type PatchTarget (PatchDMapWithMove k v) = DMap k v
346348
apply (PatchDMapWithMove p) old = Just $! insertions `DMap.union` (old `DMap.difference` deletions) --TODO: return Nothing sometimes --Note: the strict application here is critical to ensuring that incremental merges don't hold onto all their prerequisite events forever; can we make this more robust?
@@ -356,8 +358,7 @@ instance GCompare k => Patch (PatchDMapWithMove k v) where
356358
From_Delete -> Just $ Constant ()
357359
_ -> Nothing
358360

359-
-- | Get the values that will be deleted or moved if the given patch is applied
360-
-- to the given 'DMap'.
361+
-- | Get the values that will be replaced, deleted, or moved if the given patch is applied to the given 'DMap'.
361362
getDeletionsAndMoves :: GCompare k => PatchDMapWithMove k v -> DMap k v' -> DMap k (Product v' (ComposeMaybe k))
362363
getDeletionsAndMoves (PatchDMapWithMove p) m = DMap.intersectionWithKey f m p
363364
where f _ v ni = Pair v $ _nodeInfo_to ni

src/Reflex/Patch/IntMap.hs

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
{-# LANGUAGE DeriveTraversable #-}
55
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
66
{-# LANGUAGE TypeFamilies #-}
7+
-- | Module containing 'PatchIntMap', a 'Patch' for 'IntMap' which allows for
8+
-- insert/update or delete of associations.
79
module Reflex.Patch.IntMap where
810

911
import Data.IntMap.Strict (IntMap)
@@ -12,8 +14,12 @@ import Data.Maybe
1214
import Data.Semigroup
1315
import Reflex.Patch.Class
1416

17+
-- | 'Patch' for 'IntMap' which represents insertion or deletion of keys in the mapping.
18+
-- Internally represented by 'IntMap (Maybe a)', where @Just@ means insert/update
19+
-- and @Nothing@ means delete.
1520
newtype PatchIntMap a = PatchIntMap (IntMap (Maybe a)) deriving (Functor, Foldable, Traversable, Monoid)
1621

22+
-- | Apply the insertions or deletions to a given 'IntMap'.
1723
instance Patch (PatchIntMap a) where
1824
type PatchTarget (PatchIntMap a) = IntMap a
1925
apply (PatchIntMap p) v = if IntMap.null p then Nothing else Just $
@@ -36,14 +42,26 @@ instance Semigroup (PatchIntMap v) where
3642
GT -> x
3743
#endif
3844

39-
traverseIntMapPatchWithKey :: Applicative t => (Int -> a -> t b) -> PatchIntMap a -> t (PatchIntMap b)
45+
-- | Map a function @Int -> a -> b@ over all @a@s in the given @'PatchIntMap' a@
46+
-- (that is, all inserts/updates), producing a @PatchIntMap b@.
47+
mapIntMapPatchWithKey :: (Int -> a -> b) -> PatchIntMap a -> PatchIntMap b
48+
mapIntMapPatchWithKey f (PatchIntMap m) = PatchIntMap $ IntMap.mapWithKey (\ k mv -> f k <$> mv) m
49+
50+
-- | Map an effectful function @Int -> a -> f b@ over all @a@s in the given @'PatchIntMap' a@
51+
-- (that is, all inserts/updates), producing a @f (PatchIntMap b)@.
52+
traverseIntMapPatchWithKey :: Applicative f => (Int -> a -> f b) -> PatchIntMap a -> f (PatchIntMap b)
4053
traverseIntMapPatchWithKey f (PatchIntMap m) = PatchIntMap <$> IntMap.traverseWithKey (\k mv -> traverse (f k) mv) m
4154

55+
-- | Extract all @a@s inserted/updated by the given @'PatchIntMap' a@.
4256
patchIntMapNewElements :: PatchIntMap a -> [a]
4357
patchIntMapNewElements (PatchIntMap m) = catMaybes $ IntMap.elems m
4458

59+
-- | Convert the given @'PatchIntMap' a@ into an @'IntMap' a@ with all
60+
-- the inserts/updates in the given patch.
4561
patchIntMapNewElementsMap :: PatchIntMap a -> IntMap a
4662
patchIntMapNewElementsMap (PatchIntMap m) = IntMap.mapMaybe id m
4763

64+
-- | Subset the given @'IntMap' a@ to contain only the keys that would be
65+
-- deleted by the given @'PatchIntMap' a@.
4866
getDeletions :: PatchIntMap v -> IntMap v' -> IntMap v'
4967
getDeletions (PatchIntMap m) v = IntMap.intersection v m

src/Reflex/Patch/Map.hs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@ import Data.Semigroup
1818
newtype PatchMap k v = PatchMap { unPatchMap :: Map k (Maybe v) }
1919
deriving (Show, Read, Eq, Ord)
2020

21-
-- | Applying a 'PatchMap' will update the 'Map' by performing the insertions
22-
-- and deletions specified
21+
-- | Apply the insertions or deletions to a given 'Map'.
2322
instance Ord k => Patch (PatchMap k v) where
2423
type PatchTarget (PatchMap k v) = Map k v
2524
{-# INLINABLE apply #-}

0 commit comments

Comments
 (0)