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
| " requirements: | |
| " | |
| " - the `trans` command from https://www.soimort.org/translate-shell/ | |
| " - '+python3' in `vim --version` | |
| " | |
| " | |
| " Usage: | |
| " | |
| " Ctrl-l over any word you want to look up. You should see something like 'trollte bedeutet toddled' | |
| " at the bottom of the screen and a file like 'trollte-1531294267.0744178' in ~/lookedup/ with the detailed |
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
| scala> Stream.iterate(0)(_ + 1) | |
| res1: scala.collection.immutable.Stream[Int] = Stream(0, ?) | |
| scala> res1.take(10).toList | |
| res2: List[Int] = List(0, 1, 2, 3, 4, 5, 6, 7, 8, 9) | |
| scala> case class State[S, A](f: S => (S, A)) | |
| defined class State | |
| // fmap = flatmap |
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 rxvl | |
| import java.text.SimpleDateFormat | |
| import org.http4s.client.blaze._ | |
| import java.util.Date | |
| import cats.instances.map._ | |
| import cats.instances.int._ | |
| import cats.instances.tuple._ |
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
| case class ValidatedT[F[_], +E, +A](run: F[Validated[E, A]]) | |
| import cats.Monad | |
| import cats.syntax.flatMap._ | |
| object ValidatedT { | |
| implicit def monad[F[_]: Monad, E]: Monad[({type l[a] = ValidatedT[F, E, a]})#l] = new Monad[({type l[a] = ValidatedT[F, E, a]})#l] { | |
| def pure[A](x: A) = ValidatedT(Monad[F].pure(Validated.valid(x))) | |
| def flatMap[A, B](fa: ValidatedT[F, E, A])(f: (A) => ValidatedT[F, E, B]) = | |
| ValidatedT(fa.run.flatMap(_.fold(e => Monad[F].pure(Validated.invalid[E, B](e)), i => f(i).run))) |
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
| name := "typelevel-recursion-schemes-talk" | |
| scalaVersion := "2.11.8" | |
| scalacOptions ++= Seq("-feature", "-language:higherKinds") |
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 rxvl | |
| import matryoshka._ | |
| import matryoshka.data._ | |
| import scalaz.{Functor, \/-, -\/} | |
| object AnyListFix { | |
| type T = matryoshka.data.Fix[AnyListF] | |
| def nil: Fix[AnyListF] = Fix[AnyListF](Nil) |
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
| def map[A, B](f: A => B)(as: List[A]): List[B] = { | |
| as match { | |
| case Nil => Nil | |
| case h :: t => f(h) :: map(f)(t) | |
| } | |
| } | |
| def fold[A, B](z: B)(f: (A, B) => B)(as: List[A]): B = { | |
| as match { |
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
| sealed trait IsDataType[F[_], L <: HList] | |
| object IsDataType { | |
| implicit def hnil[F[_]]: IsDataType[F, HNil] = new IsDataType[F, HNil] {} | |
| implicit def rest[F[_], H, T <: HList : ({type l[a] = IsDataType[F, a]})#l]: IsDataType[F, ::[F[H], T]] = | |
| new IsDataType[F, F[H] :: T] {} | |
| } | |
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
| object Zip { | |
| import java.io._ | |
| import java.util.zip._ | |
| import org.apache.commons.io.IOUtils | |
| private val logger = LoggerFactory.getLogger(getClass) | |
| private val BUFFER = 2048 | |
| def zip(inputDir: File): Option[File] = { | |
| val zipFile = File.createTempFile("zippedArtifact", ".zip") |
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
| #!/bin/sh | |
| getOrElse() { | |
| if [ -z "$1" ] | |
| then echo $2 | |
| else | |
| echo $1 | |
| fi | |
| } |
NewerOlder