main : Varying Htmlmain =Varying.map view(Varying.fromStream (Err Http.Timeout) results)
I'd refactor this using foldp. I know this is a toy app, but it doesn't really make sense that your initial state is a timeout.
type Model = Loading | ReadyWith HttpResult
Start with an initial loading page state and have it flip to a populated when your results come in.
--
You received this message because you are subscribed to the Google Groups "Elm Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
I find Signal clearer than Varying. It may be because I have some minor background in signal processing, but mostly because I find Varying to be very vague.
To explain my point: Varying doesn’t seem to be a proper noun in itself, since it is just derived from vary and not the root word itself (don’t nail me on linguistics :D). Granted, we are beginning to talk about Mappables and Appendables as abstractions, but Varying Html doesn’t quite fit imo: Im reading Varying as an adjective rather than as a noun.
On another note: Varying has a meaning in the graphics scene, it even was a keyword in early versions of GLSL for interpolated fragment shader input data. They ditched it for consistent in and out keywords though. This may be important for later interaction with WebGL (programmers).
When using varying as a term, we don’t say anything about what the value varies relative to (as should be evident by the GLSL example). Signal does a fine job here: It doesn’t actually say that it is varying over time, but it has a real-world analogy that immediately suggest change over time (actually this doesn't hold for image signals as I just realize), plus always having a value to sample from. If this is not immediately clear to newcomers, then we could always tell them to regard signals as a value varying over time, so that we can focus on one discrete time-step a time.
Of course, Signal isn’t bullet proof either: It suggests continuity (as in audio signal) where in reality we model discrete signals. Also, I may be biased because we stuck to it for so long.
I’m not saying that we should stick to Signal, just that I’d like to ditch Varying.
To explain my point:
Varyingdoesn’t seem to be a proper noun in itself, since it is just derived from vary and not the root word itself (don’t nail me on linguistics :D). Granted, we are beginning to talk aboutMappables andAppendables as abstractions, butVarying Htmldoesn’t quite fit imo: Im readingVaryingas an adjective rather than as a noun.
On another note: Varying has a meaning in the graphics scene, it even was a keyword in early versions of GLSL for interpolated fragment shader input data. They ditched it for consistent
inandoutkeywords though. This may be important for later interaction with WebGL (programmers).
Of course,
Signalisn’t bullet proof either: It suggests continuity (as in audio signal) where in reality we model discrete signals. Also, I may be biased because we stuck to it for so long.
I’m not saying that we should stick to
Signal, just that I’d like to ditchVarying.
On Monday, 16 March 2015 23:34:46 UTC+1, Richard Feldman wrote:Looking over Hassan's sweet Reddit example, with Task, Stream, and input, I noticed that the term Varying is sort of sticking out as troublesome now that the terminology bar has been raised by the others. :)When I got to the end I looked at this and found it was significantly harder to follow than the code before it:main : Varying Htmlmain =Varying.map view(Varying.fromStream (Err Http.Timeout) results)In particular Varying.fromStream seems confusing: why do I need to combine a Stream with a constant value to get a Varying? Surely the Stream already varied before I did that, and why am I adding a constant value in order to get something that "varies" more than what I had before? "Varying Html" looks kinda cool as a type annotation for main, but the metaphor seems to break down very soon afterward in practice.I'm hardly in love with this as an alternative, but I do think it's clearer:
main : InitializedStream Htmlmain =InitializedStream.map view(InitializedStream.fromStream (Err Http.Timeout) results)It's definitely more verbose than I'd like, but I can read that code and immediately understand how InitializedStream and Stream relate to one another. I think Varying is proving problematic for me because this relationship is obscured.Anyone else feel this way about Varying?
--
It seems like our options are Signal, Stream/Varying, or Events/Signal and no one agrees about what is the best combination. To be conservative, we could stick with Signal in 0.15 and then slowly migrate over to different names. I think that's the safe route, but I also think it's a little too cautious.
--
EventStream
PropertyVarying Html
Property Html
Dynamic Html