eed3si9n / sjson-new

a typeclass based JSON codec that's backend independent
Apache License 2.0
36 stars 19 forks source link

Move map and contramap to AdditionalFormats #58

Closed eed3si9n closed 7 years ago

eed3si9n commented 7 years ago

Ref #49, #50, #51

/cc @xuwei-k

dwijnand commented 7 years ago

I find Yoshida-san's encoding better (more obvious, more convenient, ..) Any particular reason you're avoiding it?

eed3si9n commented 7 years ago

I think it's inconsistent with existing project function. Plus it's a bit too subtle for me that map on JF will return only the reader. Doesn't that violate the left identity law? This is because JF inherits JsonReader.

dwijnand commented 7 years ago

With regards to the project function, maybe we should do something about it: https://github.com/eed3si9n/sjson-new/issues/41.

Given Argonaut does it exactly this way, I guess it's not unlawful? It's an interesting question, though.

http://argonaut.io/scaladocs/index.html#argonaut.CodecJson@map[B]((A)⇒B):DecodeJson[B]