on master help sign in
Fixed splicing and removed "box" + minor other changes
commit149e91eb2a3ac6d8fe9fade4f2770082bdabe2d2 authorVladimir Bychkovsky <vladimir.bychkovsky@gmail.com> dateFri 8 Feb 2013, 12:07 (14 years ago) parent13a38d9
1 file changed+17−8
Examples/elm-happstack/elm_source/index.elm+17−8
Examples/elm-happstack/elm_source/index.elm+17−8
@@ -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
@@ -17,6 +17,13 @@ skeleton body outer =
1717
1818section = text . bold . Text.height (5/4) . toText
1919
20+-- splicing of values works but literal substitution of strings
21+-- for this reason, we need to have quotes.
22+mouseLink = "#{mouse}"
23+clockLink = "#{clock}"
24+shapesLink = "#{shapes}"
25+
26+
2027info w = List.map (\f -> f ()) . List.intersperse (\x -> plainText "&nbsp;") . List.map ((\e x -> e) . width w) $
2128 [ section "Written in Elm, served with Yesod"
2229 , text $ toText "This page is written in " ++ Text.link "http://elm-lang.org/" (toText "Elm") ++
@@ -25,11 +32,13 @@ info w = List.map (\f -> f ()) . List.intersperse (\x -> plainText "&nbsp;") . L
2532 toText ". Since you are looking at this page it is safe to assume that you already have the example code. "
2633 , text $ toText "Type-safe URLs are rendered using simple QuasiQuoter variable interpolation."
2734 , section "More examples:"
28− , text $ toText "- " ++ Text.link mouse (toText "A simple mouse input example")
29− , text $ toText "- " ++ Text.link clock (toText "An animated analog clock")
30− , text $ toText "- " ++ Text.link shapes (toText "Some simple rendered shapes")
35+ , text $ toText "- " ++ Text.link mouseLink (toText "A simple mouse input example")
36+ , text $ toText "- " ++ Text.link clockLink (toText "An animated analog clock")
37+ , text $ toText "- " ++ Text.link shapesLink (toText "Some simple rendered shapes")
3138 ]
3239
33−body outer inner = width outer . box 2 . flow down . (:) (plainText "&nbsp;") $ info inner
40+-- The following line does not parse, replaced it something slightly different
41+-- body outer inner = width outer . flow down $ (:) (plainText "&nbsp;") $ info inner
42+body outer inner = width outer . flow down $ info inner
3443
3544main = lift (skeleton body) Window.width