Skip to content

Instantly share code, notes, and snippets.

@yasuabe
Created Apr 18, 2019
Embed
What would you like to do?
squants exercise with pureconfig
package exercise.squants.with_pureconfig
import pureconfig.ConfigReader.Result
import squants.motion.Pressure
import pureconfig.module.squants._
import pureconfig.generic.auto._
import squants.Mass
import squants.thermal._
import squants.space._
case class EarthConfig(
meanRadius: Length, // 平均半径
volume: Volume, // 体積
mass: Mass, // 質量
atmosphericPressure: Pressure, // 大気圧
averageTemperature: Temperature // 平均気温
)
object Main {
def main(args: Array[String]): Unit = {
val config: Result[EarthConfig] = pureconfig.loadConfig[EarthConfig]
println(config.fold(_.toList.map(_.description).mkString("\n"), _.toString))
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment