|
Scala example source code file (Callable.scala)
The Callable.scala Scala example source codepackage scalaz package std.java.util.concurrent import java.util.concurrent.Callable trait CallableInstances { implicit def callableOrder[A: Order] = new Order[Callable[A]] { def order(f1: Callable[A], f2: Callable[A]) = Order[A].order(f1.call, f2.call) } implicit val callableMonad: Monad[Callable] = new Monad[Callable] { override def map[A, B](fa: Callable[A])(f: A => B) = new Callable[B] { def call() = f(fa.call) } def bind[A, B](fa: Callable[A])(f: A => Callable[B]) = new Callable[B] { def call() = f(fa.call).call } def point[A](a: => A) = new Callable[A] { def call() = a } } } object callable extends CallableInstances Other Scala examples (source code examples)Here is a short list of links related to this Scala Callable.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.