Cats Module

The ciris-cats module provides type class instances for contexts F[_] from cats when used together with Ciris. Id is the default context, and is used when no explicit context is desired. The ciris-cats module is useful in cases when F is not Id, but for example Future, like in the following example. Note that Ciris does not provide type class instances for any other contexts than Id and relies on instances for other contexts from libraries like cats.

Let’s define an example ConfigSource which reads Future values.

import cats.implicits._
import ciris._
import ciris.cats._
import ciris.ConfigError.right
import scala.concurrent._
import scala.concurrent.duration._

implicit val executionContext: ExecutionContext =

val source: ConfigSource[Future, String, String] = {
  val keyType = ConfigKeyType[String]("example key")
  ConfigSource.applyF(keyType) { key: String =>

We can then load, decode, and combine values into a configuration as follows.

final case class Config(first: Int, second: Int)
// defined class Config

val futureConfig =
// futureConfig: ciris.ConfigResult[scala.concurrent.Future,Config] = ConfigResult$639046991

val config = Await.result(futureConfig.result, 1.second)
// config: Either[ciris.ConfigErrors,Config] = Right(Config(8,9))

The ciris-cats module also provides Show type class instances for logging configurations.