This file contains hidden or 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
| {-# LANGUAGE MultiParamTypeClasses #-} | |
| {-# LANGUAGE ConstrainedClassMethods #-} | |
| module Hylo(CoAlgebra(..), Anamorphism(..), Algebra(..), Catamorphism(..)) where | |
| newtype CoAlgebra x u = CoAlgebra { | |
| unfold :: u -> Either () (x, u) | |
| } | |
| class Anamorphism m where |
This file contains hidden or 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 akka.http.scaladsl.Http | |
| import akka.http.scaladsl.Http.ServerBinding | |
| import com.graboids.alpha.service.users.app.Application | |
| import com.graboids.alpha.service.users.config.resolveConfig | |
| import com.graboids.config.hocon._ | |
| import com.graboids.fp._ | |
| import scalaz.NonEmptyList._ | |
| import scalaz.ioeffect.console._ | |
| import scalaz.ioeffect.{IO, SafeApp, Void} |
This file contains hidden or 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 akka.http.scaladsl.model.HttpMethod | |
| final case class Cors(domain: String, methods: List[HttpMethod]) |
This file contains hidden or 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
| trait Isomorphism[Arrow[_, _], A, B] { | |
| def to: Arrow[A, B] | |
| def from: Arrow[B, A] | |
| } |
This file contains hidden or 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
| package nl.autotrack.data.batches.metrics | |
| import java.time.format.DateTimeFormatter | |
| import com.amazonaws.client.builder.AwsClientBuilder.EndpointConfiguration | |
| import com.amazonaws.services.kinesis.AmazonKinesisClientBuilder | |
| import com.amazonaws.services.kinesis.clientlibrary.lib.worker.InitialPositionInStream | |
| import com.persogroep.aws.kinesis.{AWSStreamProxy, RegionNameIdentification} | |
| import nl.autotrack.data.metrics.raw.{DateFormats, Formats, MetricRequest, OwnerLenses, OwnerTarget, Setting} | |
| import org.apache.spark.SparkConf |
This file contains hidden or 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 scala.language.higherKinds | |
| //Contract on what can be cached | |
| trait CanBeCached[T] | |
| trait InMemory[T] extends CanBeCached[T] | |
| //Contracts inherited persistable implementations | |
| trait Persistable[T] extends CanBeCached[T] | |
| trait InheritPersistable[T, +R <: InheritPersistable[T, R]] extends Persistable[T] { self: R => } |
This file contains hidden or 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
| private static <T> Consumer<T> traceMessage(final String prefix) { | |
| return t -> System.out.println(String.format("%s: %s", prefix, t)); | |
| } | |
| final Comparator<Person> compareAsc = Person::ageDifference; | |
| people.stream().min(compareAsc).ifPresent(traceMessage("Younger")); |
This file contains hidden or 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
| trait Runnable[A] { | |
| def run: A | |
| } | |
| object Delay { | |
| def apply[A](a: => A) = new Runnable[A] { | |
| def run: A = a | |
| } | |
| def map[A, B](r: Runnable[A])(f: A => B): Runnable[B] = new Runnable[B] { |
This file contains hidden or 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
| trait PipelineBuilder { | |
| def createStage[I, O](f: I => O) : Stage[I, O] | |
| def link[I, O, P >: O, Q](first: Stage[I, O], second: Stage[P,Q]) : Stage[I, Q] | |
| } | |
| //a pipeline is composed of stages | |
| trait Stage[I, O] extends (I => O) { | |
| owner => |
This file contains hidden or 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
| trait SequenceValidation[B] { | |
| self => | |
| def apply[A](seq: Seq[A]): DomainValidation[Seq[B]] | |
| def map[C](f: B => C) = new SequenceValidation[C] { | |
| def apply[A](seq: Seq[A]): DomainValidation[Seq[C]] = | |
| self.apply(seq) map { validSequence => validSequence map f } | |
| } | |
| def flatMap[C](f: B => SequenceValidation[C]) = new SequenceValidation[C] { |
NewerOlder