Skip to content

Instantly share code, notes, and snippets.

View stliang's full-sized avatar

Steve Liang stliang

View GitHub Profile
@stliang
stliang / partask.scala
Created May 30, 2016 23:09 — forked from pchiusano/partask.scala
Applicative for scalaz.concurrent.Task that 'automatically' parallelizes the applicative operations
import scalaz.Applicative
import scalaz.concurrent.Task
/**
* This `Applicative[Task]` runs tasks in parallel, by defining
* `ap` and `apply2` in terms of `mapBoth`. This differs from the
* default `Applicative[Task]`, where effects are sequenced
* deterministically, in left to right order.
*/
val T = new Applicative[Task] {
@stliang
stliang / gist:7a0b2129252608b32cb7
Created December 12, 2015 02:11 — forked from runarorama/gist:a8fab38e473fafa0921d
Compositional application architecture with reasonably priced monads
sealed trait Interact[A]
case class Ask(prompt: String)
extends Interact[String]
case class Tell(msg: String)
extends Interact[Unit]
trait Monad[M[_]] {
def pure[A](a: A): M[A]