Skip to content

Instantly share code, notes, and snippets.

View vmarquez's full-sized avatar

Vincent Marquez vmarquez

  • Irvine, CA
View GitHub Profile
def liftT[G[_[_], _], M[_]: Monad, A](a: M[A])(implicit ML: MonadLiftT[G, F], M: Monad[M]): G[M, A] = ML.liftT[M, A](M.map(a)(aa => point(aa)))
@vmarquez
vmarquez / SeparateTasks.scala
Last active January 13, 2016 05:23
SeparateTasks.scala
def taskSeparation[F[_], A](fa: List[F[A]])(implicit M: Catchable[F], N: Nondeterminism[F]): F[(List[Throwable], List[A])] =
N.gatherUnordered(fa.map(f => M.attempt(f))).map(_.separate)
As a past and future speaker of LambdaConf, I wanted to share my thoughts on the Curtis Yarvin controversy. I do not agree
with excluding attendees nor speakers because of their beliefs or writings. However, it has become clear to me that Curtis Yarvin
has been and continues to be disingenuous when it comes to his claim of separating himself from his 'Moldbug' persona. This, combined
with his large sphere of influence in a repgunant political movement leads me to believe having Curtis at LambdaConf will detract from
the overall goal of spreading functional programming as well as reaching under represented groups. I do not support Lambda Conf's
decision to allow Curtis Yarvin to speak in 2016. I coninue to support LambdaConf's overall mission of inclusion, am happy to see they
continue to offer divirsity scholarships, and plan on speaking in 2016 despite Curtis Yarvin's attendance.
import scalaz._
import Scalaz._
import IndexedStateT._
type ParserM[S, A] = EitherT[({ type l[a] = StateT[Trampoline, S, a]})#l, String, A]
def getVerbose[S]: ParserM[S, S] = {
//https://github.com/scalaz/scalaz/blob/series/7.3.x/core/src/main/scala/scalaz/MonadState.scala
val monadState = stateTMonadState[S, Trampoline]
val state: StateT[Trampoline, S, S] = monadState.get
object Test {
import scalaz.\/
import scala.concurrent.{ExecutionContext, Await, Future}
import scala.concurrent.duration._
import scala.concurrent.ExecutionContext.Implicits.global
import scalaz.syntax.std.option._
def flipOption[A](l: List[Option[A]]): Option[List[A]] =
l.foldLeft(List[A]().some)
((accumulator: Option[List[A]], optiona: Option[A]) => accumulator.flatMap((la: List[A]) => optiona.map((a: A) => a :: la)))
public class Event {
@PartitionKey(0) public UUID accountId
@PartitionKey(1)public String yearMonthDay;
@ClusteringKey public UUID eventId;
//other data...
}
public static void sampleUsage() {
//we want to ONLY query data from three years ago for a set of accounts, so we will generate that somehow.
//Also note that one token will likely generate many Events...
date cases county
02-01-2020 1 Orange
02-02-2020 0 Orange
02-03-2020 0 Orange
02-04-2020 0 Orange
02-05-2020 0 Orange
02-06-2020 0 Orange
02-07-2020 0 Orange
02-08-2020 0 Orange
02-09-2020 0 Orange