File tree Expand file tree Collapse file tree
kernel/shared/src/main/scala/cats/effect/kernel Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -993,13 +993,16 @@ object Resource extends ResourceFOInstances0 with ResourceHOInstances0 with Reso
993993 def onFinalizeCase [F [_]: Applicative ](release : ExitCase => F [Unit ]): Resource [F , Unit ] =
994994 unit.onFinalizeCase(release)
995995
996+ private [this ] val cachedLiftK : Id ~> Resource [Id , * ] =
997+ new (Id ~> Resource [Id , * ]) {
998+ def apply [A ](fa : Id [A ]): Resource [Id , A ] = Resource .eval(fa)
999+ }
1000+
9961001 /**
9971002 * Lifts an applicative into a resource as a `FunctionK`. The resource has a no-op release.
9981003 */
9991004 def liftK [F [_]]: F ~> Resource [F , * ] =
1000- new (F ~> Resource [F , * ]) {
1001- def apply [A ](fa : F [A ]): Resource [F , A ] = Resource .eval(fa)
1002- }
1005+ cachedLiftK.asInstanceOf [F ~> Resource [F , * ]]
10031006
10041007 /**
10051008 * Allocates two resources concurrently, and combines their results in a tuple.
You can’t perform that action at this time.
0 commit comments