Bob Glamm
07/18/2019, 12:30 PMktor
and Arrow:
val q: (ApplicationCall) -> Kind<ForIO, Unit> = { c -> IO.fx().fx { c.respondText("Foo", ContentType.Text.Html) } }
c.respondText
is a suspending function not in IO
and @RestrictsSuspension
on IO
prevents the composition from occurring that waysimon.vergauwen
07/18/2019, 12:39 PMval q: (ApplicationCall) -> IO<Unit> =
{ c ->
IO.effect { respondText("Foo", ContentType.Text.Html) }
}
As Raul mentioned with fun <A> effect(f: suspend () -> A): IO<A>
you can lift suspending functions into IO.Bob Glamm
07/18/2019, 1:33 PMIO.effect
newer than 0.9.0? The version in 0.9.0 does not take arguments but I really like the syntaxsimon.vergauwen
07/18/2019, 1:38 PM