Marko Novakovic
03/10/2023, 11:21 AMimport arrow.core.memoize
for suspend fun
?simon.vergauwen
03/10/2023, 11:22 AMMarko Novakovic
03/10/2023, 11:22 AMYoussef Shoaib [MOD]
03/12/2023, 9:34 AMsuspend
to do its work on <http://Dispatchers.IO|Dispatchers.IO>
though? or is it the case that for such a function, one should perhaps separate it into 2 functions, one pure and one suspend
with the latter calling a memoised version of the former and doing withContext(<http://Dispatchers.IO|Dispatchers.IO>)
?simon.vergauwen
03/12/2023, 10:02 AMone should perhaps separate it into 2 functions, one pure and oneYes, that would be the general pattern since dispatching is also considered an impure operation in FP. In practice I am curious if these function really provide any value though which is my original answer to the question was also to be use a properwith the latter calling a memoised version of the former and doingsuspend
?withContext(<http://Dispatchers.IO|Dispatchers.IO>)
Cache
abstraction. I've never used memoise
in Kotlin.