-
-
Notifications
You must be signed in to change notification settings - Fork 81
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rename and deprecate mapToFst/Snd
#196
Comments
@vrom911 I think renaming to less confusing names worth it in the long term. Regarding deprecation process: we can use the process described in my blog post (which includes multi-stage process with Regarding We can introduce new functions first and deprecate the old ones: ??? :: (a -> b) -> a -> (b, a)
fmapToFst :: Functor f => (a -> b) -> f a -> f (b, a) -- uses ??? It's hard to come up with the good name for
What do you think? |
Map implicates some |
I'm not a fan of renaming. In my mind, it makes sense that
Also, if you did rename the |
I propose the following change:
fmapToFst :: Functor f => (a -> b) -> f a -> f (b, a)
fmapToSnd :: Functor f => (a -> b) -> f a -> f (a, b)
Now we have |
In #194 I've noticed that functions
mapToFst
/mapToSnd
/mapBoth
have a bit misleading name. Check out the type:when I would expect it to have the following type:
(which is exactly what was needed in the mentioned PR, and we used
map (mapToFst f)
in there).I also understand, that this is breaking change and I am not sure if it worth it. Need to thing about renaming or deprecating process a bit harder.
Anyway, at least adding functions which would actually map the containers is also a possible solution for the issue. I would really appreciate the discussion of this problem.
cc @kowainik/dev
The text was updated successfully, but these errors were encountered: