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 to Either

import arrow.core.*

fun main(args: Array<String>) {
//sampleStart
val string: Either<Int, String> = "Hello".right()
val chars: Either<Int, CharSequence> =
string.widen<Int, CharSequence, String>()
//sampleEnd
println(chars)
}

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 to Ior

import arrow.core.*

fun main(args: Array<String>) {
//sampleStart
val string: Ior<Int, String> = Ior.Right("Hello")
val chars: Ior<Int, CharSequence> =
string.widen<Int, CharSequence, String>()
//sampleEnd
println(chars)
}

fun <B, A : B> Iterable<A>.widen(): Iterable<B>

Given A is a sub type of B, re-type this value from Iterable to Iterable

Kind -> Kind


fun <B, A : B> List<A>.widen(): List<B>
fun <K, B, A : B> Map<K, A>.widen(): Map<K, 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


fun <B, A : B> Sequence<A>.widen(): Sequence<B>

Given A is a sub type of B, re-type this value from Sequence to Sequence

Kind -> Kind


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 to Validated

import arrow.core.*

fun main(args: Array<String>) {
//sampleStart
val string: Validated<Int, String> = "Hello".valid()
val chars: Validated<Int, CharSequence> =
string.widen<Int, CharSequence, String>()
//sampleEnd
println(chars)
}