Working on a new encoding for 1.0 to get closer to suspend, continuations and computational blocks and further away from Haskell Like type classes, kind emulation, etc as those are the less popular and most costly to maintain arrow features.
This new encoding is based on arrow-continuations for binding but general enough to model any other functionality besides monad bind which is whatβs shown in here. Now we are basing continuations and monad bind in arrow-continuations we can get rid of the nasty reflection tricks π and we are almost MPP. Feel free to comment in a thread here if anyone has any opinions, suggestions or questions. Thanks! https://gist.github.com/raulraja/5f29a00df261d8fbcfa94b6f2dd44ec6
π 2
π 5
π 3
s
stojan
11/15/2020, 11:45 AM
Copy code
fun interface Plus<A> {
infix operator fun A.plus(other: A): A
}
this is what
Semigroup
would look like?
stojan
11/15/2020, 11:46 AM
Copy code
suspend fun listComputationTest(): List<String> =
list {
val a = listOf(1, 2, 3)()
val b = listOf("a", "b", "c")()
"$a$b"
}
would ALL computational blocks require suspend?
right now
either
doesn't need that AFIK
a
aballano
11/15/2020, 1:36 PM
I believe you do not need suspend there
r
raulraja
11/15/2020, 4:27 PM
not all computational blocks require suspend but the block itself is a suspended function in order to be able to bind
raulraja
11/15/2020, 4:28 PM
@stojan yeah that is what semigroup would look like
π 1
s
stojan
11/15/2020, 5:35 PM
does this affect the comprehensions plugin in meta?
r
raulraja
11/16/2020, 8:04 AM
Yes it will be gone. There will be no flatMap rewriting comprehensions as these can be specialized per data type with a faster runtime like in the case of either where it can be implemented in terms of fold and optimize the happy path