Thread pools on the JVM should usually be divided into the following three categories:
- CPU-bound
- Blocking IO
- Non-blocking IO polling
Each of these categories has a different optimal configuration and usage pattern.
| object Main extends App { | |
| AvoidLosingGenericType.run() | |
| AvoidMatchingOnGenericTypeParams.run() | |
| TypeableExample.run() | |
| TypeTagExample.run() | |
| } | |
| class Funky[A, B](val foo: A, val bar: B) { | |
| override def toString: String = s"Funky($foo, $bar)" | |
| } |
| object game { | |
| case class Lens[S, A](set: A => S => S, get: S => A) { self => | |
| def >>> [B](that: Lens[A, B]): Lens[S, B] = | |
| Lens[S, B]( | |
| set = (b: B) => (s: S) => self.set(that.set(b)(self.get(s)))(s), | |
| get = (s: S) => that.get(self.get(s)) | |
| ) | |
| } | |
| case class Prism[S, A](set: A => S, get: S => Option[A]) { self => |