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
| import java.math.MathContext | |
| import shapeless.datatype.record._ | |
| object Example extends App { | |
| case class BigBoy(x: BigDecimal) | |
| implicit def compareBigDecimals(x: BigDecimal, y: BigDecimal): Boolean = { | |
| println("custom bigdecimal comparison invoked") | |
| x.compareTo(y) == 0 |
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
| class Meter(val value: Double) extends AnyVal { | |
| def toFeet = new Feet(value * 3.281) | |
| } | |
| class Feet(val value: Double) extends AnyVal { | |
| def toMeter = new Meter(value / 3.281) | |
| } | |
| object Example { | |
| def convert(meter: Meter): Feet = { | |
| meter.toFeet |
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 com.spotify | |
| import org.scalatest.prop.GeneratorDrivenPropertyChecks | |
| import org.scalatest.{FlatSpec, Matchers} | |
| class ExampleTest extends FlatSpec with Matchers with GeneratorDrivenPropertyChecks { | |
| implicit override val generatorDrivenConfig = | |
| PropertyCheckConfig(minSize = 100, maxSize = 200) | |
| "strings" should "have same length when lowercased / uppercased" in { |
OlderNewer