scala.meta.contrib.Replace.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scalameta_native0.5_2.13 Show documentation
Show all versions of scalameta_native0.5_2.13 Show documentation
Scalameta umbrella module that includes all public APIs
The newest version!
package scala.meta.contrib
/**
* The purpose of this typeclass is to replace one list of things with another of that type.
*
* eg. replacing the statements of a Defn.Class with a new set of statements
*
* @tparam A
* the object you are replacing the items in
* @tparam B
* the type of items you are replacing
*/
trait Replace[A, B] {
def replace(a: A, bs: List[B]): A
}
object Replace {
def apply[A, B](f: (A, List[B]) => A): Replace[A, B] = new Replace[A, B] {
@inline
override def replace(a: A, bs: List[B]): A = f(a, bs)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy