From 7713048d6e00b77cf583ff8b7f064cb98a143aa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?St=C3=A9phane=20Payrard?= Date: Sat, 23 Jan 2016 14:58:34 +0100 Subject: [PATCH] c --- t.elm | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 t.elm diff --git a/t.elm b/t.elm new file mode 100644 index 000000000..217f095d6 --- /dev/null +++ b/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 + ] \ No newline at end of file