Hi all Coming to Scala and would like to know, how...
# arrow
z
Hi all Coming to Scala and would like to know, how to define the following tagless interface in Kotlin with Arrow:
Copy code
trait GenderQuery[F[_]] {

  def findAll: F[Genders]

}
r
While Arrow supports kind emulation via :
Copy code
interface Foo<F> {
  fun foo(): Kind<F, Int>
}
The best way in Kotlin to get tracked effects in this case would be
Copy code
interface Foo {
  suspend fun foo(): Int
}
In its impl you can use in the next release the arrow fx coroutines lib currently available in snapshot for 0.11
Which contains all you want out of IO but over suspend being more Kotlin diomatic and removing the callback indirections since Monads in this style are modeled as continuations
Kotlin even provides a
suspend fun main
which if you come from Haskell is the equivalent of main and in Scala is IOApp in cats or similar libraries
suspend being a native impl of something similar to ContT can model and go from one monad to another without the use of higher kinded types
more info here and soon in the docs when 0.11 is out https://twitter.com/raulraja/status/1291798081873338371
metal 1