|
Scala example source code file (Run.scala)
The Run.scala Scala example source codepackage scalaz package concurrent trait Run[F] { self => def run(a: F): Unit def strategy: Strategy def !(a: F): () => Unit = strategy(run(a)) // derived functions def contramap[B](f: B => F): Run[B] = new Run[B] { def run(a: B) = self.run(f(a)) def strategy: Strategy = self.strategy } } object Run { def apply[A](c: A => Unit)(implicit s: Strategy): Run[A] = new Run[A] { def run(a: A) = c(a) val strategy = s } implicit def RunFrom[A](e: Run[A]): A => Unit = e.run _ implicit val runContravariant = new Contravariant[Run] { def contramap[A, B](r: Run[A])(f: B => A): Run[B] = new Run[B] { def strategy: Strategy = r.strategy def run(a: B) { r.run(f(a)) } } } //// } Other Scala examples (source code examples)Here is a short list of links related to this Scala Run.scala source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.