Created
April 18, 2019 13:33
-
-
Save yasuabe/f63b4306e231157855132465f7115107 to your computer and use it in GitHub Desktop.
squants exercise with pureconfig
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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