debasishg / frdomain

Code repo for Functional and Reactive Domain Modeling
Apache License 2.0
467 stars 136 forks source link

Chapter 3: CustomerLenses #43

Open vishallama opened 6 years ago

vishallama commented 6 years ago

https://github.com/debasishg/frdomain/blob/48664c35b2e583aeacfcacd5d740687afb2ed1de/src/main/scala/frdomain/ch3/lens/Domain.scala#L35

Given the implicit context (which is my own guess), it seems like the code for nameLens should probably be as follows:

protected val nameLens = Lens[Customer, String](
    get = _.name,
    set = (o, v) => o.copy(name = v)
)
ghost commented 6 years ago

Or the nameLens should be named idLens :-)