Skip to content

Instantly share code, notes, and snippets.

View bkovitz's full-sized avatar

Ben Kovitz bkovitz

View GitHub Profile
trait CanBoost[S, D] extends D => D => State[S, Unit]
def boost[S, D](from: D, to: D)(implicit run: CanBoost[S, D]): State[S, Unit] =
run(from)(to)
trait GetValueFunc[S, D, V] extends D => State[S, Option[ValueFunc[V]]]
def invalues[S, D, V](d: D)
(implicit getValueFunc: GetValueFunc[S, D, V],
officialPartner: GetOfficialPartner[S, D],
@bkovitz
bkovitz / Scala Option[Collection] benchmark
Last active August 29, 2015 14:02
Scala Option[Collection] benchmark
/*
* Benchmarks of answers posted to http://stackoverflow.com/questions/23914713
* "How do you stop building an Option[Collection] upon reaching the first None?"
*
* Results:
*
* version ms per iteration
* ------- ----------------
* allPartsIterator: 0.001022
* allPartsMatchReturn: 0.001544