Coder Social home page Coder Social logo

Comments (3)

fisx avatar fisx commented on July 23, 2024 1

yeah, not worth it. (-:

it might improve the library marginally, but i decided to not spend any more time on the idea.

thanks for the helpful feedback!

from string-conversions.

soenkehahn avatar soenkehahn commented on July 23, 2024

Hi. :)

I'm not 100% sure but I think this wouldn't work well in practice, because of how instances are imported (or scoped) in Haskell. So if any of your transitive dependencies imports the Unsafe module, you'll get all the unsafe instances without importing them yourself. I think.

There could be a separate type-class for safe conversions though.

Apart from that I think that I would prefer to keep the existing behavior of Data.String.Conversions. I'm not completely against adding a Data.String.Conversions.Safe module that only exposes safe conversions however.

To be honest, I'm not fully convinced yet that this change is worthwhile though. Do you have a concrete example of a project where you do have ByteStrings that you are tempted to convert to either String or Text using cs, but where you would opt for a safer api? Or some other concrete example that motivates this change from your perspective?

from string-conversions.

fisx avatar fisx commented on July 23, 2024

No concrete use case, I just think that if there can be an error, that should be obvious from the types. If you want to make a case for using a library in security-sensitive code, it's nice if you don't have to admit that it sometimes it eats bytes from your strings when you clearly don't want it to.

You are right though, my idea was wrong. I like the extra type class. I'll think about it some more.

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.