Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
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