Boopickle encoders #1826
Boopickle encoders #1826
Conversation
I'd say this goes into the class of things we probably want to spin off at 1.x, but could find a home here while we finish evolving. |
* Create an `EntityDecoder` for `A` given a `Pickler[A]` | ||
*/ | ||
def booOf[F[_]: Sync, A: Pickler]: EntityDecoder[F, A] = | ||
EntityDecoder.decodeBy(MediaType.`application/octet-stream`)(booDecoderByteBuffer[F, A]) |
rossabaker
May 9, 2018
Member
This is going to be hard to use, like jsonOf
became hard to use in 0.18, isn't it?
This is going to be hard to use, like jsonOf
became hard to use in 0.18, isn't it?
cquiroz
May 9, 2018
Author
Member
I’m not sure what you mean, could you elaborate?
I’m not sure what you mean, could you elaborate?
rossabaker
May 9, 2018
Member
We used to be able to say req.as(jsonOf(Foo])
. But the extra evidence parameter made that something awful like req.as(jsonOf(implicitly, Decoder[Foo]))
. So we added decodeJson
syntax to Message
to make it req.decodeJson[Foo]
.
Isn't boo going to suffer the same?
We used to be able to say req.as(jsonOf(Foo])
. But the extra evidence parameter made that something awful like req.as(jsonOf(implicitly, Decoder[Foo]))
. So we added decodeJson
syntax to Message
to make it req.decodeJson[Foo]
.
Isn't boo going to suffer the same?
cquiroz
May 9, 2018
Author
Member
I see. I noted decodeJson
was on Message
but I assumed it was grandfathered. OTOH I don't think you want to keep adding decodeXXX
methods. Or perhaps they can be extension methods in the bundle?
I see. I noted decodeJson
was on Message
but I assumed it was grandfathered. OTOH I don't think you want to keep adding decodeXXX
methods. Or perhaps they can be extension methods in the bundle?
rossabaker
May 9, 2018
Member
I don't like decodeJson
. We just never figured out a better way, since we don't have multiple implicit lists.
I think if we did the same here, it would go in the bundle.
I don't like decodeJson
. We just never figured out a better way, since we don't have multiple implicit lists.
I think if we did the same here, it would go in the bundle.
} | ||
} | ||
|
||
checkAll("EntityCodec[IO, Json]", EntityCodecTests[IO, Fruit].entityCodec) |
rossabaker
May 9, 2018
Member
Label is wrong on this test
Label is wrong on this test
Http4sPlugin.boopickle | ||
) | ||
) | ||
.dependsOn(core, testing % "test->test", jawn % "compile;test->test") |
rossabaker
May 9, 2018
Member
Why does this module depend on jawn?
Why does this module depend on jawn?
New modules need to opt out of MiMa checking, because there isn't a prior version to check against. I think there is an example of this in the Netty PR. |
libraryDependencies ++= Seq( | ||
Http4sPlugin.boopickle | ||
), | ||
mimaPreviousArtifacts := Set.empty |
rossabaker
May 9, 2018
Member
Just remember to remove this after we release 0.18.11.
Just remember to remove this after we release 0.18.11.
We use boopickle on our application with the encoders in this PR. I thought this could be generally useful in http4s though I'm not sure how widely used
boopickle
is.This is also an opportunity, to receive any criticism you may have to my implementation. In particular I'm not sure if there is enough testing
I couldn't find an aggregate on
build.sbt
to include this into the overall build. Is it needed?