Skip to content

Difficult to define Encoders/Decoders for custom types which 'match' a common type #294

Description

@ChrisPenner

Hello again; I'm working through more of the upgrade to the latest version, I think enforcing OID matching makes sense and I've run into errors from mismatches in previous versions, so I'm thankful to get errors.

In service of that, I've got to write Encoders/Decoders for the common citext type. Previously I was easily able to just use the text decoders/encoders and everything just worked; but with OID checks it now crashes at runtime.

I see the custom decoder functionality, which is nice, and I was able to wire it up by copying bits of the internals of the text encoder/decoders; but I was wondering about the viability of a combinator which would allow using one Value decoder with a different OID;

E.g. I'd love to have been able to use a variant of refine which takes a different type-name so I could:

citextDecoder = refineWithCustomType "citext" CaseInsensitive.mk

Or something like it :)

Also, if you'd be amenable to the addition of including citext encoders/decoders in the library itself that'd be helpful and I'd be happy to contribute a patch.

Cheers!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions