From c18a6b7c86c34e8cc7b3747fc1ea83d42c8b5410 Mon Sep 17 00:00:00 2001 From: Filipe Regadas Date: Thu, 28 Apr 2022 07:52:50 +0100 Subject: [PATCH] Update scalafmt to v3.5.2 (#1063) --- .scalafmt.conf | 2 +- .../com/twitter/algebird/CountMinSketch.scala | 4 ++-- .../scala/com/twitter/algebird/Eventually.scala | 17 ++++++++++++----- .../main/scala/com/twitter/algebird/Fold.scala | 2 +- .../com/twitter/algebird/ResetAlgebra.scala | 10 +++++++--- .../scala/com/twitter/algebird/Window.scala | 2 +- 6 files changed, 24 insertions(+), 13 deletions(-) diff --git a/.scalafmt.conf b/.scalafmt.conf index b7f5911ec..7d23dff4c 100644 --- a/.scalafmt.conf +++ b/.scalafmt.conf @@ -1,4 +1,4 @@ -version=3.3.1 +version=3.5.2 runner.dialect = scala212 fileOverride { "glob:**/scala-2.13*/**" { diff --git a/algebird-core/src/main/scala/com/twitter/algebird/CountMinSketch.scala b/algebird-core/src/main/scala/com/twitter/algebird/CountMinSketch.scala index 3e8d47c39..f000c7fe3 100644 --- a/algebird-core/src/main/scala/com/twitter/algebird/CountMinSketch.scala +++ b/algebird-core/src/main/scala/com/twitter/algebird/CountMinSketch.scala @@ -552,7 +552,7 @@ object CMS { * and thus the returned frequency estimates are always instances of `Approximate[Long]`. * * @example - * {{{ + * {{{ * * // Creates a monoid for a CMS that can count `Long` elements. val cmsMonoid: CMSMonoid[Long] = { val eps = * 0.001 val delta = 1E-10 val seed = 1 CMS.monoid[Long](eps, delta, seed) } @@ -560,7 +560,7 @@ object CMS { * // Creates a CMS instance that has counted the element `1L`. val cms: CMS[Long] = cmsMonoid.create(1L) * * // Estimates the frequency of `1L` val estimate: Approximate[Long] = cms.frequency(1L) - * }}} + * }}} * * @tparam K * The type used to identify the elements to be counted. diff --git a/algebird-core/src/main/scala/com/twitter/algebird/Eventually.scala b/algebird-core/src/main/scala/com/twitter/algebird/Eventually.scala index ea4c8d8d6..19522f589 100644 --- a/algebird-core/src/main/scala/com/twitter/algebird/Eventually.scala +++ b/algebird-core/src/main/scala/com/twitter/algebird/Eventually.scala @@ -23,11 +23,18 @@ import scala.collection.compat._ * type O and the eventual type E. In the case of Semigroup, we specify * - Two Semigroups eventualSemigroup and originalSemigroup * - A Semigroup homomorphism convert: O => E - * - A conditional mustConvert: O => Boolean Then we get a Semigroup[Either[E,O]], where: Left(x) + Left(y) - * = Left(x+y) Left(x) + Right(y) = Left(x+convert(y)) Right(x) + Left(y) = Left(convert(x)+y) Right(x) + - * Right(y) = Left(convert(x+y)) if mustConvert(x+y) Right(x+y) otherwise. EventuallyMonoid, EventuallyGroup, - * and EventuallyRing are defined analogously, with the contract that convert respect the appropriate - * structure. + * - A conditional mustConvert: O => Boolean + * + * Then we get a Semigroup[Either[E,O]], where: + * {{{ + * Left(x) + Left(y) = Left(x+y) + * Left(x) + Right(y) = Left(x+convert(y)) + * Right(x) + Left(y) = Left(convert(x)+y) + * Right(x) + Right(y) = Left(convert(x+y)) if mustConvert(x+y) Right(x+y) otherwise. + * }}} + * + * EventuallyMonoid, EventuallyGroup, and EventuallyRing are defined analogously, with the contract that + * convert respect the appropriate structure. * * @param E * eventual type diff --git a/algebird-core/src/main/scala/com/twitter/algebird/Fold.scala b/algebird-core/src/main/scala/com/twitter/algebird/Fold.scala index ed95d61f5..c2f21d145 100644 --- a/algebird-core/src/main/scala/com/twitter/algebird/Fold.scala +++ b/algebird-core/src/main/scala/com/twitter/algebird/Fold.scala @@ -238,7 +238,7 @@ object Fold extends CompatFold { /** * A Fold that does no work and returns a constant. Analogous to Function1 const: def const[A, B](b: B): (A - * => B) = { _ => b } + * \=> B) = { _ => b } */ def const[O](value: O): Fold[Any, O] = Fold.foldLeft(value) { case (u, _) => u } diff --git a/algebird-core/src/main/scala/com/twitter/algebird/ResetAlgebra.scala b/algebird-core/src/main/scala/com/twitter/algebird/ResetAlgebra.scala index 63273e575..72011760c 100644 --- a/algebird-core/src/main/scala/com/twitter/algebird/ResetAlgebra.scala +++ b/algebird-core/src/main/scala/com/twitter/algebird/ResetAlgebra.scala @@ -16,9 +16,13 @@ limitations under the License. package com.twitter.algebird /** - * Used to represent cases where we need to periodically reset a + b = a + b - * |a + b = |(a + b) a + |b = |b - * |a + |b = |b + * Used to represent cases where we need to periodically reset + * {{{ + * a + b = a + b + * |a + b = |(a + b) + * a + |b = |b + * |a + |b = |b + * }}} */ sealed trait ResetState[+A] { def get: A } case class SetValue[+A](override val get: A) extends ResetState[A] diff --git a/algebird-core/src/main/scala/com/twitter/algebird/Window.scala b/algebird-core/src/main/scala/com/twitter/algebird/Window.scala index 59db253ff..8df431d7e 100644 --- a/algebird-core/src/main/scala/com/twitter/algebird/Window.scala +++ b/algebird-core/src/main/scala/com/twitter/algebird/Window.scala @@ -31,7 +31,7 @@ import Operators._ * Example usage: * * case class W28[T](window: Window[T]) { def total = this.window.total def items = this.window.items def size - * = this.window.size } + * \= this.window.size } * * object W28 { val windowSize = 28 def apply[T](v: T): W28[T] = W28[T](Window(v)) *