scala.meta.contrib.Extract.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 motivation for this typeclass is to extract values out of trees that could have been fields
* on the classes. However, these values are not included as fields on the tree nodes because of
* various reasons.
*/
trait Extract[A, B] {
def extract(a: A): List[B]
}
object Extract {
def apply[A, B](f: A => List[B]): Extract[A, B] = new Extract[A, B] {
@inline
override def extract(a: A): List[B] = f(a)
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy