Common utility libraries for Scala, mostly small stuff I don't want to have multiple copies of lying around.
libraryDependencies += Seq( "com.github.morgen-peschke" % "commons-core" % "0.1.0", "com.github.morgen-peschke" % "commons-collections" % "0.1.0", "com.github.morgen-peschke" % "commons-decline" % "0.1.0", "com.github.morgen-peschke" % "commons-scalacheck" % "0.1.0" % Test ) def ivyDeps = Agg( ivy"com.github.morgen-peschke::commons-core:0.1.0", ivy"com.github.morgen-peschke::commons-collections:0.1.0", ivy"com.github.morgen-peschke::commons-decline:0.1.0", ivy"com.github.morgen-peschke::commons-scalacheck:0.1.0" ) This is a home for the most generic of utilities.
A placeholder indicating completion, which provides a work-around for the type issues which can arise when returning things like Future[Unit].
This is very similar to akka.Done, and exists as a lightweight alternative to the same.
A pure Scala, lightweight implementation of python's slice syntax (e.g [start:stop:step]).
Helpers and extensions for working with the Scala standard library.
An alternative to IterableOnce#takeWhile, which is primarily differentiated on two points:
- The elements are consumed until the predicate is true, rather than while the predicate is true, so the logic is reversed.
- The final element is also taken.
A collection of utilities and syntax to make working with Scalacheck Gen smoother.
Highlights include:
-
(0 to 10).chooseas a more flexible alternative toGen.chooseNum(0, 10)This is particularly handy because(a until b by c).chooseis equivalent to something closer to this:Gen.chooseNum(0, (b-a) - 1).map(l => a + (c * l))
-
RangeGens.ranges(min, max)generatesRanges within those bounds -
NumericRangeGens.numericRanges(min, max)generatesNumericRanges within those bounds -
(g: Gen[A]).as.list(a to b)as an alternative toGen.chooseNum(a, b).flatMap(Gen.listOfN(g, foo))Variants also exist to produce
Vector,Chain, and theNonEmpty*equivalents, as well as one to lift aGen[Char]into aGen[String] -
(g: Gen[A]).optionalas a chaining alternative toGen.option(g)
Instances for Decline, notably one for Slice as it tends to be very handy for CLI utilities.