Coder Social home page Coder Social logo

Comments (6)

bergmark avatar bergmark commented on July 4, 2024

Whoops hit submit to early, but updated it now.

from string-conversions.

soenkehahn avatar soenkehahn commented on July 4, 2024

That's an idea.

So the from...-versions would be monomorphic only in their input and the to... versions in their output?

We also have type synonyms (LT, SBS, etc.) defined in the package. Would we also provide toLT, fromSBS, etc.?

I wonder if cluttering the namespace is something we should be worried about. What do you think about putting it in a separate module? E.g. Data.String.Conversions.Monomorphic? Then the new functions would be opt-in, but also less discoverable. On the other hand I don't expect many name clashes, since the functions with Strict or Lazy in their names is a string-conversions convention that I haven't seen much elsewhere.

When do we have to write cs . cs? Isn't ConvertibleStrings transitive? (I mean manually implemented to be transitive.)

from string-conversions.

bergmark avatar bergmark commented on July 4, 2024

So the from...-versions would be monomorphic only in their input and the to... versions in their output?

Correct

We also have type synonyms (LT, SBS, etc.) defined in the package. Would we also provide toLT, fromSBS, etc.?

I personally prefer the expanded names and always use them, but it makes sense to include these aliases since the short names exist elsewhere.

I wonder if cluttering the namespace is something we should be worried about.

Like you say, I don't expect clashes either. But these functions will also be used far less frequently assuming you use cs as much as possible. I don't have a preference here.

When do we have to write cs . cs?

If you have two unrelated stringy types you may not have defined the conversions between them because there is no natural place for it. I sometimes have e.g. ConvertibleStrings A StrictText and ConvertibleStrings StrictText B and then I need to use cs . (id :: B -> StrictText) . cs which would then be cs . toStrictText or fromStrictText . cs instead.

from string-conversions.

soenkehahn avatar soenkehahn commented on July 4, 2024

Regarding the last question: Ah, I didn't consider writing your own instances of ConvertibleStrings. I guess if we aim at making this class extensible we could come up with a better design overall. But that's a different story.

I would propose to put the new functions into a different module for now. We can move them to the main module later if we realize that would be better. (My suggestion was Data.String.Conversions.Monomorphic but feel free to come up with something better.)

If you come up with a PR that would be great.

The PVP would allow to get away with a minor version bump (i.e. 0.3.1) but I think I would prefer 0.4 if you don't mind.

And to finally answer your initial question: Yes, I think it's a good idea. :) It's a fairly seldom use-case but I think I'd end up using these functions.

from string-conversions.

soenkehahn avatar soenkehahn commented on July 4, 2024

Merged and released to hackage: http://hackage.haskell.org/package/string-conversions-0.4

Thanks very much.

from string-conversions.

bergmark avatar bergmark commented on July 4, 2024

Cheers!

from string-conversions.

Related Issues (11)

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.