Coder Social home page Coder Social logo

Comments (7)

dag avatar dag commented on June 8, 2024

Note that you can write

addEntry :: String -> Update Foo ()
addEntry s = bar %= insert s 0

from acid-state.

fhaust avatar fhaust commented on June 8, 2024

I know, but given that the State type is probably quite complex a Zoomed instance might be useful.

from acid-state.

dag avatar dag commented on June 8, 2024

How about

addEntry :: String -> Update Foo ()
addEntry s = state $ runState $ zoom bar $ modify $ insert s 0

I agree it would be nice if it could work with zoom directly, but anyway.

from acid-state.

fhaust avatar fhaust commented on June 8, 2024

Also true ... but hey ... so much words :)

from acid-state.

stepcut avatar stepcut commented on June 8, 2024

I don't see a way to provide a Zoomed instance with out depending on lens -- and depending on lens is a pretty big dependency for something most people will not actually use. If we can make an acid-state-lens package, that seems better. Apparently that might involve exporting some internals from acid-state?

from acid-state.

adamgundry avatar adamgundry commented on June 8, 2024

Since f6bd2c6 exposes the definition of Update, it should be possible to write an orphan Zoomed instance downstream. Given that we don't want acid-state to depend on lens, I don't think there is anything else we can do. If someone wants to make an acid-state-lens package, feel free (though there is a bigger reorganisation pending, see #99).

from acid-state.

fhaust avatar fhaust commented on June 8, 2024

Oh ... it's been a while :-)

I think you can write lens instances without depending on the lens package, but honestly I don't care anymore.

from acid-state.

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.