by Evan Czaplicki and Steven Chong
content = flow down [ plainText "Welcome to Elm!"
, image 150 50 "flower.jpg"
, asText (reverse [1..9]) ]
main = container 180 100 middle content
flow : Direction -> [Element] -> Element
container : TODO
i = 0
function increment () {
return ++i
}
increment() // 1
increment() // 2
function increment (i) {
return i + 1
}
increment(0) // 1
increment(1) // 2
impure:
pure:
main = lift asText Mouse.position
Mouse.position : Signal (Int,Int)
lift : (a -> b) -> Signal a -> Signal b
asText : a -> Element
noChange v
(inputField, tags) = Input.text "Enter a tag"
getImage tags =
lift (fittedImage 300 200)
(syncGet (lift requestTag tags))
scene input pos img =
flow down [ input, asText pos, img ]
main = lift3 scene inputField
Mouse.position
(async (getImage tags))
→ Elm simplifies the complicated task of creating responsive and usable graphical user interfaces