Skip to content

Commit d30146e

Browse files
authored
Add some examples to intercalate documentation
1 parent 1de5713 commit d30146e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/Data/Foldable.purs

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,16 @@ oneOfMap f = foldr (alt <<< f) empty
240240

241241
-- | Fold a data structure, accumulating values in some `Monoid`,
242242
-- | combining adjacent elements using the specified separator.
243+
-- |
244+
-- | For example:
245+
-- |
246+
-- | ```purescript
247+
-- | > intercalate ", " ["Lorem", "ipsum", "dolor"]
248+
-- | = "Lorem, ipsum, dolor"
249+
-- |
250+
-- | > intercalate "*" ["a", "b", "c"]
251+
-- | = "a*b*c"
252+
-- | ```
243253
intercalate :: forall f m. Foldable f => Monoid m => m -> f m -> m
244254
intercalate sep xs = (foldl go { init: true, acc: mempty } xs).acc
245255
where

0 commit comments

Comments
 (0)