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 Aux[T] { | |
type R | |
def apply(t: T): R | |
} | |
implicit val sa = new Aux[String] { | |
type R = Boolean | |
def apply(s: String): Boolean = s.isEmpty | |
} |
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
Finatra | |
No Payload | |
Running 30s test @ http://localhost:8888/hi | |
12 threads and 400 connections | |
Thread Stats Avg Stdev Max +/- Stdev | |
Latency 20.43ms 30.84ms 376.23ms 86.54% | |
Req/Sec 3.48k 750.12 14.54k 79.75% | |
1249354 requests in 30.04s, 86.98MB read |
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> sealed trait Op | |
defined trait Op | |
scala> case class Foo(s: String) extends Op | |
defined class Foo | |
scala> case class Ciao(i: Int) extends Op | |
defined class Ciao | |
scala> case class Bar(op: Op, b: Boolean) |
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
Homebrew build logs for neovim/neovim/neovim on OS X 10.11.4 | |
Build date: 2016-03-31 12:27:10 |
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 scalaz._ | |
import Scalaz._ | |
/** I think there are two use cases where implicits are very useful: | |
* TypeClasses | |
* Pimp or Rich pattern | |
* | |
* Let's start with typeclasses, probably the more popular, | |
* e.g. Collection library in Scala is all TC based, look for CanBuildFrom | |
*/ |
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 Config { | |
val timeout: Int = 1 | |
val interval: Int = 2 | |
def wantToChangeThis: Int | |
} | |
object DefaultConfig extends Config { | |
val wantToChangeThis: Int = 34 | |
} |
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 Foo { | |
case class Bar(i: Int, s: String) | |
} | |
val fb1 = new Foo {}.Bar(3, "ciao") | |
val fb2 = new Foo {}.Bar(3, "ciao") | |
val equal = fb1 == fb2 | |
println(s"equal: ${equal}") // equal: false |
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 console extends App { | |
trait Nat { | |
type Plus[That <: Nat] <: Nat | |
} | |
trait _0 extends Nat { | |
type Plus[That <: Nat] = That | |
} | |
trait Succ[N <: Nat] extends Nat { | |
type Plus[That <: Nat] = Succ[N#Plus[That]] |
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.record._ | |
import shapeless.ops.record._ | |
import shapeless.ops.hlist._ | |
object console extends App { | |
object sql { | |
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.record._ | |
import shapeless.ops.hlist.Selector | |
object console extends App { | |
trait HListContains[T <: HList, R <: HList] | |
object HListContains { |
NewerOlder