I have code like this:
def begin() = {
val processor = ???
db.insert(v).map {
case Left(....) =>
case Right(...) => proccessor.do(...)
}
}
Now I want to create a partial function version so I can do this:
def begin(pf: PartialFunction[Either[CustomError, String], Boolean) = {
val processor = ???
db.insert(v).map {
pf
}
}
The problem is, the partial function pf needs access to processor to perform something important for this transaction.
Is it possible for the partial function to somehow gain access to this processor val?