patxi
11/28/2018, 1:56 PMreturn Option.applicative().map(someFrom, someTo, someAmount, someDate) { (from, to, amount, date) ->
ExchangeRate.validate(from, to, amount, date)
}.fix().flatten()
I have some single property validators (returning Option), and then before constructing this entity itself, it needs another validation to check if all properties are consistent between them, that is why I am flattening the result, as validate is returning an Option
My question is if there is a cleaner way to do this?