adds asumMap to Foldable#85
Conversation
chshersh
left a comment
There was a problem hiding this comment.
@cronokirby Thanks a lot for your contribution! Just couple minor things. Regarding HLint rules: I think this can go under separate issue, because the function is brand new (there's no such function on Hackage). So the set of HLint rules is not clear yet... Otherwise looks great 👍 Just requires some polishing before merging 🙂
src/Relude/Foldable/Fold.hs
Outdated
| Just 3 | ||
| -} | ||
| asumMap :: (Foldable f, Alternative m) => (a -> m b) -> f a -> m b | ||
| asumMap f = getAlt . foldMap (\a -> Alt (f a)) |
There was a problem hiding this comment.
I like the implementation! Probably you can even write foldMap (Alt . f). This looks readable enough to be 👍
| -} | ||
| asumMap :: (Foldable f, Alternative m) => (a -> m b) -> f a -> m b | ||
| asumMap f = getAlt . foldMap (\a -> Alt (f a)) | ||
|
|
There was a problem hiding this comment.
Could you add {-# INLINE asumMap #-} pragma after this function? I guess it might be useful. Don't think it will harm.
CHANGELOG.md
Outdated
| Add `under2` and `underF2` functions to `Relude.Extra.Newtype`. | ||
| * [#60](https://github.com/kowainik/relude/issues/60): | ||
| Add `hoistMaybe` and `hoistEither` functions. | ||
| * [#81](https://github.com/kowainik/relude/issues/81): |
There was a problem hiding this comment.
Thanks a lot for not forgetting to update the CHANGELOG! Could you please create separate entry with 0.3.1 version and move this line there? And also update version in .cabal file? 0.3.0 version is already published to Hackage, so this change is going to the next version.
…ge version to 0.3.1
|
The change was made all the easier by the existing quality of your libraries! 8^) |
Resolves #81
Not much to say here. I added imports for
AltfromApplicativeto be able to treatAlternativeas a monoid, which made the function implementation quite simple.Checklist:
I'm not exactly sure if I should have added anything to the
hlint.dhallfile for this change.HLint
hlint.dhallaccordingly to my changes (add new rules for the new imports, remove old ones, when they are outdated, etc.).
.hlint.yamlfile (seethis instructions).
General
with the short description of my latest changes.
style-guide
for more details).
stylish-haskellfile.[ci skip]text to the docs-only related commit's name.