Comments (3)
I don't know why Elm and subsequently purescript-signal settled on this behaviour
It's the only behavior possible. A signal only has one value at any point in time. Signal a -> Signal a -> Signal a
can't return Signal (List a)
, so one value must be chosen. Conceptually, a Pux app has one signal of actions and signal values/actions only "occur" discretely one-at-a-time.
If you need an initial route, window dimension, and time, then you set those in your initialState
. There's no need for actions to control initial state. This could be documented better - I'll add it to the roadmap
from purescript-pux.
It's the only behavior possible. A signal only has one value at any point
in time.Signal a -> Signal a -> Signal a
can't returnList a
, so one
value must be chosen. Conceptually, a Pux app has one signal of actions
and actions only occur discretely one-at-a-time.
Sorry, if I wasn't clear on this. I'm not suggesting for merge
to return a List a
as that would be impossible, like you said. Rather, I would (naively?) expect merge
to behave similar to the merge
from RxJS which never discards a value but instead emits them one after the other.
It seems that some people in the Elm
community have been tripped up by this behaviour, too.
The fairMerge
function was written to address exactly this issue, though it has not been officially endorsed (yet?).
If you need an initial route, window dimension, and time, then you set
those in yourinitialState
. This could be documented better - I'll add
it to the roadmap
Cool, thanks.
from purescript-pux.
I just had a similar issue, I needed the current route to initialize the whole app.
I passed it manually from JS to the initialState as suggested by @alexmingoia :
var Main = require('../src/Main.purs');
var initialState = require('../src/Application.purs').init;
var debug = process.env.NODE_ENV === 'development'
var currentUrl = window.location.pathname + window.location.search
if (module.hot) {
var app = Main[debug ? 'debug' : 'main'](window.puxLastState || initialState(currentUrl))();
app.state.subscribe(function (state) {
window.puxLastState = state;
});
module.hot.accept();
} else {
Main[debug ? 'debug' : 'main'](initialState(currentUrl))();
}
from purescript-pux.
Related Issues (20)
- Combinator for adding incremented key attribute HOT 1
- defaultValue prop HOT 1
- Todomvc example doesn't work with React (instead of preact) HOT 1
- Single element children props is not an array with preact HOT 2
- Add react component as property to another react component (Material-UI) HOT 3
- onKey* events should use KeyboardEvent in handlers HOT 2
- Real world examples HOT 2
- Rendering large numbers of elements exceeds maximum call depth HOT 2
- Page refresh on a route results in 404 page not found HOT 1
- Pux.Router can't parse Facebook and Google login redirect query parameter HOT 1
- Permission to submit benchmark HOT 4
- Needs Aff 4.0 upgrade
- Event fires faster than state update
- Memoize doesn't appreciably improve performance HOT 3
- Is Pux still being mantained? HOT 1
- Plans to update for Purescript 0.12? HOT 5
- Release version 13 on pursuit HOT 5
- Starter app includes outdated bower, fails to build
- Starter app fails to build with error "Module Data.Comparison imports itself"
- Website is broken
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-pux.