Skip to content

Instantly share code, notes, and snippets.

@stephen-lazaro
Created October 4, 2018 19:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save stephen-lazaro/c6deeaa58dae72e9ea6fa1391a215a92 to your computer and use it in GitHub Desktop.
Save stephen-lazaro/c6deeaa58dae72e9ea6fa1391a215a92 to your computer and use it in GitHub Desktop.
// Notice we're just extending our prior notion.
trait Alternative[F[_]] {
  // Kind of like true, or 1
  def pure[A](x: A): F[A]
// Kind of like boolean AND, or multiplication
 def product[A, B](fa: F[A], fb: F[B]): F[(A, B)]
// Kind of like false, or 0
  def empty[A]: F[A]
// Kind of like boolean XOR, or addition
  // Named this way for Reasons™
  def combineK[A](x: F[A], y: F[A]): F[A]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment