I have the following code that does not compiled:
trait DbSetup[F[_]] {
type EnvT[A] = OptionT[F, A]
def system: EnvT[Env]
def user: EnvT[String]
def password: EnvT[String]
def address: EnvT[String]
}
object DbSetup {
def read[F[_]: Monad](s: DbSetup[F]): EnvT[Configuration] = ???
}
the compiler complains:
not found: type EnvT
[error] def read[F[_]: Monad](s: DbSetup[F]): EnvT[Configuration] = ???
[error] ^
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
How to import the type EnvT
into the object
scope?
Try
def read[F[_]: Monad](s: DbSetup[F]): s.EnvT[Configuration] = ???