Silly question, is there a concise way to force an...
# arrow
m
Silly question, is there a concise way to force an expression to have Unit return value? Eg, sometimes the last thing I want to do in an IO block is log something, but Android Log.* methods return integers for some reason not described in the API documentation. I feel silly adding an extra line just for "Unit" to fix the return type.
j
What about a function that wraps the Android log implementation? Something like
fun log(logger: Logger, level: Level, message: String): IO<Unit> = IO { /* the log impl */; Unit }
.
👍 1
a
actually logging is a side effect, so you should wrap it with IO as Joram suggested