arrow-core-data / arrow.core / widen
fun <A, C, B : C> Either<A, B>.widen(): Either<A, C>
Given B is a sub type of C, re-type this value from Either<A, B> to Either<A, B>
fun <A, C, B : C> Ior<A, B>.widen(): Ior<A, C>
Given B is a sub type of C, re-type this value from Ior<A, B> to Ior<A, B>
fun <B, A : B> Option<A>.widen(): Option<B>
Given A is a sub type of B, re-type this value from Option to Option
Option -> Option
import arrow.core.Option
import arrow.core.some
import arrow.core.widen
fun main(args: Array<String>) {
 val result: Option<CharSequence> =
 //sampleStart
 "Hello".some().map({ "$it World" }).widen()
 //sampleEnd
 println(result)
}
fun <E, B, A : B> Validated<E, A>.widen(): Validated<E, B>
Given A is a sub type of B, re-type this value from Validated<E, A> to Validated<E, B>
Do you like Arrow?
✖