parMapN Missing Method from Ciris.ConfigValue

Viewed 50

I do not understand this error. I know it is telling that ConfigValue does not have a method defined called parMapN.

value parMapN is not a member of (ciris.ConfigValue[ciris.Effect,Int], ciris.ConfigValue[ciris.Effect,String]) possible cause: maybe a semicolon is missing before `value parMapN'? ).parMapN((port, host) => ServerConfig(Port(port), Host(host)))

package com.rusty.core.config

import cats.effect.kernel.Async
import ciris.{ConfigValue, env}
import com.rusty.core.domain.{Host, Port}
import cats.implicits._


final case class ServerConfig(
    port: Port,
    host: Host
)

object ServerConfig {
  def serverConfig[F[_]: Async]: ConfigValue[F, ServerConfig] = (
    env("PORT").as[Int].default(8080),
    env("HOST").default("localhost")
  ).parMapN((port, host) => ServerConfig(Port(port), Host(host)))
}
1 Answers

Calling parMapN requires an instance of Parallel[F], which you can get from Async. To do that, add this:

import cats.effect.implicits._
Related