Skip to content

Instantly share code, notes, and snippets.

@robotlolita
Created February 11, 2014 00:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save robotlolita/8927309 to your computer and use it in GitHub Desktop.
Save robotlolita/8927309 to your computer and use it in GitHub Desktop.
Shows different text than what was pressed
import Char
import Keyboard
import String
toString char = String.cons (Char.fromCode char) ""
typed text = plainText "You typed: " `beside` asText text
transformed text = plainText "I'll show you: " `beside` (asText . String.reverse <| text)
display text = flow down <| [ (typed text), (transformed text) ]
stringTogether char oldText = oldText ++ toString char
main = display <~ foldp stringTogether "" Keyboard.lastPressed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment