Last active
December 21, 2015 19:18
-
-
Save ytaras/6352927 to your computer and use it in GitHub Desktop.
React on user input only after some amount of time
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Graphics.Input as Input | |
(hashTagField, rawHashTag) = Input.field "Type your hash tag" | |
main = fields | |
fields = above <~ hashTagField ~ (asText <~ hashTag) | |
hashTag : Signal String | |
hashTag = delayed (2*second) [] rawHashTag | |
delayed : Time -> a -> Signal a -> Signal a | |
delayed time def signal = | |
let | |
stable = not <~ time `since` signal | |
tagged = (,) <~ signal ~ stable | |
filtered = fst <~ keepIf snd (def, False) tagged | |
in filtered | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment