This file contains 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
val runner = AttributeKey[Runner]("runner") | |
val start = TaskKey[Unit]("start", "start web runner") | |
val stop = TaskKey[Unit]("stop", "stop web runner") | |
trait Startable { | |
def start() | |
def stop() | |
} | |
class Runner { |
This file contains 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 shapeless._ | |
import shapeless.nat._ | |
import shapeless.ops.nat._ | |
import shapeless.ops.hlist._ | |
trait Fizz | |
trait Buzz | |
trait Match[N <: Nat, FB] { def s: String } |
This file contains 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
build --javabase=//:jdk | |
build --host_javabase=//:jdk | |
build --java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8 | |
build --host_java_toolchain=@bazel_tools//tools/jdk:toolchain_hostjdk8 |
This file contains 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 HListContains[-H <: HList, A] { def apply(h: H):A } | |
implicit def headContains[A, T <: HList] = new HListContains[A :: T, A] { | |
def apply(h: A :: T) = h.head | |
} | |
implicit def tailContains[A, H, T <: HList](implicit tc: HListContains[T, A]) = new HListContains[H :: T, A] { | |
def apply(h: H :: T) = tc(h.tail) | |
} |
This file contains 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
<stephenjudkins> luft: SBT can do anything, it's turing-complete | |
<stephenjudkins> there are examples of SBT tasks that generate scala source code | |
<dobblego> sbt is turing-complete? what does this mean? | |
<mapreduce> It can use an infinite amount of tape. | |
<stephenjudkins> luft: see https://github.com/twitter/sbt-scrooge | |
<dobblego> what does it mean specifically for sbt to be turing-complete? | |
<stephenjudkins> dobblego: use your imagination, and don't pick fights | |
<dobblego> jesus christ you are sook | |
<dobblego> it's a fucking question | |
<dobblego> can you tell me what it means please? |
This file contains 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 Imp[T] {} | |
object Imp { | |
implicit val i = new Imp[Int] {} | |
} | |
import Imp._ | |
trait F { | |
type T |
This file contains 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 Sort extends App { | |
//val toCells = (_: String).trim.split(" +") | |
//val input = io.Source.stdin.getLines.toList.map(toCells).foreach{line => } | |
val input = List("car", "truck", "8", "4", "bus", "6", "1") | |
val (matches, mismatches) = input.partition(_.matches("""\d+""")) | |
} |
This file contains 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> @annotation.implicitNotFound("whoa there! ${A} is not ${B}, buddy") trait Equals[A,B] | |
defined trait Equals | |
scala> implicit def equals[A,B](implicit e: A =:= B):Equals[A,B] = null | |
equals: [A, B](implicit e: =:=[A,B])Equals[A,B] | |
scala> implicitly[Equals[String, Int]] | |
<console>:16: error: whoa there! String is not Int, buddy | |
implicitly[Equals[String, Int]] | |
^ |
This file contains 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> @annotation.implicitNotFound("oh no! could not find Foo with ${A} ${B}") trait Foo[A,B] | |
defined trait Foo | |
scala> implicitly[Foo[String, Int]] | |
<console>:12: error: oh no! could not find Foo with String Int | |
implicitly[Foo[String, Int]] |
This file contains 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 bytecask.Bytecask | |
import org.slf4j.{LoggerFactory, Logger} | |
import akka.dispatch.Future | |
import annotation.tailrec | |
import org.slf4j.helpers.{NOPLoggerFactory, SubstituteLoggerFactory} | |
private def tellLoggerToStfu() { | |
@tailrec def impl(i: Int, wait: Long) { | |
Thread.sleep(wait - 1) | |
LoggerFactory.getILoggerFactory() match { |
NewerOlder