Lens (optics) library module?
I'm putting together a lens library (adapted from fj) based on fugue data types: https://github.com/javafp/fugue-optics (work in progress)
was thinking that maybe it could better be a fugue sub-module than a separate project. Would you be interested in a pull request?
Comments (13)
-
-
that looks great, would be fantastic to have it as a fugue module!
there would be a few things to do before it could be accepted though. Most specifically we need a high degree of test coverage for all fugue code, so we'd need a comprehensive test suite. Secondly, I think it point out the need for
Semigroup
andMonoid
classes, I'd prefer to have those so we can describe a lawfulFold.foldMap
for instance (although,BinaryOperator
maybe enough forSemigroup
, but it doesn't specify associativity). -
reporter I agree that monoid and semigroup would be better. And I also think that laws would be best checked with property-based testing. Which framework should be used for fugue? scalacheck? functionaljava-quickcheck? junit-theories? functionaljava-quickcheck would be my perference.
-
I'd vote for scalacheck, it is probably the most powerful and we already have the scala module.
-
reporter sure. will go with it.
-
reporter The current work in progress toward a merge-request is now available at: https://bitbucket.org/jbgi/fugue/branch/optics?dest=v3.0.x Scalacheck have been integrated, first instance created in EitherOptics. Early review / comments are welcome.
-
Looking great, added a couple of comments there. Added an issue: needs to have Monoid for Fold.foldMap
-
@jbgi how are things going? any chance we can get this moving again? need any help?
-
reporter I should be able to get back at this next week.
I've been busy with another (related) project: Derive4J (it has support for fugue2/fugue3 btw). One of the main objectives of the project is to be able to generate lens/prism/optional at compile time.
-
oh, derive4j looks great! Apart from anything else, it's a really practical example of using object-algebras, good stuff!
-
reporter Yes a special kind of object-algebra. as such it give some support for extensibility: you can extends a
Cases
visitor (add cases) and create another ADT out of it. And visitor instances for the new ADT would also be able to visit the original one. -
Right, as explained in the Oliveira paper https://www.cs.utexas.edu/~wcook/Drafts/2012/ecoop2012.pdf or the excellent blog post https://oleksandrmanzyuk.wordpress.com/2014/06/18/from-object-algebras-to-finally-tagless-interpreters-2/
Looks great!
-
- changed status to resolved
timing out
- Log in to comment
I like the idea. Let me have a look at fugue-optics later today before you put to much effort into moving things around.