@@ -120,20 +120,18 @@ initially. -}
120dropIf : (a -> Bool) -> a -> Signal a -> Signal a
120dropIf : (a -> Bool) -> a -> Signal a -> Signal a
121dropIf = Native.Signal.dropIf
121dropIf = Native.Signal.dropIf
123−{-| Keep events only when the first signal is true. When the first signal
123+{-| Keep events only when the first signal is true. Elm does not allow undefined
124−becomes true, the most recent value of the second signal will be propagated.
125−Until the first signal becomes false again, all events will be propagated. Elm
126−does not allow undefined signals, so a base case must be provided in case the
124+signals, so a base case must be provided in case the first signal is not true
127−first signal is not true initially. -}
125+initially.
128keepWhen : Signal Bool -> a -> Signal a -> Signal a
127keepWhen : Signal Bool -> a -> Signal a -> Signal a
129keepWhen bs def sig =
128keepWhen bs def sig =
130 snd <~ (keepIf fst (False, def) ((,) <~ (sampleOn sig bs) ~ sig))
129 snd <~ (keepIf fst (False, def) ((,) <~ (sampleOn sig bs) ~ sig))
132−{-| Drop events when the first signal is true. When the first signal becomes
131+{-| Drop events when the first signal is true. Elm does not allow undefined
133−false, the most recent value of the second signal will be propagated. Until the
134−first signal becomes true again, all events will be propagated. Elm does not
135−allow undefined signals, s oa base case must be provided in case the first
132+signals, so a base case must be provided in case the first signal is true
136−signal is true initially. -}
133+initially.
137dropWhen : Signal Bool -> a -> Signal a -> Signal a
135dropWhen : Signal Bool -> a -> Signal a -> Signal a
138dropWhen bs = keepWhen (not <~ bs)
136dropWhen bs = keepWhen (not <~ bs)