I'm starting to use more and more of this library. In particular, newtypes are quite useful for defining custom typeclass instances:
@newtype case class FirstOf[A](value: A)
object FirstOf {
implicit def semigroup[A]: Semigroup[A] = Semigroup.instance((a, _) => a)
}
It would be really nice if for these cases unapply would also be generated. This comes in handy in chains involving foldMap, e.g.
list
.foldMap(person => Map(person.name -> FirstOf(person.age))
.map { case (name, FirstOf(age)) => ??? } // no need to use `.value` manually
I'm starting to use more and more of this library. In particular, newtypes are quite useful for defining custom typeclass instances:
It would be really nice if for these cases
unapplywould also be generated. This comes in handy in chains involving foldMap, e.g.