doobie
doobie copied to clipboard
Misleading import paths for Json/Jsonb stuff in doobie-postgres-circe module
The current imports are:
import doobie.postgres.circe.json.implicits.* // for Json
import doobie.postgres.circe.jsonb.implicits.* // for Jsonb
In fact, the only implicits they bring in are Get[Json] and Put[Json] instances.
However, those paths seem the only way to import instance constructors: pgEncoderPut* and pgDecoderGet* which are not implicit and have to be called explicitly in order to create instances for specific types.
Importing ..implicits.* in order to access non-implicit stuff is really misleading and can be confusing.
Perhaps it makes sense to deprecate .implicits and provide alternative import path .instances, i.e.:
import doobie.postgres.circe.json.instances.* // for Json
import doobie.postgres.circe.jsonb.instances.* // for Jsonb
By convention, instances imply "typeclass instances" and are usually implicits as well, but providing non-implicit instance constructors along with instances themselves should be fine.