Hi, I'm trying to model a function that creates a ...
# arrow
t
Hi, I'm trying to model a function that creates a db transaction and a function to perform a db query and if the query is successful it commits the transaction (and returns query result). If the query is not successful it performs rollback and passes on the error.
Copy code
inline fun <T> performTransaction(crossinline block: Transaction.() -> Try<T>): Try<T> =
    transaction {
        val result = block()

        if (result.isFailure())
            rollback()
        else
            commit()

        result
    }
This works well, but If I wanted to change the signature to
Copy code
inline fun <F,T>performTransaction(crossinline block: Transaction.() -> Kind<F,T>): Kind<F, T>
I'm unable to test for isFailure(). Is there a good way about this?