Skip to content

Instantly share code, notes, and snippets.

@ezzahraoui
ezzahraoui / IntervalJsonReadWrite.scala
Created May 9, 2016 11:17
Play Json read/write for spire.math.Interval
import spire.math._
import spire.math.interval._
import spire.implicits._
import play.api.libs.json._
implicit object IntervalFormat extends Format[Interval[Double]] {
def reads(json: JsValue): JsResult[Interval[Double]] = {
def JsValueToBound(jsValue: JsValue): Bound[Double] = {
val boundType = (jsValue \ "type").as[String]
boundType match {