on master help sign in
Merge branch 'dev' of https://github.com/evancz/Elm into dev
commitd7ab7282eed149246198323ca46dc867438b4bb4 authorevancz <info@elm-lang.org> dateSat 9 Mar 2013, 19:12 (14 years ago) parent851d2ffcf173a9
5 files changed+29−29
Examples/elm-yesod/Main.hs+2−2 Examples/elm-yesod/elm_source/clock.elm+2−4 Examples/elm-yesod/elm_source/index.elm+12−12 Examples/elm-yesod/elm_source/mouse.elm+6−8 README.md+7−3
Examples/elm-yesod/Main.hs+2−2
@@ -38,7 +38,7 @@ mkYesod "ElmTest" [parseRoutes|
3838-- so that toWidget can work with QuasiQuoted elm code. All URL interpolation
3939-- is done automatically. (e.g. lines 28-30 in elm_source/index.elm)
4040getMouseR :: Handler RepHtml
41−getMouseR =
41+getMouseR =
4242 defaultLayout $ do
4343 setTitle "Mouse position demo"
4444 toWidget mousePage
@@ -75,7 +75,7 @@ instance Yesod ElmTest where
7575 hamletToRepHtml $(hamletFile "templates/default-layout-wrapper.hamlet")
7676
7777instance YesodElm ElmTest where
78− urlElmJs _ = Right $ "https://raw.github.com/evancz/Elm/master/elm/elm-runtime-0.3.5.js"
78+ urlElmJs _ = Right $ "https://raw.github.com/evancz/Elm/master/elm/elm-runtime-0.7.2.js"
7979
8080main :: IO ()
8181main = warpDebug 3000 ElmTest
Examples/elm-yesod/elm_source/clock.elm+2−4
@@ -1,8 +1,6 @@
11
2−import Signal.Time (every)
3−
42hand clr len time =
5− let t = pi * time / 30 - pi / 2 in
3+ let t = pi * inSeconds time / 30 - pi / 2 in
64 solid clr $ line [(200,200), (200 + len * cos t, 200 + len * sin t)]
75
86clock t = collage 400 400 [ filled (rgb 96 176 224) $ ngon 12 110 (200, 200)
@@ -10,4 +8,4 @@ clock t = collage 400 400 [ filled (rgb 96 176 224) $ ngon 12 110 (200, 200)
108 , hand black 100 (t/60)
119 , hand black 60 (t/720) ]
1210
13−main = lift clock (every 1)
11+main = lift clock (every second)
Examples/elm-yesod/elm_source/index.elm+12−12
@@ -1,11 +1,11 @@
1−title w = size w 60 . box 4 . text . header . toText $ "Elm-Yesod"
1+title w = size w 60 . text . header . toText $ "Elm-Yesod"
22
33lightGrey = rgb 240 241 244
44mediumGrey = rgb 216 221 225
55heading outer inner =
6− color mediumGrey . size outer 61 . box 1 .
7− color lightGrey . size outer 60 . box 5 .
8− size inner 60 . box 5 $ title inner
6+ color mediumGrey . size outer 61 .
7+ color lightGrey . size outer 60 .
8+ size inner 60 $ title inner
99
1010skeleton body outer =
1111 let inner = if outer < 820 then outer - 20 else 800 in
@@ -19,17 +19,17 @@ section = text . bold . Text.height (5/4) . toText
1919
2020info w = List.map (\f -> f ()) . List.intersperse (\x -> plainText "&nbsp;") . List.map ((\e x -> e) . width w) $
2121 [ section "Written in Elm, served with Yesod"
22− , text $ toText "This page is written in " ++ link "http://elm-lang.org/" (toText "Elm") ++
23− toText " and served using the " ++
24− link "http://yesodweb.com/" (toText "Yesod Web Framework") ++
22+ , text $ toText "This page is written in " ++ Text.link "http://elm-lang.org/" (toText "Elm") ++
23+ toText " and served using the " ++
24+ Text.link "http://yesodweb.com/" (toText "Yesod Web Framework") ++
2525 toText ". Since you are looking at this page it is safe to assume that you already have the example code. "
2626 , text $ toText "Type-safe URLs are rendered using simple QuasiQuoter variable interpolation."
2727 , section "More examples:"
28− , text $ toText "- " ++ link "@{MouseR}" (toText "A simple mouse input example")
29− , text $ toText "- " ++ link "@{ClockR}" (toText "An animated analog clock")
30− , text $ toText "- " ++ link "@{ShapesR}" (toText "Some simple rendered shapes")
28+ , text $ toText "- " ++ Text.link "@{MouseR}" (toText "A simple mouse input example")
29+ , text $ toText "- " ++ Text.link "@{ClockR}" (toText "An animated analog clock")
30+ , text $ toText "- " ++ Text.link "@{ShapesR}" (toText "Some simple rendered shapes")
3131 ]
32−
33−body outer inner = width outer . box 2 . flow down . (:) (plainText "&nbsp;") $ info inner
32+
33+body outer inner = width outer . flow down . (:) (plainText "&nbsp;") $ info inner
3434
3535main = lift (skeleton body) Window.width
Examples/elm-yesod/elm_source/mouse.elm+6−8
@@ -1,15 +1,13 @@
11
22-- Move your mouse around above the canvas!
33
4−import Signal.Mouse (position)
5−import Signal.Window (dimensions)
6−
74myBlue = rgb 0 85 170
8−myGreen = rgba 28 267 85 (1/2)
5+myGreen = rgba 28 267 85 0.5
96
107scene (x,y) (w,h) =
11− collage w h [ filled myBlue . rotate ((x+y)/1000) $ ngon 4 100 (200,200)
12− , filled myGreen $ ngon 5 30 (x,y)
13− ]
8+ collage w h
9+ [ rotate (toFloat (x+y) / 1000) (filled myBlue (ngon 4 100 (200,200)))
10+ , filled myGreen (ngon 5 30 (x,y))
11+ ]
1412
15−main = lift2 scene position dimensions
13+main = lift2 scene Mouse.position Window.dimensions
README.md+7−3
@@ -1,8 +1,12 @@
11Elm
22===
33
4−This is the Elm compiler and server, allowing you to develop Elm
5−applications that run in any modern browser.
4+If you are new to Elm, learn more about the language [here](http://elm-lang.org/)
5+and try it out in the [online interactive editor](http://elm-lang.org/try).
6+
7+This is the Elm compiler and server, allowing you to natively develop Elm
8+applications that run in any modern browser. The compiler generates HTML and JS
9+files, and the server just serves .elm files directly.
610
711If you intend to serve Elm code with a custom Haskell backend, be
812sure to read all the way to the "Installation for Haskell-Users" section.
@@ -110,4 +114,4 @@ These problems all appeared before Elm version 0.1.1.4:
110114* Elm does not appear to work with the latest versions of `containers` (i.e. 0.4.2.*). I know it works with earlier versions of containers, so to avoid this problem, you can try: `cabal install elm --constrain="containers==0.4.1.0" --force-reinstall`
111115* On Windows, HAppStack has trouble installing because of issues with the "network" package. I struggled with this problem on Windows 7 until I found the suggestion at the bottom of [this page](http://hackage.haskell.org/trac/ghc/ticket/5159).
112116
113−If you are still stuck, email the list or ask a question in the [#Elm IRC channel](http://webchat.freenode.net/?channels=elm).
117+If you are still stuck, email the list or ask a question in the [#Elm IRC channel](http://webchat.freenode.net/?channels=elm).