Skip to content

Commit 45d1e4f

Browse files
authored
Improve documentation for Map functions with bounds params (#74)
* Make it clear that the bounds are inclusive. Previously this was ambiguous in the prose and only indicated by the examples. * Generally tighten up the writing.
1 parent b9c8ec7 commit 45d1e4f

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

src/Data/Map/Internal.purs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -365,10 +365,9 @@ findMin = case _ of
365365
Leaf -> Just { key: k, value: v }
366366
_ -> findMin l
367367

368-
-- | Fold over the entries of a given map where the key is between a lower and
369-
-- | an upper bound. Passing `Nothing` as either the lower or upper bound
370-
-- | argument means that the fold has no lower or upper bound, i.e. the fold
371-
-- | starts from (or ends with) the smallest (or largest) key in the map.
368+
-- | Fold over the entries of a given map that have keys within a lower and
369+
-- | upper bound (including keys equal to those bounds). `Nothing` is treated as
370+
-- | unbounded.
372371
-- |
373372
-- | ```purescript
374373
-- | foldSubmap (Just 1) (Just 2) (\_ v -> [v])
@@ -420,10 +419,9 @@ foldSubmapBy appendFn memptyValue kmin kmax f =
420419
in
421420
go
422421

423-
-- | Returns a new map containing all entries of the given map which lie
424-
-- | between a given lower and upper bound, treating `Nothing` as no bound i.e.
425-
-- | including the smallest (or largest) key in the map, no matter how small
426-
-- | (or large) it is. For example:
422+
-- | Returns a new map containing all entries with keys that fall within a
423+
-- | specified lower and upper bound (including keys equal to those bounds).
424+
-- | `Nothing` is treated as unbounded.
427425
-- |
428426
-- | ```purescript
429427
-- | submap (Just 1) (Just 2)

0 commit comments

Comments
 (0)