Plutonomicon / plutarch-core

Plutarch 2.0
MIT License
19 stars 6 forks source link

Optics #3

Open L-as opened 2 years ago

MangoIV commented 2 years ago

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

AriFordsham commented 2 years ago

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 commented 2 years ago

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:

Some questions:

L-as commented 2 years ago

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