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

Add functions for upgrading isomorphisms to work with producers #30

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

torgeirsh
Copy link

No description provided.

@Gabriella439
Copy link
Owner

I have a couple of suggestions:

  • Use Lens' instead of Iso'. Unfortunately, using the more general Iso' doesn't gain you anything because the isomorphism functions from lens (like from) are hard-coded to the Exchange type exported from the lens library.
  • Maybe simplify the API to:
mapIso :: (a -> b) -> (b -> a) -> Lens' (Producer a m x) (Producer b m x)

@torgeirsh
Copy link
Author

The simpler API doesn't allow users to transform pure lenses into "piped"
ones directly, but on the ather hand requiring users to call 'withIso' from
'lens' themselves neatly sidesteps the need for 'Exchange' in
'pipes-parse'. Are 'lens-family' users out of luck though?

2014-06-13 1:22 GMT+02:00 Gabriel Gonzalez notifications@github.com:

I have a couple of suggestions:

Use Lens' instead of Iso'. Unfortunately, using the more general Iso'
doesn't gain you anything because the isomorphism functions from lens
(like from) are hard-coded to the Exchange type exported from the lens
library.

Maybe simplify the API to:

mapIso :: (a -> b) -> (b -> a) -> Lens' (Producer a m x) (Producer b m x)


Reply to this email directly or view it on GitHub
#30 (comment)
.

@Gabriella439
Copy link
Owner

lens-family users are indeed out of luck no matter what you do, since lens-family doesn't support a way to represent isomorphisms. This would require lens-family to depend on profunctors, but one of the design principles behind lens-family is to only depend on packages in the Haskell Platform.

However, like you said, lens users can still use the simpler mapIso if they just call withIso. I would really like to avoid reimplementing Exchange inside of pipes-parse, because I would also like pipes-parse to depend solely on the Haskell Platform.

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

Successfully merging this pull request may close these issues.

None yet

2 participants