(it doesn't seem like there's a memoize for `suspend fun`s...?)
f
Francis Reynders
02/22/2023, 2:40 PM
The documentation specifies memoize should only be used for pure functions, which makes sense it seems. Suspend functions typically have side effects.
Francis Reynders
02/22/2023, 2:47 PM
Indeed, then we talk about caching rather than functional memoize
d
dave08
02/22/2023, 2:50 PM
Yeah... but it seems like Arrow 2.0 is directed towards real use-cases rather than functional theory... so I wonder if that's so terrible? Especially with the fact that it seems like an Arrow standard is that whatever functions are marked with
suspend
aren't pure anyways... and that's what such a
memoized()
would do, return another impure
suspend fun
so we're not messing with any of the functional laws, just making convenience methods for similar use cases...
dave08
02/22/2023, 2:51 PM
Anyways, this is not a real cache... since it only stays in the context of the current function that keeps it's reference... if a real cache is needed, it wouldn't be