Skip to content

Commit d60cc11

Browse files
natefaubionpaf31
authored andcommitted
Add oneOfMap (#75)
1 parent c4875cc commit d60cc11

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/Data/Foldable.purs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,10 @@ sequence_ = traverse_ id
233233
oneOf :: forall f g a. Foldable f => Plus g => f (g a) -> g a
234234
oneOf = foldr alt empty
235235

236+
-- | Folds a structure into some `Plus`.
237+
oneOfMap :: forall f g a b. Foldable f => Plus g => (a -> g b) -> f a -> g b
238+
oneOfMap f = foldr (alt <<< f) empty
239+
236240
-- | Fold a data structure, accumulating values in some `Monoid`,
237241
-- | combining adjacent elements using the specified separator.
238242
intercalate :: forall f m. Foldable f => Monoid m => m -> f m -> m

0 commit comments

Comments
 (0)