Scala Intellij:IO[Long]类型的表达式不';t符合预期的类型FS2\uO2\

Scala Intellij:IO[Long]类型的表达式不';t符合预期的类型FS2\uO2\,scala,intellij-idea,fs2,cats-effect,Scala,Intellij Idea,Fs2,Cats Effect,我尝试了这个博客的代码: 在Intellij中此代码: Stream("bob", "alice", "joe") .evalMap(name => IO.fromFuture(IO(loadUserIdByName(name)))) // <- here is the exception .compile .toList 使用sbt运行代码不会出现问题 有没有办法在Intellij中消除这个异常?我注意到typechecker在这里总是需要一些

我尝试了这个博客的代码:

在Intellij中此代码:

Stream("bob", "alice", "joe")
      .evalMap(name => IO.fromFuture(IO(loadUserIdByName(name)))) // <- here is the exception
      .compile
      .toList
使用
sbt
运行代码不会出现问题


有没有办法在Intellij中消除这个异常?

我注意到typechecker在这里总是需要一些帮助,所以明确地设置效果和返回类型:在您的情况下,
evalMap[IO,Long]

您可以自己设置类型
evalMap[IO,Long]
@Raf谢谢你的帮助你能给我一个答案让我接受吗?
Expression of type IO[Long] doesn't conform to expected type FS2_[O2_]