Skip to content

Instantly share code, notes, and snippets.

View Krasnyanskiy's full-sized avatar

Sasha Krasnyanskiy

  • Cupertino, California
View GitHub Profile
@Krasnyanskiy
Krasnyanskiy / PointCover.scala
Last active July 14, 2016 20:27
-scala: Stepic algorithms
/**
* @author Alexander Krasniansky
*/
object PointCover extends App {
case class Point(x: Int)
case class Segment(start: Int, end: Int)
def cover(points: Seq[Point], segmentLength: Int): Seq[Segment] = points match {
case x :: _ =>

The Easy-Peasy-Lemon-Squeezy, Statically-Typed, Purely Functional Programming Workshop for All!

John A. De Goes — @jdegoes


Agenda

  • Functions
  • Types, Kinds, & More Functions
  • FP Toolbox
import scalaz._
import scalaz.std.list._
import scalaz.syntax.monad._
import scalaz.syntax.monoid._
import scalaz.syntax.traverse.{ToFunctorOps => _, _}
class Foo[F[+_] : Monad, A, B](val execute: Foo.Request[A] => F[B], val joins: Foo.Request[A] => B => List[Foo.Request[A]])(implicit J: Foo.Join[A, B]) {
def bar: Foo[({type l[+a]=WriterT[F, Log[A, B], a]})#l, A, B] = {
type TraceW[FF[+_], +AA] = WriterT[FF, Log[A, B], AA]