Skip to content

Instantly share code, notes, and snippets.

View bartbuijse's full-sized avatar

Bart Buijse bartbuijse

View GitHub Profile
object Playground extends App {
import squants._
import squants.energy._
def parse(s: String, i: Int): Option[Quantity[_]] =
Seq(Energy, EnergyDensity, Power)
.foldLeft(Option.empty[Quantity[_]]) {
case (None, dimension) => dimension.parseTuple((i,s)).toOption
case (quantity@Some(_), _) => quantity