Could work like this: ```kotlin fun <T> Result<T>.chainIf( predicate: (response: T?) -> Boolean, block: () -> Result<T> ) { if (predicate(this.getOrNull())) { block() } else { Result.error(...) } } ```