Skip to content

Feature request: Add more methods to Format. like circe Codec.iemap #1289

@xuwei-k

Description

@xuwei-k

Play JSON Version (2.5.x / etc)

all

API (Scala / Java / Neither / Both)

scala

Operating System (Ubuntu 15.10 / MacOS 10.10 / Windows 10)

all

JDK (Oracle 1.8.0_72, OpenJDK 1.8.x, Azul Zing)

all

Expected Behavior

Format has bimap method. But I think we should add more methods. e.g.

 def bimapJsResult[B](readsMap: A => JsResult[B], writesContramap: B => A): Format[B] =

def bimap[B](readsMap: A => B, writesContramap: B => A): Format[B] =
Format[B](map(readsMap), contramap(writesContramap).writes(_))

https://github.com/circe/circe/blob/f7380ca5516bb80e2a0a8da85e2d30fad6a344f1/modules/core/shared/src/main/scala/io/circe/Codec.scala#L35-L51

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