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

Optics #3

Open
L-as opened this issue Jun 25, 2022 · 4 comments
Open

Optics #3

L-as opened this issue Jun 25, 2022 · 4 comments
Assignees

Comments

@L-as
Copy link
Member

L-as commented Jun 25, 2022

No description provided.

@MangoIV
Copy link

MangoIV commented Jul 6, 2022

awesome resource (at least imho) :3
https://oleg.fi/gists/posts/2017-04-18-glassery.html

@AriFordsham
Copy link
Collaborator

Some opinions here:

I don't like the van Laarhoeven representation, although we should be able to avoid that here. You don't even lose the category instance, since we anyway use DataKinds: https://cstheory.stackexchange.com/a/51028/61454.

I particularly loathe implicit subtyping, which no lens implementation, including profunctor optics seems to avoid. I think 'composing' a lens with a prism should use an explicit operator marking it as tht.

I'm going to spend today seeing if I can come up with a lens representation that I like, otherwise I'll just pick the 'least worst' representation, probably profunctor optics.

@AriFordsham
Copy link
Collaborator

I think I'll stick with profunctors. I was making progress with my ideas, but I think it'll be too long until they're workable. I'll have to reinvent lenses some other time 😃.

So the idea is to implement profunctor optics in Plutarch, over Plutarch types. I see this as three stages:

  • Implement profunctor optics (the interface) in Plutarch - no existing library will work, as the function type is different.
  • Implement generic deriving of lenses for Plutarch datatypes.
  • Ensure lens implementations are optimum, in terms of minimizing uses of pcon/pmatch.

Some questions:

  • Should API design follow the profunctors paper? The optics library? Some other library?
  • Lenses and prisms are presumably needed. What about isos and traversals?
  • What considerations are there for Data/Scott encoded types?
  • What considerations are needed to ensure implementation is optimal, as opposed to a naive implementation?

@L-as
Copy link
Member Author

L-as commented Jul 10, 2022

I'm not sure we can use any traditional optics representation.

  • Doesn't matter, whatever is easiest
  • Yep.
  • Doesn't matter. This is plutarch-core.
  • Merge uses of econ and ematch.

@L-as L-as linked a pull request Aug 12, 2022 that will close this issue
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 a pull request may close this issue.

3 participants