Giter Club home page Giter Club logo

Comments (5)

gusty avatar gusty commented on May 30, 2024

I think a good solution should be to duplicate all those functions for both modules / types.

This means in your example you should be able to do directly ConcreteCodec.compose.

Maybe we should come up with a better / shorter alias for ConcreteCodec, specially considering we'll be encouraging it use over the pair of functions.

from fleece.

Choc13 avatar Choc13 commented on May 30, 2024

Yes I think renaming ConcreteCodec might a good idea. It seems to me that ConcreteCodec is actually a codec specifically for a JObject only, whereas the more general Codec type works for any JValue which might include JObject. Is that correct?

If so then how about naming it ObjectCodec?

from fleece.

gusty avatar gusty commented on May 30, 2024

... whereas the more general Codec type works for any JValue which might include JObject. Is that correct?

No, actually they are both very generic, the main difference being that ConcreteCodec is a type with associated operations, whereas the tupled functions are just tupled functions so they don't carry codec operations nor intention.

from fleece.

Choc13 avatar Choc13 commented on May 30, 2024

Hmm ok, I think my confusion came about when working with them and trying to convert between concrete and pair of functions using Codec.ofConcrete and Codec.toConcrete. As it seems like it's possible to take JsonObjCodec and call Codec.ofConcrete on it which gives you back a pair of functions between IReadOnlyDictionary and JsonValue, but it wasn't possible to say write JsonCodec.string |> Codec.toConcrete.

Also when I was trying to write jfromWith (as shown in #103) it only made sense to define this on JsonObjCodec as it doesn't make sense to "lift" a simple value into a JSON object, because it would need to be nested under some key.

from fleece.

gusty avatar gusty commented on May 30, 2024

Yes, we need to provide codecs like JsonCodec.string as ConcreteCodec as well, possibly under a different module.

I'll think what's the best way to accomplish this.

from fleece.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.