Version Matrix

Build Status Maven Central

delightful-typeclasses is Scala a library containing utility typeclasses.

This library is built for Scala 2.11.12, 2.12.12 and 2.13.3

SBT

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

Maven

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

License

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!

import sweet.delights.typeclass.Default._

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