scala-library-next
scala-library-next copied to clipboard
backwards-binary-compatible Scala standard library additions
## About this PR 📦 Updates [org.scala-lang:scala-library](https://github.com/scala/scala) from `2.13.13` to `2.13.14` 📜 [GitHub Release Notes](https://github.com/scala/scala/releases/tag/v2.13.14) - [Version Diff](https://github.com/scala/scala/compare/v2.13.13...v2.13.14) ## Usage ✅ **Please merge!** I'll automatically update this PR to resolve...
## About this PR 📦 Updates [org.scalacheck:scalacheck](https://github.com/typelevel/scalacheck) from `1.17.1` to `1.18.0` 📜 [GitHub Release Notes](https://github.com/typelevel/scalacheck/releases/tag/v1.18.0) - [Version Diff](https://github.com/typelevel/scalacheck/compare/v1.17.1...v1.18.0) ## Usage ✅ **Please merge!** I'll automatically update this PR to resolve...
Strict version of `Map.filterKeys`
[Map.filterKeys](https://www.scala-lang.org/api/2.13.13/scala/collection/Map.html#filterKeys(p:K=%3EBoolean):scala.collection.MapView[K,V]) is deprecated as the moment. Its deprecation message says: > Use .view.filterKeys(f). A future version will include a strict version of this method (for now, .view.filterKeys(p).toMap). The suggested `.view.filterKeys(p).toMap`...
Add `option.diff`
Add `diff` to `Option` for a symmetry with `Seq`. Reference implementation: ```scala implicit class OptionValueOps[T](private val o: Option[T]) extends AnyVal { final def diff(that: Option[T]): Option[T] = { if (that.exists(o.contains))...
An obvious extension to `Option.when`. Reference implementation: ``` implicit class OptionOps(val o: Option.type) extends AnyVal { final def flatWhen[A](b: Boolean)(a: => Option[A]): Option[A] = if (b) a else None }...
Add randomElement
Hey, I propose the method `randomElement` to be added to `Iterable`. This method returns a random element from the collection. On `Iterable` it can be (probably naively) implemented with: ```scala...
`tailOption` and `initOption`
For symmetry. Once in a while I need them because the sequence might be empty. `Seq().tail` and `Seq().init` throw errors. Ideally I want those two to be corrected and return...
Add SeqSet
Add `SeqSet`, mirroring `SeqMap`.
Add `VectorSet` (to correspond with `VectorMap`)
afaict there isn't any reason why this is missing. (we have both `LIstSet` and `ListMap`)
Add mapWithState
The signature would be something like: ```scala def mapWithState[S, B](init: S)(f: (S, A) => (S, B)): Col[B] ``` Is not as common as `mapWithIndex` but is kind of handy and...