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 scalaz.{-\/, Applicative, Coproduct, Free, FreeAp, Inject, Monad, NaturalTransformation, Nondeterminism, \/-, ~>} | |
import scala.language.{higherKinds, reflectiveCalls} | |
import scalaz.concurrent.Task | |
import Task._ | |
import scala.util.Random | |
case class User(name: String, age: Int) | |
sealed trait UserOperation[T] | |
case class CreateUser(name: String, age: Int) extends UserOperation[User] |
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 scalaz.effect.IO | |
trait Source[F[_], A] { | |
def iterator(s: F[A]): Iterator[A] | |
} | |
object Source { | |
implicit def listSource[A]: Source[List, A] = (s: List[A]) => s.toIterator | |
implicit def streamSource[A]: Source[Stream, A] = (s: Stream[A]) => s.toIterator | |
} |
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
// Note that this is written in terms of functions for now. We will rewrite this with arrows etc | |
// and work out the reified encoding once we agree on the API | |
/** | |
* At a high level, there are two core concepts here | |
* 1. Data | |
* 2. Computation | |
* | |
* The Data can be thought of as Bounded or Unbounded. | |
* This generally corresponds to a "batch" source or a "streaming" source. |
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
// Following model based on the description of | |
// Apache Beam in the book Streaming Systems by Reuven Lax; Tyler Akidau; Slava Chernyak | |
/** | |
* Tables are data at rest, and act as a container for data to accumulate and be observed over time. | |
* K = Key | |
* V = Value | |
* W = Window | |
* P = Partition | |
*/ |