typelevel / typelevel/cats-effect
Add specialized signature of `memoize` to `Resource`
Nobody has claimed this yet.
- #3890 by @Daenyth — closed without merging
- Dominant language
- Scala
- Stars
- 2.2k
- Forks
- 576
- Avg merge
- 2d 11h
- Merged PRs (30d)
- 18
Description
So currently memoize on Resource returns a Resource[IO, Resource[IO, A]]. The thing is, that inner resource is not really necessary (the implementation is just a Resource.eval(...)) and it makes the ergonomics a lot worse. The ideal signature would look more like Resource[IO, IO[A]].
Besides memoize, I wonder if we can rescue some of the other method signatures as well, that return extremely hairy nested Resources. It's pretty cool that Resource implements Async with all these bells-and-whistles, but the method signatures aren't always very ergonomic when working directly with concrete Resource.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start at the Resource.memoize entry point and inspect its current signature and Resource.eval-based implementation. Compare the resulting nested Resource type with the proposed Resource[IO, IO[A]] shape, then review the other concrete Resource methods for similarly nested signatures; done means the intended signatures and corresponding behavior are covered by the relevant tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100