Having this example,
import io.circe.generic.auto._
import io.circe.shapes._
import io.circe.parser._
import io.circe.syntax._
import shapeless._
case class A[T <: HList](name: String, params: T)
when I instance this case class with a non-empty HList, there is no problem:
scala> A("name", "a" :: HNil).asJson
res1: io.circe.Json =
{
"name" : "name",
"params" : [
"a"
]
}
But, when this HList is only HNil, I get the follow error:
scala> A("name", HNil).asJson
<console>:29: error: could not find implicit value for parameter encoder: io.circe.Encoder[A[shapeless.HNil.type]]
A("name", HNil).asJson
^
I've read this question where they talk about case object encoder, but it doesn't work with HNil (HNil is case object) and I've seen anything about it in the documentation. FYI, I'm using circe 0.6.1
Any idea?