Skip to content
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

Upstream and downstream profunctors for pipes` #223

Open
masaeedu opened this issue Aug 29, 2020 · 1 comment
Open

Upstream and downstream profunctors for pipes` #223

masaeedu opened this issue Aug 29, 2020 · 1 comment

Comments

@masaeedu
Copy link

masaeedu commented Aug 29, 2020

I've been procrastinating on writing this issue for a while because every time I start writing it up it turns into a huge essay. So here is a short version that is missing many details, with the idea that something is better than nothing.

It would be useful to have the following newtypes in the library:

newtype Upstream m r b b' a a' = Upstream { runUpstream :: Proxy a' a b' b m r }

newtype Downstream m r a' a b' b = Downstream { runDownstream :: Proxy a' a b' b m r }

These newtypes are useful because they allow us to witness instances of Profunctor and various subclasses for Upstream m r b b' and Downstream m r a' a. In turn, having these instances is useful because it allows us to apply profunctor optics (type Optic p a b s t = p a b -> p s t) directly to pipes (for example the upstream interface supports an instance of Choice, so we can apply prisms to adapt requests, and the downstream interface supports an instance of Strong, so we can apply lenses to adapt responses).

@Gabriella439
Copy link
Owner

@masaeedu: Yeah, I would accept a pull request to add these

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants