--
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.
elm-d3 has a concept of Streams, described here which have no default value and otherwise are the same. Not sure if that's what your looking for, but it seems relevant.
I don't think there is such a conceptual difference between sig and psig. It's just that foldp is weird.
I don't want to encourage violence towards deceased equines, but I'd like the discussion around the behaviour of foldp to be rekindled.
In my memory it hasn't been discussed to death at all. There used to be a foldp' like is now in my package in core, back in Elm 0.7 or something. When that function suddenly got removed, there was a discussion about the usefulness of the function. That's the first time I saw a proposal of a function like the one you now call foldl. But AFAIK that was the only serious discussion about it and didn't actually result in any action being taken.
My take on this is that changing the behaviour of foldp is a breaking change and those are best done ASAP. And I'd like foldp to change in behaviour so it doesn't ignore the initial value of the input. I don't think it will be problematic for most use cases and the ignoring of initial input is a stumbling block for beginners. Evidence that it's confusing for beginners can be found on the mailing list (and on IRC, if there were logs).
Just add the other foldp to signals extra. No big deal.
--
Just add the other foldp to signals extra. No big deal.
Mouse.clicks : Signal (Maybe ())
Mouse.clicks : Signal ()
type Response a = Success a| Waiting| Failure Int String| Unsent <-- with an added initial state
foldp (\c -> c + 1) Mouse.clicks
foldl (\mc -> withDefault 0 mc + 1) Mouse.clicks
withInit 0 (foldl (\c -> c + 1)) Mouse.clicks
foldl (\_ mc -> Maybe.withDefault -1 mc + 1) 0 Mouse.clicks
accum : (a -> a) -> a -> Signal (Maybe ()) -> Signal a
accum (\c -> c + 1) 0 Mouse.clicks