Plutonomicon / plutarch-core

Plutarch 2.0
MIT License
19 stars 6 forks source link

Draft optics implementation #13

Closed AriFordsham closed 1 year ago

AriFordsham commented 2 years ago

Initial draft implementation.

L-as commented 2 years ago

Great! The hard part is how to compose them efficiently.

AriFordsham commented 2 years ago

What obstacles are there to 'efficiently?'

I'm planning on implementing profunctor optics in a way that makes sense for Plutarch lenses.

Are there any efficiency considerations I am missing?

L-as commented 2 years ago

Consider combining Lens' a b and Lens' a c into Lens' a (b, c). How do you this efficiently? Relying on the backend to optimise it is not good design.

AriFordsham commented 2 years ago
AriFordsham commented 2 years ago

We have optics!

L-as commented 2 years ago

Why change the warnings? Make sure to use GHC 9.2.4. You can do nix develop to get the correct GHC.

AriFordsham commented 2 years ago

Happy to change that back. I use partial-type-signatures warnings with HLS quite heavily in my workflow. shell.nix on master has ghc923, which is what I'm using.

L-as commented 2 years ago

e.g.?

AriFordsham commented 2 years ago

Not having r on the right of an arrow breaks a lot of inference and requires many type applications. In addition, something hard broke, I can't remember what. It seemed fixable, but not worth the trouble. I'm happy to try again if you think it's worth it.

L-as commented 2 years ago

In general, type applications are a code smell, along with AllowAmbiguousTypes IMO.

AriFordsham commented 1 year ago

PConstrained implemented

AriFordsham commented 1 year ago

We won't really know if this works until we have a backend to test with.

L-as commented 1 year ago

Amazing! Perhaps we should work on getting a backend to work again.

L-as commented 1 year ago

Plutarch has changed too much for this to be mergible.