generic-derivation Questions
1
Solved
given:
sealed trait Data
final case class Foo() extends Data
final case class Bar() extends Data
final case class TimestampedData[A <: Data](data: A, timestamp: Long)
Is there a succint way to...
Vitiated asked 14/11, 2022 at 10:27
2
Solved
Is there a clean way to access the default values of a case class fields when performing type class derivation in Scala 3 using Mirrors? For example:
case class Foo(s: String = "bar", i: ...
Law asked 17/7, 2021 at 13:42
1
Solved
I want to define equality for some type that can be part of other objects or collections using cats/kitten. I don't want to have to define the equality for every other class.
For example:
import ca...
Fitz asked 16/10, 2021 at 0:2
2
Solved
Suppose I've got an ADT like this:
sealed trait Event
case class Foo(i: Int) extends Event
case class Bar(s: String) extends Event
case class Baz(c: Char) extends Event
case class Qux(values: Lis...
Greggrega asked 10/2, 2017 at 17:38
1
Solved
Suppose I've been working with some JSON like this:
{ "id": 123, "name": "aubergine" }
By decoding it into a Scala case class like this:
case class Item(id: Long, name: String)
This works jus...
Bricole asked 29/8, 2019 at 10:31
1
Solved
Suppose I have a ADT in Scala:
sealed trait Base
case class Foo(i: Int) extends Base
case class Baz(x: String) extends Base
I want to encode values of this type into the JSON that looks like th...
Clinton asked 17/10, 2018 at 13:47
1
Solved
I'm paraphrasing a question from the circe Gitter channel here.
Suppose I've got a Scala sealed trait hierarchy (or ADT) like this:
sealed trait Item
case class Cake(flavor: String, height: Int) ...
Whitethroat asked 31/8, 2018 at 14:5
1
© 2022 - 2024 — McMap. All rights reserved.