简体   繁体   English

包猫包含具有相同名称的对象和包:隐式

[英]package cats contains object and package with same name: implicits

Heard about the new Cats-Effect library here 在这里听到有关新的Cats-Effect库的消息

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

Immidiately added the following line to my ammonite shell predef.sc 将以下行直接添加到我的炸药壳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")

Now when I load my ammonite shell. 现在,当我加载我的炸药壳时。 I get error 我得到错误

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

Googled and found a solution here 搜寻并在这里找到解决方案

Package contains object and package with same name 程序包包含对象和具有相同名称的程序包

But I wonder how can I apply the -Yresolve-term-conflict:strategy to the ammonite shell? 但是我不知道如何将-Yresolve-term-conflict:strategy应用于-Yresolve-term-conflict:strategy壳?

I was able to solve it myself. 我自己解决了。 Here are the right imports 这是正确的进口

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

Now everything works fine 现在一切正常

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM