Skip to content

Commit 7f57c61

Browse files
committed
page.tmpl -> template.html
1 parent 1b3495a commit 7f57c61

File tree

3 files changed

+24
-6
lines changed

3 files changed

+24
-6
lines changed

001_basics.md

+23-5
Original file line numberDiff line numberDiff line change
@@ -258,24 +258,34 @@ in Haskell and generate infinite lists of values which are only evaluated up
258258
to the depth that it is needed.
259259

260260
```haskell
261+
-- Infinite stream of 1's
261262
ones = 1 : ones
262-
```
263263

264-
```haskell
264+
-- Infinite count from n
265265
numsFrom n = n : numsFrom (n+1)
266+
267+
-- Infinite stream of integer squares
268+
squares = map (^2) (numsfrom 0)
266269
```
267270

271+
The function take consumes the infinite stream, consuming only the values that
272+
are needed for the computation.
273+
268274
```haskell
269-
squares = map (^2) (numsfrom 0)
275+
take :: Int -> [a] -> [a]
276+
take n _ | n <= 0 = []
277+
take n [] = []
278+
take n (x:xs) = x : take (n-1) xs
270279
```
271280

272281
```haskell
273282
take 5 squares
283+
-- [0,1,4,9,16]
274284
```
275285

276286
This also admits diverging terms, called *bottoms* which have no normal form.
277-
What is unique about Haskell is that these values can be threaded around and
278-
don't diverge unless actually used.
287+
Under lazy evaluation these values can be threaded around and will never diverge
288+
unless actually forced.
279289

280290
```haskell
281291
bot = bot
@@ -288,6 +298,14 @@ argument is not used in the body of ``const``.
288298
const 42 bot
289299
```
290300

301+
The two bottom terms we will use frequently are used to write the scaffolding
302+
for incomplete program.
303+
304+
```haskell
305+
error :: String -> a
306+
undefined :: a
307+
```
308+
291309
Higher Kinded Types
292310
-------------------
293311

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ MATHJAX = "http://cdn.mathjax.org/mathjax/latest/MathJax.js?config=TeX-AMS-MML_H
44
FLAGS = --standalone --toc --toc-depth=2 --mathjax=$(MATHJAX) --highlight-style pygments
55
STYLE = css/style.css
66
FILTER = includes.hs
7-
TEMPLATE_HTML = page.tmpl
7+
TEMPLATE_HTML = template.html
88
TEMPLATE_TEX = template.latex
99

1010
SRC = $(wildcard *.md)

page.tmpl renamed to template.html

File renamed without changes.

0 commit comments

Comments
 (0)