Because we have too few solutions
Library | Docs | Types | Integrations | Notes |
---|---|---|---|---|
built-in | official | AnyVal extended by class with a single value |
many libraries support AnyVal s |
- Scala 2/3, but on 3 it has a replacement |
Because we have too few solutions
Library | Docs | Types | Integrations | Notes |
---|---|---|---|---|
built-in | official | AnyVal extended by class with a single value |
many libraries support AnyVal s |
- Scala 2/3, but on 3 it has a replacement |
//> using scala 3.6.3 | |
import scala.deriving.Mirror | |
import scala.compiletime.{erasedValue} | |
/** Type-level function that transforms a type-level tuple of types | |
* into a corresponding tuple of List[...] at the value level. | |
* | |
* E.g., if Ts is (T1, T2, T3), Partitioned[Ts] is (List[T1], List[T2], List[T3]). | |
*/ |
import scala.deriving._ | |
import scala.compiletime.{erasedValue, summonInline} | |
// super primitive (but composable via typeclass derivation) JSON reader | |
trait Reader[A] { | |
def read(json: ujson.Value): A | |
} | |
object Reader { | |
given Reader[Int] = new Reader[Int] { |
object test { | |
import scalaz.zio._ | |
type UserID = String | |
case class UserProfile(name: String) | |
// The database module: | |
trait Database { | |
val database: Database.Service |
// summary : Just ONE ammonite script file to execute a load performance test using gatling ! | |
// keywords : scala, gatling, ammonite, scala, load-test, performance | |
// publish : gist | |
// authors : David Crosson | |
// license : Apache NON-AI License Version 2.0 (https://raw.githubusercontent.com/non-ai-licenses/non-ai-licenses/main/NON-AI-APACHE2) | |
// id : ea7a4259-9461-44a8-99fa-1ec6ec3c48ed | |
// created-on : 2018-09-22T07:41:07Z | |
// managed-by : https://github.com/dacr/code-examples-manager | |
// execution : scala ammonite script (http://ammonite.io/) - run as follow 'amm scriptname.sc' |
import cats.effect.ExitCase._ | |
import cats.effect.Sync | |
import cats.effect.concurrent.Ref | |
import cats.syntax.flatMap._ | |
import cats.syntax.functor._ | |
trait Tap[F[_]] { | |
def apply[A](effect: F[A]): F[A] | |
} |
import cats.Traverse | |
import cats.effect._ | |
import cats.effect.concurrent.Semaphore | |
import cats.temp.par._ | |
import cats.syntax.all._ | |
import scala.concurrent.duration._ | |
object Main extends IOApp { | |
import ParTask._ |
// Alternative to sealed abstract case class pattern for Scala 2.12.2+ | |
// Benefits: | |
// - 1 final class instead of 1 sealed class + anonymous subclass | |
// - portable to Scala 3 regardless of opaque types | |
// - less boilerplate | |
final case class Angle private (toDegrees: Int) { | |
// Define our own `copy` method to suppress synthetic one | |
// Add private to prevent it from being used | |
def copy(degrees: Int = toDegrees): Angle = Angle.fromDegrees(degrees) |