amnaredo / test

0 stars 0 forks source link

Why no Js.Bool #220

Open amnaredo opened 2 years ago

amnaredo commented 2 years ago

Hi, thanks for the library. It's exactly what I was searching for. One question, though: Why is there no Js.Bool? Just a simple base class for Js.True and Js.False. It doesn't even need an implementation. Just apply and unapply... Example (not tested or anything):

sealed abstract class Bool extends Value {
  def value: Boolean
}
object Bool {
  def apply(value: Boolean): Bool = if (value) True else False
  def unapply(bool: Bool): Option[Boolean] = bool.value
}
case object False extends Value{
  def value = false
}
case object True extends Value{
  def value = true
}

Would have made some things more convenient for me 😄 ID: 218 Original Author: SrTobi

amnaredo commented 2 years ago

Feel free to send a PR then! Original Author: lihaoyi