Lens (optics) library module?

Issue #36 resolved
Jean-Baptiste Giraudeau created an issue

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)

  1. Anund McKague

    I like the idea. Let me have a look at fugue-optics later today before you put to much effort into moving things around.

  2. Jed Wesley-Smith

    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 and Monoid classes, I'd prefer to have those so we can describe a lawful Fold.foldMap for instance (although, BinaryOperator maybe enough for Semigroup, but it doesn't specify associativity).

  3. Jean-Baptiste Giraudeau 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.

  4. Jed Wesley-Smith

    I'd vote for scalacheck, it is probably the most powerful and we already have the scala module.

  5. Jean-Baptiste Giraudeau 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.

  6. Jed Wesley-Smith

    oh, derive4j looks great! Apart from anything else, it's a really practical example of using object-algebras, good stuff!

  7. Jean-Baptiste Giraudeau 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.

  8. Log in to comment