Skip to content

Add method forwarders to Resource #2116

@djspiewak

Description

@djspiewak

Resource implements Async, but does so in a purely "typeclassy" way. If you want to do something like rsrc.start (where rsrc: Resource[F, A]), you actually need to import cats.effect.syntax.all._! This isn't a great experience.

Instead, we should flip all of this around and follow the same pattern IO does: move the definitions of these methods to Resource itself as members (taking the appropriate implicit evidence for F individually), and then change the typeclass implementations to simply forward the call onto the appropriate member function. This is actually a pretty easy change, just a little tedious and time-consuming. It should help with the ergonomics quite considerably though.

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions