There seems to be a problem with Kotlin scripting ...
# arrow
e
There seems to be a problem with Kotlin scripting console and defining own HKTs. Say, by trying to invoke this code in Kotlin REPL:
Copy code
import arrow.Kind
import arrow.typeclasses.Functor

data class Container<T> (
        val contained: T
) : Kind<ForContainer, T>

class ForContainer private constructor() { companion object }
fun <A> Kind<ForContainer, A>.fix() = this as Container<A>

object ContainerFunctorInstance : Functor<ForContainer> {

    override fun <A, B> Kind<ForContainer, A>.map(f: (A) -> B): Kind<ForContainer, B> {
        return Container(this.fix().contained.let(f))
    }

}

val s = ContainerFunctorInstance.run {
   Container(3).map { it.toString() + "jopa" }
}.fix().contained