purescript-foldable-traversable
purescript-foldable-traversable copied to clipboard
added traverseM
I find myself using the following so often, that I assumed the function should already exist, but it doesn't:
join <$> traverse fn traversable
I've inquired on slack about it, I have see someone else inquire about it (i-am-the-slime), and someone else inquired on reddit: https://www.reddit.com/r/purescript/comments/aq31gu/i_feel_like_this_is_probably_a_standard_function/
@puffnfresh showed us that it exists in Scalaz: https://github.com/scalaz/scalaz/blob/series/7.3.x/core/src/main/scala/scalaz/Traverse.scala#L68
So I decided to make this PR to add it to Data.Traversable
If we're adding this, we should also add a sequenceM
at the same time (where sequenceM
would be \x -> join <$> sequence x
). The example you give here would probably serve better as an example for sequenceM
. Also I think the definitions should be included in the docs.
Does this pass the Fairbairn Threshold? I think we should add it, but thought it's worth discussing.