Skip to content

Quick Start

Chimney is supported for Scala 2.12, 2.13, 3.3+ on JVM, Scala.js and Scala Native with full feature parity between each version.

The newest versions on each platform are:

Chimney JVM versions
Chimney Scala.js 1.x versions
Chimney Scala.js 0.6 versions
Chimney Scala Native 0.4 versions
Chimney Scala Native 0.3 versions

with Scaladoc API documentation available:

Scaladoc 2.11 Scaladoc 2.12 Scaladoc 2.13 Scaladoc 3

To start using the library add to your sbt config:

// if you use Scala on JVM-only
libraryDependencies += "io.scalaland" %% "chimney" % "0.8.1"
// if you cross-compile to Scala.js and/or Scala Native
libraryDependencies += "io.scalaland" %%% "chimney" % "0.8.1"

and then import in your codebase:

import io.scalaland.chimney.dsl._

or try it in Scala CLI:

# Scala 2.12
scala-cli repl --scala "2.12.18" --dependency "io.scalaland::chimney::0.8.1"
# Scala 2.13
scala-cli repl --scala "2.13.12" --dependency "io.scalaland::chimney::0.8.1"
# Scala 3
scala-cli repl --scala "3.3.1" --dependency "io.scalaland::chimney::0.8.1"

Tip

If you are a advanced user, who wants to learn the difference between automatic derivation and semiautomatic derivation in Chimney, see Automatic, semiautomatic and inlined derivation.

Java collections integration

If you are interested in using java.util.Optional, java.util.Collections, java.util.Maps, java.util.streams and other Java's types, you need to add integration to your project:

// Java collections integrations is released only on JVM Scala!
libraryDependencies += "io.scalaland" %% "chimney-java-collections" % "0.8.1"

and then import:

import io.scalaland.chimney.javacollections._

Tip

See Java collections integration cookbook for more information.

Cats integration

If you are interested in Cats integrations for Partial Transformers, you need to add to your project:

// if you use Scala on JVM-only
libraryDependencies += "io.scalaland" %% "chimney-cats" % "0.8.1"
// if you cross-compile to Scala.js and/or Scala Native
libraryDependencies += "io.scalaland" %%% "chimney-cats" % "0.8.1"
import io.scalaland.chimney.cats._

Tip

See Cats integration cookbook for more information.

Protocol Buffers integration

If you want to improve support for types defined in ScalaPB, you need to add to your project:

// if you use Scala on JVM-only
libraryDependencies += "io.scalaland" %% "chimney-protobufs" % "0.8.1"
// if you cross-compile to Scala.js and/or Scala Native
libraryDependencies += "io.scalaland" %%% "chimney-protobufs" % "0.8.1"
import io.scalaland.chimney.protobufs._

Tip

See Protocol Buffers integration cookbook for more information.