Created
September 10, 2017 15:09
-
-
Save LukaJCB/31b47c3de1843e7b80edc59f9d5321c0 to your computer and use it in GitHub Desktop.
ParallelTaglessFinal
This file contains 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
import cats._ | |
import cats.implicits._ | |
trait Alg[M[_]] { | |
def doSomething(s: String): M[Unit] | |
} | |
object AlgVect extends Alg[Vector] { | |
def doSomething(s: String): Vector[Unit] = Vector(println(s)) | |
} | |
def program[M[_]: Monad, F[_]](list: Vector[String])(M: Alg[M])(implicit P: Parallel[M, F]) = | |
list.parTraverse(M.doSomething) | |
program(Vector("Hello", "World"))(AlgVect) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment