package cats包含具有相同名称的对象和包:implicits

时间:2017-05-03 04:58:49

标签: scala scala-cats ammonite

听说这里有新的Cats-Effect库

http://typelevel.org/blog/2017/05/02/io-monad-for-cats.html

将以下行添加到我的菊石壳predef.sc

interp.load.ivy("org.typelevel" % "cats-core_2.12" % "0.9.0")
interp.load.ivy( "org.typelevel" % "cats-effect_2.12" % "0.1-0848c9b")

现在我加载了我的菊石壳。我收到错误

cmd0.sc:1: package cats contains object and package with same name: implicits
one of them needs to be removed from classpath
import cats.effect.IO
       ^
Compilation Failed

用Google搜索并在此处找到解决方案

Package contains object and package with same name

但我想知道如何将-Yresolve-term-conflict:strategy应用于菊石壳?

1 个答案:

答案 0 :(得分:0)

我能够自己解决这个问题。这是正确的进口

interp.load.ivy("org.typelevel" %% "cats" % "0.9.0")
interp.load.ivy( "org.typelevel" % "cats-effect_2.12" % "0.1-0848c9b")

现在一切正常

@ import cats._
import cats._
@ import cats.effect.IO
import cats.effect.IO
@