【发布时间】:2017-03-12 02:58:20
【问题描述】:
我正在尝试在 REPL 中使用asRight 创建Either 的实例:
import cats._
import cats.data._
import cats.implicits._
scala> val x = "xxx".asRight
<console>:20: error: value asRight is not a member of String
val x = "xxx".asRight
^
scala> import cats.syntax.either._
import cats.syntax.either._
scala> val x = "xxx".asRight
<console>:23: error: value asRight is not a member of String
val x = "xxx".asRight
^
上面的代码有什么问题?是否可以在 REPL 中使用 asRight ?
【问题讨论】:
标签: scala either scala-cats scala-repl