-
Notifications
You must be signed in to change notification settings - Fork 69
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
Additional mapping functions #182
Comments
I would be happy to PR this it's considered a good addition to the library. |
Also useful are the monadic variants:
|
The reason I don't have these is that they can already be done pretty succinctly using the existing utilities in contramapUpstream f p = (fmap f . request) >\\ p
contramapUpstreamM f p = (lift . f <=< request) >\\ p ... although I find it more readable to write them as: contramapUpstream f p = request' >\\ p
where
request' a' = do
a <- request a'
return (f a)
contramapUpstreamM f p = request' >\\ p
where
request' a' = do
a <- request a'
lift (f a) ... since that more clearly conveys that you're replacing all the old |
Thanks. That's helpful. I've been trying to improve my intuition for building |
I have a related question, but I decided to ask it on stackoverflow instead. |
FWIW, I think these should be added anyway. I don't have an opinion about the names. |
I just needed this function for something I was doing:
I think that this, along with its three sibling functions, would be a good addition to
Pipes.Core
. The names I envisioned for the functions were:It is possible to be more descriptive, although I find these names needlessly wordy:
The text was updated successfully, but these errors were encountered: