> On Oct 24, 2015, at 10:45 AM, Sean Clark Hess <sean...@gmail.com
> Hi bob. I have an outstanding pull request that addresses this for start app. It is unclear if it will end up merged or as a fork, but it works. For now you can paste StartApp.elm into your project and run with it if you like.
> Also feel free to chime in on the pull request if you would find it helpful!
Thanks for your response Sean. I had a look at your pull request and don’t have anything useful to say, other than the obvious: I’d be nice if it could be made to work.
However, I did manage to make things work for my specific case this morning.
First, I noticed that Signal.mergeMany drops all but the left-most simultaneous signal. So, after getting over my surprise, and a little ‘debugging’ with Debug.log (printf debugging will be with us forever :-) I re-arranged the signals in my mergeMany so the left-most was the window dimension signal. This almost worked, but update wasn’t called. Okay, so this is what Signal.Extra.foldp’ is for, and I called update with the initial window dimension signal. And it’s working well enough.
Turns out if you do it this way there’s (at least sometimes, certainly in Chrome with the console open) *two* window dimension signals at the start up, the second being slightly smaller and, just guessing here, looks to be accounting for window controls. This is a minor annoyance, because I get what amounts to a window resize just after initialising.
What I did here works but it’s hardly a general solution. If I had two or more things that had initial values I’d have to do something else. It seems to me I’d have to use one of the Signal.mapN functions to create a Signal of the combined values. Signal.Extra has some zip functions that combine signals into tuples (up to 4) and this is probably handy, but I think I’d prefer (but what do I know) a list of the actual simultaneous actions (all with the type Action (or whatever)). This way you’d have the changes rather than a snapshot. So you could write something like:
actions : Signal Action
(Signal.map WindowSize Window.dimensions)
, (Signal.map KeyStroke Keyboard.presses)
, (Signal.map MouseAt Mouse.position)
and get a list of Action as a result. Yeah, I know, and then what… probably have to have a Action of Actions which is manageable.