-
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Open
Description
Samples:
- https://github.com/typelevel/algebra/blob/master/core/src/main/scala/algebra/Priority.scala
- https://github.com/milessabin/shapeless/blob/master/core/src/main/scala/shapeless/orelse.scala
I've also encountered cases in which I wished to have this helper available with the Async / Concurrent type classes in Cats-Effect. So it would work like this:
- if a
Concurrentinstance is in scope, build a cancelable task viaConcurrent.cancelable - if only an
Asyncinstance is in scope, as a fallback, build an atomic task viaAsync.async
So this is a mechanism for optimizing the implementation in case a type class instance is available, or otherwise use the default. This optimization problem is also relevant for Haskell: https://stackoverflow.com/questions/44250854/use-specialized-implementation-if-a-class-instance-is-available
I think it's time we add something like this to cats-kernel.
LukaJCB, YuvalItzchakov, radusw and johnynek
Metadata
Metadata
Assignees
Labels
No labels