Skip to content

Commit

Permalink
c
Browse files Browse the repository at this point in the history
  • Loading branch information
cognominal committed Jan 23, 2016
1 parent 21525aa commit 7713048
Showing 1 changed file with 34 additions and 0 deletions.
34 changes: 34 additions & 0 deletions t.elm
@@ -0,0 +1,34 @@
-- Click on the righthand screen and start pressing keys!

import Char
import Graphics.Element exposing (..)
import Keyboard
import Signal exposing (..)
import String

-- foldr : (Char -> b -> b) -> b -> String -> b
-- foldp : (a -> state -> state) -> state -> Signal a -> Signal state
-- foldp (\click total -> total + 1) 0 Mouse.clicks
-- map : (a -> result) -> Signal a -> Signal result





main : Signal Element
main = Signal.map display state


state: Signal String
state = foldp String.cons "" chars

chars: Signal String
chars = map (\keycode -> toString <| Char.fromCode keycode ) Keyboard.presses


display : String -> Element
display str =
flow right
[ show "The current state is : "
, show str
]

0 comments on commit 7713048

Please sign in to comment.