找不到类型 EnvT
Type EnvT can not be found
我有以下未编译的代码:
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] = ???
}
编译器抱怨:
not found: type EnvT
[error] def read[F[_]: Monad](s: DbSetup[F]): EnvT[Configuration] = ???
[error] ^
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
如何将类型 EnvT
导入 object
范围?
尝试
def read[F[_]: Monad](s: DbSetup[F]): s.EnvT[Configuration] = ???
我有以下未编译的代码:
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] = ???
}
编译器抱怨:
not found: type EnvT
[error] def read[F[_]: Monad](s: DbSetup[F]): EnvT[Configuration] = ???
[error] ^
[error] one error found
[error] (Compile / compileIncremental) Compilation failed
如何将类型 EnvT
导入 object
范围?
尝试
def read[F[_]: Monad](s: DbSetup[F]): s.EnvT[Configuration] = ???