Is it possible to get the underlying hlist representation out from circe
instead of the JSON? Essentially convert a case class to an HList
Note: I am aware that this can be achieved directly with shapeless, I would like to try circe's
macro based parser, as I ran into performance issues with shapeless.
Why do you think that there is any "underlying hlist representation out from circe
"?
What circe
does is parsing a String
into JSON, introducing type classes Decoder and Encoder
trait Encoder[A] extends Serializable { self =>
def apply(a: A): Json
//...
}
trait Decoder[A] extends Serializable { self =>
def apply(c: HCursor): Decoder.Result[A]
//...
}
and deriving these type classes using shapeless
. For example this means that if we have Decoder[H]
and Decoder[T]
then we have Decoder[H :: T]
. But there is no underlying circe
representation for a case class other than Json.
circe
doesn't convert a case class to an HList
, shapeless
does.