Skip to content

Misleading import paths for Json/Jsonb stuff in doobie-postgres-circe module #2235

@satorg

Description

@satorg

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions