Functor.fmap - #2056
Conversation
johnynek
left a comment
There was a problem hiding this comment.
If we add this it should be final. But could we just add it as syntax and not to the typeclass?
|
|
|
|
|
I don't have any strong opinions on this, and avoid having to do |
|
Hi @fosskers, can you make a mima exception, please? :) |
|
@SystemFw The |
Codecov Report
@@ Coverage Diff @@
## master #2056 +/- ##
==========================================
- Coverage 94.95% 94.64% -0.31%
==========================================
Files 311 318 +7
Lines 5270 5364 +94
Branches 133 119 -14
==========================================
+ Hits 5004 5077 +73
- Misses 266 287 +21
Continue to review full report at Codecov.
|
|
Sure, I agree that the basic problem of underlying methods taking precedence over typeclass ones is there. In any case this is making me sound way more opposed to the proposal than I actually am. My only concern is that an advanced user knows that |
|
Lol wuh github? I didn't dismiss a review. |
|
It automatically dismissed reviews when you push, don't worry :) |
This PR adds a
.fmapmethod toFunctoras an alias of.map. This is in the spirit ofFoldable.combineAllwhich is an alias for.fold, as many types have a built-in.foldwith different behaviour, preventing.foldfrom being injected.PROs
.fmapis injectable, exposing lawful Functorness to implementing classes (i.e.Maphas a built-in.mapthat breaks Functor laws, but its injected.fmapwould be lawful). This also benefits authors of new Functor instances.CONs
.combineAll).flatMapfor non-Haskellers.