Comments (4)
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.
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.
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.
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)
- Operators for writeRef and modifyRef
- Expose EffectFn variants HOT 1
- Use same argument order as AVars for write, modify, etc. HOT 1
- Should we explain why `new` is effectful in the docs? HOT 3
- Expand newWithSelf documentation HOT 1
- Eq instance? HOT 9
- Is `newRef` actually effectful? HOT 2
- Return value from writeRef and modifyRef HOT 12
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from purescript-refs.