https://kotlinlang.org logo
#arrow
Title
p

patxi

11/28/2018, 1:56 PM
hi there! I am starting to use Arrow and I am coming with a validation usecase where I have this:
Copy code
return 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?