This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait IsNotFuture[+F] | |
object IsNotFuture{ | |
def apply[F](implicit isf: IsNotFuture[F]) = isf | |
implicit def mkFuture[A] = new IsNotFuture[Future[A]] {} | |
implicit object isf extends IsNotFuture[Any] {} | |
} | |
//No need for a dependent type. All you need is the implicit ambiguity. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
trait Change[+A]{ | |
def map[B](f: A => B): Change[B] | |
def flatMap[B](f: A => Change[B]): Change[B] | |
def foreach(f: A => Unit): Unit | |
def filter(pred: A => Boolean): Change[A] | |
} | |
case class Reversible[+A](value: A, undo: List[Undo]) extends Change[A]{ | |
def map[B](f: A => B) = Reversible(f(value), undo) | |
def flatMap[B](f: A => Change[B]) = f(value) match{ |