wei-k.zeroapply_2.13.0-M4.0.2.2.source-code.LazyEitherImpl.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of zeroapply_2.13.0-M4 Show documentation
Show all versions of zeroapply_2.13.0-M4 Show documentation
zero cost Apply/Applicative syntax
The newest version!
package zeroapply
import scala.reflect.macros.blackbox.Context
final class LazyEitherImpl(override val c: Context) extends EitherBase {
import c.universe._
override protected def getValDef(name: TermName, left: Type, right: Type, body: Tree) =
q"""val $name: _root_.scalaz.LazyEither[$left, $right] = $body"""
override protected def wrapRight(value: Tree) =
q"""_root_.scalaz.LazyEither.lazyRight($value)"""
override protected def rightValue(value: Tree, left: Type, right: Type) =
q"""$value.toOption.get"""
override protected def asEither(value: Tree, left: Type, right: Tree) =
q"""$value.asInstanceOf[_root_.scalaz.LazyEither[$left, $right]]"""
}