Permalink
Browse files

merge in typo fixes from Jens Petersen

  • Loading branch information...
2 parents 2a6e88a + 602f04d commit d949fdbf7107be8abe65adc6235ad0efc277cb71 @mzero committed Feb 19, 2011
View
@@ -21,6 +21,10 @@ Description:
database backend storage. Along the way it exposes the programmer
to the basic idioms needed to do simple programming tasks.
+source-repository head
+ type: git
+ location: https://github.com/mtnviewmark/barley.git
+
data-files:
seed/Chapter01.hs
seed/Chapter02.hs
@@ -41,7 +41,7 @@ output2 = "Other stuff: "
-- ++ "Yo!"
-- ++ show 42
-- ++ show [ 23, 13, 4, 700, 8 ]
- -- ++ show (sort [ 23, 13, 4, 700, 8 ])
+ -- ++ show (reverse [ 23, 13, 4, 700, 8 ])
-- You can just remove the leading dashes. In Haskell, expressions can be continued
-- on the next line so long as they are indented from the starting line.
@@ -40,8 +40,8 @@ page = slideDeck "Chapter 1: Syntax"
, ""
, "lookup (key + 1) dict -- Haskell"
]
- , codeSlide "Function Defintion"
- "This is similar in function difintions, too:"
+ , codeSlide "Function Definition"
+ "This is similar in function definitions, too:"
[ "f(a,b) = { return 2*a + 3*b; } // as in C*/J*"
, ""
, "f a b = 2*a + 3*b -- Haskell"
@@ -31,7 +31,7 @@ output4 = "\t" ++ show ( length (lines input))
-- NEXT
--- Most haskell code doesn't have so many parenthesis. Instead, it uses the $ operator like so:
+-- Most haskell code doesn't have so many parentheses. Instead, it uses the $ operator like so:
output1' = unlines $ sort $ lines input
output2' = unlines $ take 2 $ map reverse $ lines input
@@ -5,7 +5,7 @@ import Data.List
-- Playing with lists
fruit :: [String]
-fruit = ["apple", "bannana", "orange", "plum", "peach", "grape", "fig", "apricot"]
+fruit = ["apple", "banana", "orange", "plum", "peach", "grape", "fig", "apricot"]
ages :: [Integer]
ages = [42, 0, 18, 6, 22, 72]
@@ -9,7 +9,7 @@ input = "`Twas brillig, and the slithy toves\n"
++ "And the mome raths outgrabe.\n"
output :: String
-output = output2
+output = output1
oneNumber :: Int -> String -> String
oneNumber n s = show n ++ ": " ++ s
@@ -5,7 +5,7 @@ import Slides
page = slideDeck "Chapter 2"
[ titleSlide "Chapter 2"
[ "HTML Output"
- , "Four ways to write a to do list."
+ , "Four ways to write a to-do list."
]
, codeSlide "Text.Html"
"From now own, we'll be generating HTML output. \
@@ -28,7 +28,7 @@ page = slideDeck "Chapter 2"
, "noHtml -- an empty Html content"
]
, pointSlide "Onward"
- "Now let's build a To Do list..."
+ "Now let's build a To-Do list..."
[ "Be brave"
, "Read the comments"
, "Go on to the next tutorial step."
@@ -7,7 +7,7 @@ page = thehtml <<
, body <<
[ h1 << "A poem from last time:"
, pre << poemText
- , h1 << "A to do list:"
+ , h1 << "A to-do list:"
, thediv << toDoHtml
]
]
@@ -34,11 +34,11 @@ poemText = unlines $ lineNumbers 1 $ lines poem
-- NEXT
--- Here's a simple to do list, and some code that converts it into Html
+-- Here's a simple to-do list, and some code that converts it into Html
-- It doesn't do a very nice job. Which you can see if you hit Run.
toDoItems :: [String] -- a list of strings
-toDoItems = ["Pick up avacados", "Make snacks", "Clean house", "Have party"]
+toDoItems = ["Pick up avocados", "Make snacks", "Clean house", "Have party"]
renderToDo :: [String] -> [Html]
renderToDo ts = [toHtml $ show ts]
@@ -7,7 +7,7 @@ page = thehtml <<
, body <<
[ h1 << "A poem from last time:"
, pre << poemText
- , h1 << "A to do list:"
+ , h1 << "A to-do list:"
, thediv << toDoHtml
]
]
@@ -41,7 +41,7 @@ poemText = unlines $ lineNumbers 1 $ lines poem
-- Try converting it to using guards:
toDoItems :: [String] -- a list of strings
-toDoItems = ["Pick up avacados", "Make snacks", "Clean house", "Have party"]
+toDoItems = ["Pick up avocados", "Make snacks", "Clean house", "Have party"]
renderToDo :: [String] -> [Html]
renderToDo ts =
@@ -28,7 +28,7 @@ page = slideDeck "Chapter 2: Lists"
"In various Lisp dialects, this would look like:"
[ "nil -- the empty list"
, "(cons 42 nil) -- a list of one value"
- , "(cons 1 (cons 2 (cons 3 []))) -- a list of three values"
+ , "(cons 1 (cons 2 (cons 3 nil))) -- a list of three values"
]
, codeSlide "Watch out: Haskell's : ≠ Lisp's cons"
"In Lisp, cons puts any two things together. Not so in Haskell. In \
@@ -7,7 +7,7 @@ page = thehtml <<
, body <<
[ h1 << "A poem from last time:"
, pre << poemText
- , h1 << "A to do list:"
+ , h1 << "A to-do list:"
, thediv << toDoHtml
]
]
@@ -28,7 +28,7 @@ lineNumbers n [] = []
lineNumbers n (x:xs) = oneNumber n x : lineNumbers (n+1) xs
-- Notice that instead of a single equation (with the function name) =, there
-- are now two. Each repeats the arguments, but with patterns. Like guards, the
--- first equaltion where all the patterns match will be used.
+-- first equation where all the patterns match will be used.
-- Notice something else: The last expression changed:
oldWay n (x:xs) = [oneNumber n x] ++ lineNumbers (n+1) xs
@@ -46,7 +46,7 @@ poemText = unlines $ lineNumbers 1 $ lines poem
-- Try converting it to using patterns:
toDoItems :: [String] -- a list of strings
-toDoItems = ["Pick up avacados", "Make snacks", "Clean house", "Have party"]
+toDoItems = ["Pick up avocados", "Make snacks", "Clean house", "Have party"]
renderToDo :: [String] -> [Html]
renderToDo ts
@@ -5,7 +5,7 @@ import Text.Html
page = thehtml <<
[ header << (thetitle << "Output")
, body <<
- [ h1 << "A to do list:"
+ [ h1 << "A to-do list:"
, thediv << toDoHtml
, h1 << "Some action:"
, thediv << comicAction
@@ -17,7 +17,7 @@ page = thehtml <<
-- Getting simpler, isn't it?
toDoItems :: [String] -- a list of strings
-toDoItems = ["Pick up avacados", "Make snacks", "Clean house", "Have party"]
+toDoItems = ["Pick up avocados", "Make snacks", "Clean house", "Have party"]
renderToDo :: [String] -> [Html]
renderToDo [] = []
@@ -5,7 +5,7 @@ import Text.Html
page = thehtml <<
[ header << (thetitle << "Output")
, body <<
- [ h1 << "A to do list:"
+ [ h1 << "A to-do list:"
, thediv << toDoHtml
]
]
@@ -15,7 +15,7 @@ page = thehtml <<
toDoItems :: [(Bool, String)] -- a list of tuples: each a Bool and String
toDoItems =
- [ (True, "Pick up avacados")
+ [ (True, "Pick up avocados")
, (True, "Make snacks")
, (False, "Clean house")
, (False, "Have party")
@@ -32,7 +32,7 @@ page = slideDeck "Chapter 3"
, "A tuple always has the number of members indicated by its type."
]
, codeSlide "Type names"
- "You can give a name to a type. This makes things more convient to \
+ "You can give a name to a type. This makes things more convenient to \
\use:"
[ "type Person = (Int, String)"
, ""
@@ -45,9 +45,9 @@ page = slideDeck "Chapter 3"
[ "type Person = (Int, String)"
, ""
, "amy :: Person"
- , "amy = (28, \"Amy\""
+ , "amy = (28, \"Amy\")"
, ""
, "bob :: (Int, String)"
- , "bob = (26, \"Bob\""
+ , "bob = (26, \"Bob\")"
]
]
@@ -5,7 +5,7 @@ import Text.Html
page = thehtml <<
[ header << (thetitle << "Output")
, body <<
- [ h1 << "A to do list:"
+ [ h1 << "A to-do list:"
, thediv << toDoHtml
]
]
@@ -14,7 +14,7 @@ page = thehtml <<
toDoItems :: [(Bool, String)] -- a list of tuples: each a Bool and String
toDoItems =
- [ (True, "Pick up avacados")
+ [ (True, "Pick up avocados")
, (True, "Make snacks")
, (False, "Clean house")
, (False, "Have party")
@@ -5,7 +5,7 @@ import Slides
page = slideDeck "Chapter 3"
[ codeSlide "Not that safe"
"Type synonyms are quick and easy and often the right choice, but \
- \don't offer as much type saftey as possible. Consider:"
+ \don't offer as much type safety as possible. Consider:"
[ "type Range = (Int, Int)"
, "inRange :: Range -> Int -> Bool"
, "inRange (lo,hi) x = lo <= x && x <= hi"
@@ -17,7 +17,7 @@ page = slideDeck "Chapter 3"
, "ick = inRange p 4 -- compiles!"
]
, codeSlide "Data Types"
- "Data types let you create a type that is distinct. When you so you \
+ "Data types let you create a type that is distinct. When you do so you \
\define a constructor that builds values of the type:"
[ "data Range = Range Int Int"
, "inRange :: Range -> Int -> Bool"
@@ -29,7 +29,7 @@ page = slideDeck "Chapter 3"
, ""
, "ick = inRange p 4 -- now this is a compile error"
]
- , codeSlide "Multiple Constrcutors"
+ , codeSlide "Multiple Constructors"
"Data types are very powerful. They can have more than one constructor \
\and each constructor can have any number of values:"
[ "data Direction = North | East | South | West"
@@ -44,7 +44,7 @@ page = slideDeck "Chapter 3"
, " \"blowin' \" ++ show speed ++ \" from \" ++ show dir"
]
, codeSlide "Wait, Deriving What?"
- "The deriving clause on the data declaration is a bit of boilerplate \
+ "The deriving clause in the data declaration is a bit of boilerplate \
\saver that will make your data do more. Here are some of the things \
\you can 'derive' for your data automatically:"
[ "Eq -- works with == and /= operators"
@@ -5,7 +5,7 @@ import Text.Html
page = thehtml <<
[ header << (thetitle << "Output")
, body <<
- [ h1 << "A to do list:"
+ [ h1 << "A to-do list:"
, thediv << toDoHtml
, h1 << "# people invited:"
, p << show (headcount invited)
@@ -18,7 +18,7 @@ data ToDo = ToDo String | Done String
toDoItems :: [ToDo]
toDoItems =
- [ Done "Pick up avacados"
+ [ Done "Pick up avocados"
, Done "Make snacks"
, ToDo "Clean house"
, ToDo "Have party"
@@ -5,7 +5,7 @@ import Text.Html
page = thehtml <<
[ header << (thetitle << "Output")
, body <<
- [ h1 << "A to do list:"
+ [ h1 << "A to-do list:"
, thediv << toDoHtml
, reminderHtml
, h1 << "# people invited:"
@@ -17,7 +17,7 @@ data ToDo = ToDo String | Done String
toDoItems :: [ToDo]
toDoItems =
- [ Done "Pick up avacados"
+ [ Done "Pick up avocados"
, Done "Make snacks"
, ToDo "Clean house"
, ToDo "Have party"
@@ -63,7 +63,7 @@ toDoHtml = ulist << renderToDo toDoItems
-- NEXT
-- Add an optional partner or spouse to the invite data type.
--- Add a list of invitiees (and optional partners!) to the page.
+-- Add a list of invitees (and optional partners!) to the page.
data Invite = Invite String Int
View
@@ -43,7 +43,7 @@ step1 = ("Install and run Barley",
step2 :: Step
step2 = ("Navigating Barley",
- [ p << "This web site is a small development envinronment for Haskell. \
+ [ p << "This web site is a small development environment for Haskell. \
\Here are the main navigation elements:"
, p << (bold << "Top bar:" +++ "The black top bar at the very top of \
\the page has links to commonly used pages. At the top right, \

0 comments on commit d949fdb

Please sign in to comment.