Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 44 lines (33 sloc) 1.262 kb
300692b more tutorial futzing
Mark Lentczner authored
1 module Chapter03 where
2 import Text.Html
3 -- The lines above are just boilerplate (for now).
4
5 page = thehtml <<
6 [ header << (thetitle << "Step 3")
7 , body <<
8 [ h1 << "Groceries"
e0c1554 @mzero work on tutoial
authored
9 , paragraph << "Stuff to get at the store:"
10 , ulist << fruit
300692b more tutorial futzing
Mark Lentczner authored
11 ]
12 ]
13
14 --
15 -- In Haskell, all the items in the list have to be the same type. In this
16 -- case they are Html fragments, in particular <li> elements.
17 -- Here are some more:
18
19 aListOfStrings = ["astronaut", "baker", "candlestick maker"]
20 aListOfNumbers = [6, 42, -1, 1000000]
21 -- aListThatWon'tCompile = ["answer", 42]
22
23 --
24 -- *** TRY THIS ***
25 --
26 -- Try editing some string inside double quotes and save it. See what it does.
27 -- Try adding another paragraph. Just duplicate one of those lines and try it.
28 -- Add some other common block elements: Try h2 or pre.
29
30 --
31 -- *** A LIST ***
32 --
33
34 -- That defines a new name, fruit, that is an HTML fragment. Try putting that
35 -- into the list of items in the body of the page. Just put ", fruit" on a line
36 -- by itself in there, making sure to line the commas up.
37
38 -- You can define sections of your own, and add them the same way, such as:
39
40 footnote = paragraph << (small << "You are getting sleepy.")
41
e0c1554 @mzero work on tutoial
authored
42 fruit = map (li <<) $ words "apple banana kiki"
43
Something went wrong with that request. Please try again.