arrow-core / arrow.core.extensions.andthen.functor / arrow.Kind / widen

widen

@JvmName("widen") fun <X, B, A : B> Kind<Kind<ForAndThen, X>, A>.~~widen~~(): AndThen<X, B> Deprecated: AndThen is deprecated in favor of the function andThen used to provide stack safe function composition.

Given A is a sub type of B, re-type this value from Kind<F, A> to Kind<F, B>

Kind<F, A> -> Kind<F, B>

 import arrow.core.*
import arrow.core.extensions.andthen.functor.*
import arrow.core.*


 import arrow.core.extensions.andthen.applicative.just
 import arrow.Kind

 fun main(args: Array<String>) {
  val result: Kind<*, CharSequence> =
  //sampleStart
  "Hello".just<String, String>().map<String, String, String>({ "$it World" }).widen<String,
String, String>()
  //sampleEnd
  println(result)
 }

Do you like Arrow?

Arrow Org
<