GithubHelp home page GithubHelp logo

Comments (4)

hdgarrood avatar hdgarrood commented on August 28, 2024

I think something along these lines is unlikely to be merged in this library; we prefer to keep core libraries as lean and unopinionated as is reasonably possible. Are you imagining something that is more or less equivalent to newtype RefM s m a = RefM (StateT (Ref s) m a)? Because I don't think that needs to exist; why not just use StateT directly?

from purescript-refs.

rubenmoor avatar rubenmoor commented on August 28, 2024

Putting a reference into a local state (StateT (Ref s) m a or State (Ref s) a) doesn't make sense. What you mean is probably ReaderT (Ref s) m a or Reader (Ref s) a. That still would imply explicit use of write and read from Effect.Ref and does not allow anything close to the syntax above. Correct me if I'm wrong.

from purescript-refs.

hdgarrood avatar hdgarrood commented on August 28, 2024

Yes, you're right, I did mean Reader rather than State. But in any case I don't think this is something we will want to include in this library.

from purescript-refs.

rubenmoor avatar rubenmoor commented on August 28, 2024

My initial idea is complicated by the fact that a reference-based, global state monad, being effectful, cannot have an instance of the type-class MonadState, which is of course pure.

The only way out that I can see would be to re-implement an effectful variant of MonadState. This, in turn, implies a re-implementation of all related lenses. A huge copy-and-paste, might still be somewhat useful, but by no means elegant.

from purescript-refs.

Related Issues (9)

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.