Hello folks, I'm looking for feedback on the usage...
# arrow
r
Hello folks, I'm looking for feedback on the usage of the
Show
Typeclass? Is this correct?
Copy code
data class Temperature(
  val value: Double
)

val celsiusShow = Show<Temperature> {
  val celsius = value - 273.15
  return@Show celsius.to2DecimalPlaces()
}

val fahrenheitShow = Show<Temperature> {
  val fahrenheit = (value - 273.15) * 9.0 / 5.0 + 32
  return@Show fahrenheit.to2DecimalPlaces()
}

// usage
temperatureTextView.text = celsiusShow.run { zeroKelvin.show() }