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 io.circe._ | |
import io.circe.generic.semiauto._ | |
import org.scalacheck._, derive._ | |
sealed trait Or[+A, +B] extends Product with Serializable | |
final case class Left[A](a: A) extends Or[A, Nothing] | |
final case class Right[B](b: B) extends Or[Nothing, B] | |
object Or { |
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 a1 { | |
implicit val foo: Int = 1 | |
} | |
object a2 { | |
implicit val foo: String = "foo" | |
} | |
{ | |
import a1._, a2._ |
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
case class Foo(a: Int) | |
class Bar(a: Int, b: Int) extends Foo(a) | |
// Returns false | |
new Bar(1, 2) == new Bar(2, 2) | |
// Returns true!! | |
new Bar(1, 2) == new Bar(1, 3) |
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 org.scalatest.FunSuite | |
import org.scalatest.prop.GeneratorDrivenPropertyChecks | |
import java.text.SimpleDateFormat | |
import java.util.{Date, Locale} | |
import org.scalacheck._ | |
class Repr extends FunSuite with GeneratorDrivenPropertyChecks { | |
implicit val cogenDate: Cogen[Date] = Cogen(_.getTime) | |
implicit val formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSSz", Locale.ENGLISH) |
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
markdown: kramdown | |
highlighter: rouge | |
collections: | |
tut: | |
output: true |
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 ops1._ | |
import ops2._ | |
object ops1 { | |
implicit class TestOps(val str: String) { | |
def op1: String = str | |
} | |
} | |
object ops2 { |
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
package foo | |
trait Decoder[E, D] { | |
def decode(e: E): 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
// Represents a named collection of documents of type A | |
trait Documents[A] { | |
def name: String | |
def take(target: Int): Documents[A] | |
// [...] | |
} | |
// Represents a collection of named collections of documents. | |
// A is the type of a document, D that of a named collection of documents |
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
> last core/compile:compile | |
[debug] | |
[debug] Initial source changes: | |
[debug] removed:Set() | |
[debug] added: Set() | |
[debug] modified: Set() | |
[debug] Removed products: Set(/Users/nicolasrinaudo/dev/nrinaudo/tabulate/core/target/scala-2.11/classes/tabulate/RowDecoder$$anonfun$tuple3$1.class, /Users/nicolasrinaudo/dev/nrinaudo/tabulate/core/target/scala-2.11/classes/tabulate/RowDecoder$$anonfun$caseDecoder20$1$$anonfun$apply$198$$anonf$$$$84a54a79d7c6b00e342f21de72f88d9$$$$$211$$anonfun$apply$212$$anonfun$apply$213$$anonfun$apply$214$$anonfun$apply$215.class, /Users/nicolasrinaudo/dev/nrinaudo/tabulate/core/target/scala-2.11/classes/tabulate/CellDecoder$$anonfun$10$$anonfun$apply$9.class, /Users/nicolasrinaudo/dev/nrinaudo/tabulate/core/target/scala-2.11/classes/tabulate/RowDecoder$$anonfun$caseDecoder8$1$$anonfun$apply$36$$anonfun$apply$37.class, /Users/nicolasrinaudo/dev/nrinaudo/tabulate/core/target/scala-2.11/classes/tabulate/CellEncoder$$anonfun$opt$1.class, /Users/nicolasrinaudo/dev/nrinaudo/tabulate/core/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
import export._ | |
trait Encoder[T] { | |
// Type class defns ... | |
} | |
object Encoder extends EncoderLowPriority { | |
// Instances which should be higher priority than derived | |
// or subclass instances should be defined here ... | |
} |