Hi all! For Arrow.Fx does it make sense to have all impure functions have IO return types (in addition to the
suspend
modifier) or is it best practice to just use IO to run the effects at the boundary of the system and stick to
suspend
to indicate impurity?
For example
suspend fun printAString(s: String): Unit
suspend fun printAString(s: String): IO<Unit>
At the moment I am attempting to stick to a ports and adapters architecture with
suspend
for impure functions generally,
IO
return types at the service level, and actually unwrapping/running the IO at the controllers. The data is also the boundary but it didn't make a lot of sense to me to unwrap anything there so I've just been using
suspend
in the repos.
As a follow-up, does anyone know if it is possible to custom alias the modifier to something like
impure
to distinguish from coroutine suspend methods? Or am I thinking about that incorrectly? Like
impure fun printAString(s: String): Unit
Is that something we might want to use Arrow.Meta for?
Thanks!