is there any kind of arrow-kt integration for Ktor...
# ktor
l
is there any kind of arrow-kt integration for Ktor (specifically Ktor-client stuff)? Currently im using extension functions on HttpClient like
getSafe
that just wrap the
HttpClient.get
method in a `Try`object, but i wonder if there is any way to get that out of the box / with a library
d
Because of type erasure, something like this isn't even possible yet. There's barely have support for
List<...>
but since
typeOf
is now a thing, it might be possible in a couple weeks.
Also, IMO
Try
doesn't work well with
kotlinx.coroutines
particularly around cancellation, so I would advise against using it here.
l
what would you recommend using instead of Try? i really need some kind of type-safe way to handle failures, as my whole Project revolves around some Requests failing and others succeeding. I'd really hate to have to use try/catch everywhere...
d
Have you looked at
runCatching
?