Comments (1)
Creating a custom Traversal can be tricky, but there is a Traversal for Lists. It's at List.Optic.traversal()
.
If your Cart changes to include a List of Items, that Prism is still fine, but itemL would need to change to a Lens<Cart, List<Item>>
(and probably change the name to itemsL). Then, I believe you should only need to compose an extra traversal:
itemsL.composeTraversal(List.Optic.traversal()).composeLens(discountL).composePrism(onlyPctDiscount).modify(calculation).f(cart)
That should modify each item's discount.
from functionaljava.
Related Issues (20)
- Add fj.test.Gen.sequence(Validation<E, Gen<A>>). HOT 1
- Add sequence* and traverse* functions to Validation; add sequence* functions to Option.
- Several fj.data.Validation.accumulate functions construct unexpected or incorrect failures.
- Add fj.data.Seq.bind(F<A, Seq<B>>)
- Add fj.data.List.sequence* functions, some fj.data.List.traverse* functions.
- Add fj.data.Seq.sequence*, fj.data.Seq.traverse* functions.
- Add fj.data.Either.leftMap, rightMap.
- Will there be a release 4.8.2 / 4.9? HOT 9
- Add fj.data.State.bind(F<A, State<S, B>>).
- Add fj.data.Stream.sequence*, fj.data.Stream.traverse* functions.
- Add fj.data.NonEmptyList.sequence*, traverse*, foldLeftN, foldRightN, init, last.
- Performance: Append operation of List and Array HOT 6
- build HOT 6
- Remove POptional/Optional optics
- lens, traverse and validate question
- Test Smell: it is not a good practice to write a return statement in test cases HOT 2
- Generated pom dependencies inconsistent with gradle build HOT 2
- Website down? HOT 3
- Is it possible to upgrade the Gradle version used to build the project?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from functionaljava.