Suspended functions seem to be a replacement for the IO type, not the IO monad. A more idiomatic IO type for Kotlin so to speak. You probably can write a monad instance for suspended functions, but I am not that familiar with Kotlin so I may be wrong.
but are marked as suspend, signaling they need a safe environment to be executed (arrow-fx-coroutines provides such an environment).
This sound like Haskell's main function, which is always of type IO and interprets at runtime what the IO actions mean in the real world.
Yeah, the intent is to become more idiomatic.
I don't know much about Haskell (just read a bit "Learn you a Haskell for Great Good" but never actually used it).
Compared to Haskell suspend functions would be like lang special syntax support for something like ContT. But suspension can be generalized to other monads. See the Kotlin std lib SequenceBuilder which is unrelated to IO and builds collections lazily. See also this comment for a more in-depth look into what we are doing dev.to/raulraja/comment/13a8h
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Suspended functions seem to be a replacement for the IO type, not the IO monad. A more idiomatic IO type for Kotlin so to speak. You probably can write a monad instance for suspended functions, but I am not that familiar with Kotlin so I may be wrong.
This sound like Haskell's
main
function, which is always of typeIO
and interprets at runtime what theIO
actions mean in the real world.Yeah, the intent is to become more idiomatic.
I don't know much about Haskell (just read a bit "Learn you a Haskell for Great Good" but never actually used it).
Compared to Haskell suspend functions would be like lang special syntax support for something like ContT. But suspension can be generalized to other monads. See the Kotlin std lib SequenceBuilder which is unrelated to IO and builds collections lazily. See also this comment for a more in-depth look into what we are doing dev.to/raulraja/comment/13a8h