sweet-delights / delightful-typeclasses   0.2.0

GitHub

A Scala library containing utility typeclasses

Scala versions: 3.x 2.13 2.12

Build Status Maven Central

delightful-typeclasses is Scala a library containing utility typeclasses.

This library is built for Scala 2.12.15, 2.13.8 and 3.1.2

SBT

libraryDependencies += "org.sweet-delights" %% "delightful-typeclasses" % "0.2.0"

Maven

<dependency>
  <groupId>org.sweet-delights</groupId>
  <artifactId>delightful-typeclasses_2.12</artifactId>
  <version>0.2.0</version>
</dependency>

All files in delightful-typeclasses are under the GNU Lesser General Public License version 3. Please read files COPYING and COPYING.LESSER for details.

Available typeclasses

Default[T]

The Default[T] typeclass creates a default instance of T.

Step 1: define case classes

import java.time.LocalDateTime

case class Foo(
  opt: Option[Int],
  str: String,
  double: Double,
  more: List[Bar]
)

case class Bar(
  list: List[LocalDateTime]
)

Step 2: instantiate!

val default = Default[Foo]
println(default)
// Foo(
//   opt = Some(0),
//   str = "",
//   double = "0.0",
//   List(
//     Bar(List(LocalDateTime.parse("1970-01-01T00:00:00.000")))
//   )
// )

Acknowledgments