(it doesn't seem like there's a memoize for `suspe...
# arrow
d
(it doesn't seem like there's a memoize for `suspend fun`s...?)
f
The documentation specifies memoize should only be used for pure functions, which makes sense it seems. Suspend functions typically have side effects.
Indeed, then we talk about caching rather than functional memoize
d
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...
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
memoized()
...