diff --git a/core/shared/src/main/scala/reftree/core/RefTree.scala b/core/shared/src/main/scala/reftree/core/RefTree.scala index f53af05..19c6105 100644 --- a/core/shared/src/main/scala/reftree/core/RefTree.scala +++ b/core/shared/src/main/scala/reftree/core/RefTree.scala @@ -133,9 +133,7 @@ trait ToRefTree[A] { self => object ToRefTree extends CollectionInstances with HackedCollectionInstances with GenericInstances { /** A shorthand method for creating [[ToRefTree]] instances */ - def apply[A](toRefTree: A => RefTree): ToRefTree[A] = new ToRefTree[A] { - def refTree(value: A) = toRefTree(value) - } + def apply[A](toRefTree: A => RefTree): ToRefTree[A] = (value: A) => toRefTree(value) def const[A](refTree: => RefTree): ToRefTree[A] = (_: A) => refTree diff --git a/core/shared/src/main/scala/reftree/geometry/Interpolation.scala b/core/shared/src/main/scala/reftree/geometry/Interpolation.scala index 262f58a..21aaa1f 100644 --- a/core/shared/src/main/scala/reftree/geometry/Interpolation.scala +++ b/core/shared/src/main/scala/reftree/geometry/Interpolation.scala @@ -49,9 +49,7 @@ trait SemiInterpolation[A] { self => } object SemiInterpolation { - def apply[A](f: (A, Double) => A): SemiInterpolation[A] = new SemiInterpolation[A] { - def apply(value: A, t: Double) = f(value, t) - } + def apply[A](f: (A, Double) => A): SemiInterpolation[A] = (value: A, t: Double) => f(value, t) } /** @@ -213,9 +211,8 @@ trait Interpolation[A] { self => object Interpolation { /** A shorthand for constructing interpolations */ - def apply[A](f: (A, A, Double) => A): Interpolation[A] = new Interpolation[A] { - def apply(left: A, right: A, t: Double): A = f(left, right, t) - } + def apply[A](f: (A, A, Double) => A): Interpolation[A] = + (left: A, right: A, t: Double) => f(left, right, t) /** A basic linear interpolation for doubles */ val double = Interpolation[Double]((l, r, t) => l * (1 - t) + r * t) diff --git a/core/shared/src/main/scala/reftree/geometry/Point.scala b/core/shared/src/main/scala/reftree/geometry/Point.scala index 7a81553..54f1547 100644 --- a/core/shared/src/main/scala/reftree/geometry/Point.scala +++ b/core/shared/src/main/scala/reftree/geometry/Point.scala @@ -12,9 +12,7 @@ trait Translatable[A] { } object Translatable { - def apply[A](f: (A, Point) => A): Translatable[A] = new Translatable[A] { - def translate(value: A, delta: Point) = f(value, delta) - } + def apply[A](f: (A, Point) => A): Translatable[A] = (value: A, delta: Point) => f(value, delta) implicit def `List Translatable`[A](implicit t: Translatable[A]): Translatable[List[A]] = Translatable((value, delta) => value.map(t.translate(_, delta)))