PhBastiani
07/31/2019, 3:25 PMFree.monad()
Today, i tried to translate de Scala Cats sample into Kotlin (see https://gist.github.com/PBastiani/3598c838cbfdd982238360244b7550ed)
Something seems wrong in the interpreter : i understand that in my FREE program FreeKVStore<Unit>
is in conflict with Kind<F, A>
! But, I don't know how to fix that...raulraja
07/31/2019, 4:20 PMPhBastiani
07/31/2019, 5:23 PMraulraja
08/01/2019, 2:57 AMPhBastiani
08/01/2019, 11:56 AM`val res = KVStoreA.binding() {
put("A", 10).bind() //-> `java.lang.ClassCastException`
// delete("A").bind() //-> `kotlin.TypeCastException`
// get("A").bind() // -> is OK. i.e. returns None
// return@binding
}.fix().foldMap(impureInterpreter(), Option.monad())
gives me an exception ! The conflict coming from FreeKVStore<Unit>
PhBastiani
08/01/2019, 8:36 PMFunctionK<KVStoreA.F, F>
is not the right way to declare the natural transformation ! We do not specify any context to interpret the ASTraulraja
08/02/2019, 2:57 AMraulraja
08/02/2019, 2:58 AMraulraja
08/02/2019, 2:58 AMraulraja
08/02/2019, 2:59 AMPhBastiani
08/02/2019, 11:51 AMForId
. You mean something like that ?
https://gist.github.com/PBastiani/3598c838cbfdd982238360244b7550ed
Remains a warning due to the use of Any?
I think I can improve the type checking by writing
fun <F> impureInterpreter() : FunctionK<KVStoreA.F, ForId> = object : FunctionK<KVStoreA.F,Id<A>>
i'm in the right way ?raulraja
08/03/2019, 11:35 PMraulraja
08/03/2019, 11:36 PMraulraja
08/03/2019, 11:36 PMraulraja
08/03/2019, 11:37 PMraulraja
08/03/2019, 11:39 PMraulraja
08/03/2019, 11:40 PMPhBastiani
08/05/2019, 9:31 AMPhBastiani
08/05/2019, 9:49 AM