GithubHelp home page GithubHelp logo

pick function about purescript-record HOT 6 OPEN

purescript avatar purescript commented on August 27, 2024
pick function

from purescript-record.

Comments (6)

MonoidMusician avatar MonoidMusician commented on August 27, 2024 1

This looks useful to me!

Regarding your implementation, it would probably be best to implement it in FFI for performance reasons (as unsafePick or something in the Unsafe module).

Oops, commented too early.

But I would also suggest using RProxy r instead of Proxy (Record r), just because you aren't doing anything with the information that it's a record inside the proxy ...

Otherwise it looks good to me, nice suggestion!

from purescript-record.

MonoidMusician avatar MonoidMusician commented on August 27, 2024 1

Confession: I was originally going to suggest using something like insert/delete, then I realized that wouldn't be any better, hence FFI. My other bad idea was to implement delete in terms of pick 😁 But your PR looks good to me!

from purescript-record.

paf31 avatar paf31 commented on August 27, 2024

It would need to use the FFI anyway, since I don't really want to add a maps dependency here.

What are the use cases for this?

from purescript-record.

coot avatar coot commented on August 27, 2024

In Redux when you connect a component to a state, and you want to match what you need as tight as possible (which is an optimisation).

Another case how I am using it is when using css-modules and importing css into purescritp through ffi:

foregin import css :: { header :: String, section :: String, footer :: String }

But then a component might just require a section of those css classes.

Sure ffi is the way to go, it's just not accessible in try.purescript :)

from purescript-record.

coot avatar coot commented on August 27, 2024

I guess the right place for the class SubRow is in Type.Row. I'll submit a PR there too.

from purescript-record.

coot avatar coot commented on August 27, 2024

The only dependency that this will introduce is for Data.Array, I hope it's fine. It just requires cons (the new DCE that I am working on is able to cut everything out except the required function :) )

from purescript-record.

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.