Created
September 4, 2014 01:22
-
-
Save halohalospecial/ce73eb7a2a08b2ef9a37 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
module ElmHtmlTemplate where | |
import Window | |
import Graphics.Input (..) | |
import Graphics.Input as Input | |
import Html | |
import Html (..) | |
import Html.Events (..) | |
-------------------------------------------------------------------------------- | |
-- MODEL | |
type AppState = {} | |
-------------------------------------------------------------------------------- | |
initialAppState : AppState | |
initialAppState = {} | |
-------------------------------------------------------------------------------- | |
-- UPDATE | |
data Event | |
= NoOp | |
step : Event -> AppState -> AppState | |
step event appState = | |
case event of | |
_ -> appState | |
-------------------------------------------------------------------------------- | |
-- VIEW | |
appView : AppState -> (Int,Int) -> Element | |
appView appState (w,h) = | |
node "div" [] [] [ text "App" ] | |
|> Html.toElement w h | |
-------------------------------------------------------------------------------- | |
-- INPUTS | |
main : Signal Element | |
main = lift2 appView appState Window.dimensions | |
appState : Signal AppState | |
appState = foldp step initialAppState events | |
actions : Input Event | |
actions = Input.input NoOp | |
events : Signal Event | |
events = merges [ actions.signal | |
] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment