Skip to content

Add KeyEncoder and KeyDecoder instances for newtypes to support Map keys in circe#476

Open
loathwine wants to merge 1 commit into
kitlangton:mainfrom
loathwine:circe-key-codec
Open

Add KeyEncoder and KeyDecoder instances for newtypes to support Map keys in circe#476
loathwine wants to merge 1 commit into
kitlangton:mainfrom
loathwine:circe-key-codec

Conversation

@loathwine

Copy link
Copy Markdown
type UserId = UserId.Type
object UserId extends Newtype[String]

import neotype.interop.circe.given

// Before: compilation error
// After: derived automatically
Map(UserId("alice") -> 1).asJson  // {"alice":1}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant