Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 179 lines (178 sloc) 14.723 kb
fc177e5 Preparation for book
Meredith Gregory authored
1 \contentsline {chapter}{Contents}{i}{section*.1}
2 \contentsline {chapter}{Preface}{1}{chapter*.5}
3 \contentsline {chapter}{\numberline {1}Motivation and Background}{3}{chapter.1}
09f0a8d Added translation of concrete syntax and corresponding Scala code
Meredith Gregory authored
4 \contentsline {paragraph}{If on a winter's night a programmer (with apologies to Italo Calvino)}{3}{section*.6}
5b733bf Added discussion identifying reader. Added discussion of Haskell's
Meredith Gregory authored
5 \contentsline {section}{\numberline {1.1}Where are we}{4}{section.1.1}
6 \contentsline {subsection}{\numberline {1.1.1}The concurrency squeeze: from the hardware up, from the web down}{4}{subsection.1.1.1}
7 \contentsline {subsection}{\numberline {1.1.2}Ubiquity of robust, high-performance virtual machines}{5}{subsection.1.1.2}
8 \contentsline {subsection}{\numberline {1.1.3}Advances in functional programming, monads and the awkward squad}{6}{subsection.1.1.3}
9 \contentsline {section}{\numberline {1.2}Where are we going}{10}{section.1.2}
10 \contentsline {subsection}{\numberline {1.2.1}A functional web}{10}{subsection.1.2.1}
b69c1df Added discussion of book plan and justification for focus on monadic des...
Meredith Gregory authored
11 \contentsline {subsection}{\numberline {1.2.2}DSL-based design}{12}{subsection.1.2.2}
12 \contentsline {section}{\numberline {1.3}How are we going to get there}{13}{section.1.3}
13 \contentsline {subsection}{\numberline {1.3.1}Leading by example}{13}{subsection.1.3.1}
cd9140b Added placeholder figures and began outline of last chapter
Meredith Gregory authored
14 \contentsline {subsubsection}{Our toy language}{17}{section*.7}
15 \contentsline {paragraph}{Abstract syntax}{17}{section*.8}
7f3036d Refactored chapter one to move application domain model discussion to ch...
Meredith Gregory authored
16 \contentsline {paragraph}{Concrete syntax}{17}{section*.9}
60103d0 Adding images
Meredith Gregory authored
17 \contentsline {subsubsection}{Code editor}{19}{section*.10}
18 \contentsline {subsubsection}{Project editor}{19}{section*.11}
19 \contentsline {subsubsection}{Advanced features}{19}{section*.12}
20 \contentsline {subsection}{\numberline {1.3.2}Chapter map}{19}{subsection.1.3.2}
7f3036d Refactored chapter one to move application domain model discussion to ch...
Meredith Gregory authored
21 \contentsline {chapter}{\numberline {2}Toolbox}{21}{chapter.2}
22 \contentsline {section}{\numberline {2.1}Introduction to notation and terminology}{21}{section.2.1}
23 \contentsline {subsection}{\numberline {2.1.1}Scala}{21}{subsection.2.1.1}
24 \contentsline {subsection}{\numberline {2.1.2}Maths}{21}{subsection.2.1.2}
25 \contentsline {section}{\numberline {2.2}Introduction to core design patterns}{21}{section.2.2}
26 \contentsline {subsection}{\numberline {2.2.1}A little history}{21}{subsection.2.2.1}
27 \contentsline {paragraph}{Haskell's monad API}{22}{section*.13}
28 \contentsline {paragraph}{Do-notation}{22}{section*.14}
29 \contentsline {paragraph}{for-comprehensions}{23}{section*.15}
30 \contentsline {section}{\numberline {2.3}Variations in presentation}{26}{section.2.3}
31 \contentsline {subsection}{\numberline {2.3.1}A little more history}{26}{subsection.2.3.1}
32 \contentsline {subsubsection}{Intuition: Monad as container}{26}{section*.16}
33 \contentsline {paragraph}{Shape of the container}{26}{section*.17}
34 \contentsline {paragraph}{Putting things into the container}{26}{section*.18}
35 \contentsline {paragraph}{Flattening nested containers}{26}{section*.19}
36 \contentsline {subsubsection}{Preserving connection to existing structure: Monad as generalization of monoid}{27}{section*.20}
37 \contentsline {paragraph}{Associativity as flattening}{29}{section*.21}
38 \contentsline {paragraph}{Bracing for \texttt {XML}}{29}{section*.22}
39 \contentsline {paragraph}{The connection with set-comprehensions}{30}{section*.23}
40 \contentsline {paragraph}{Syntax and containers}{31}{section*.24}
41 \contentsline {subsubsection}{Decomposition of monad requirements}{31}{section*.25}
42 \contentsline {subsubsection}{A categorical way to look at monads}{32}{section*.26}
43 \contentsline {paragraph}{Quick digression about design by diagram-chasing}{33}{section*.27}
44 \contentsline {paragraph}{Monads are triples}{34}{section*.28}
e8e2673 Added code listings for categorical presentation of monad and witnesses ...
Meredith Gregory authored
45 \contentsline {chapter}{\numberline {3}An IO-monad for http streams}{39}{chapter.3}
46 \contentsline {section}{\numberline {3.1}Code first, questions later}{39}{section.3.1}
496da4c @leithaus Added figures for stream examples
authored
47 \contentsline {subsection}{\numberline {3.1.1}An HTTP-request processor}{48}{subsection.3.1.1}
48 \contentsline {subsection}{\numberline {3.1.2}What we did}{48}{subsection.3.1.2}
49 \contentsline {section}{\numberline {3.2}Synchrony, asynchrony and buffering}{48}{section.3.2}
50 \contentsline {section}{\numberline {3.3}State, statelessness and continuations}{48}{section.3.3}
51 \contentsline {chapter}{\numberline {4}Parsing requests, monadically}{49}{chapter.4}
52 \contentsline {section}{\numberline {4.1}Obligatory parsing monad}{49}{section.4.1}
53 \contentsline {section}{\numberline {4.2}Your parser combinators are showing}{49}{section.4.2}
54 \contentsline {section}{\numberline {4.3}EBNF and why higher levels of abstraction are better}{49}{section.4.3}
55 \contentsline {subsection}{\numberline {4.3.1}Different platforms, different parsers}{49}{subsection.4.3.1}
56 \contentsline {subsection}{\numberline {4.3.2}Different performance constraints, different parsers}{49}{subsection.4.3.2}
57 \contentsline {subsection}{\numberline {4.3.3}Maintainability}{49}{subsection.4.3.3}
58 \contentsline {chapter}{\numberline {5}The domain model as abstract syntax}{53}{chapter.5}
59 \contentsline {section}{\numberline {5.1}Our abstract syntax}{53}{section.5.1}
60 \contentsline {paragraph}{Abstract syntax}{53}{section*.29}
61 \contentsline {section}{\numberline {5.2}Our application domain model}{54}{section.5.2}
62 \contentsline {subsubsection}{Our toy language}{54}{section*.30}
63 \contentsline {paragraph}{A simple-minded representation}{54}{section*.31}
64 \contentsline {paragraph}{Currying}{55}{section*.32}
65 \contentsline {paragraph}{Type parametrization and quotation}{56}{section*.33}
66 \contentsline {paragraph}{Some syntactic sugar}{57}{section*.34}
67 \contentsline {paragraph}{Digression: complexity management principle}{57}{section*.35}
68 \contentsline {paragraph}{Concrete syntax}{57}{section*.36}
69 \contentsline {paragraph}{Translating concrete syntax to abstract syntax}{58}{section*.37}
70 \contentsline {paragraph}{Structural equivalence and Relations or What makes abstract syntax abstract}{61}{section*.38}
71 \contentsline {paragraph}{Digression: the internal structure of the type of variables}{65}{section*.39}
72 \contentsline {paragraph}{Evaluation -- aka operational semantics}{66}{section*.40}
73 \contentsline {paragraph}{Ordinary maps}{66}{section*.41}
74 \contentsline {paragraph}{DeBruijn notation}{66}{section*.42}
75 \contentsline {subsubsection}{The \texttt {Scala} implementation}{66}{section*.43}
76 \contentsline {subsubsection}{What goes into a language definition}{68}{section*.44}
77 \contentsline {paragraph}{Syntax}{69}{section*.45}
78 \contentsline {paragraph}{Structural equivalence}{69}{section*.46}
79 \contentsline {paragraph}{Operational semantics}{69}{section*.47}
80 \contentsline {paragraph}{Discussion}{69}{section*.48}
81 \contentsline {section}{\numberline {5.3}The project model}{70}{section.5.3}
82 \contentsline {subsection}{\numberline {5.3.1}Abstract syntax}{70}{subsection.5.3.1}
83 \contentsline {subsection}{\numberline {5.3.2}Concrete syntax -- and presentation layer}{70}{subsection.5.3.2}
84 \contentsline {subsection}{\numberline {5.3.3}Domain model}{70}{subsection.5.3.3}
85 \contentsline {section}{\numberline {5.4}A transform pipeline}{70}{section.5.4}
86 \contentsline {chapter}{\numberline {6}Zippers and contexts and URI's, oh my!}{71}{chapter.6}
87 \contentsline {section}{\numberline {6.1}Zippers are not just for Bruno anymore}{71}{section.6.1}
88 \contentsline {subsection}{\numberline {6.1.1}The history of the zipper}{71}{subsection.6.1.1}
89 \contentsline {subsubsection}{Huet's zipper}{71}{section*.49}
90 \contentsline {paragraph}{The navigation functions}{75}{section*.50}
91 \contentsline {paragraph}{Exercising the zipper}{76}{section*.51}
92 \contentsline {subsubsection}{Zippers generically}{80}{section*.52}
93 \contentsline {paragraph}{Two kinds of genericity}{80}{section*.53}
94 \contentsline {paragraph}{Genericity of structure}{80}{section*.54}
95 \contentsline {paragraph}{Genericity of control}{81}{section*.55}
96 \contentsline {section}{\numberline {6.2}Zipper and one-holed contexts}{82}{section.6.2}
97 \contentsline {section}{\numberline {6.3}Differentiation and contexts}{82}{section.6.3}
98 \contentsline {subsection}{\numberline {6.3.1}Regular types}{82}{subsection.6.3.1}
99 \contentsline {subsection}{\numberline {6.3.2}Container types}{82}{subsection.6.3.2}
100 \contentsline {section}{\numberline {6.4}Generic zipper -- differentiating navigation}{82}{section.6.4}
101 \contentsline {subsection}{\numberline {6.4.1}Delimited continuations}{85}{subsection.6.4.1}
102 \contentsline {subsubsection}{The genericity of delimited continuations}{86}{section*.56}
103 \contentsline {section}{\numberline {6.5}Species of Structure}{88}{section.6.5}
104 \contentsline {section}{\numberline {6.6}Constructing contexts and zippers from data types}{88}{section.6.6}
105 \contentsline {subsection}{\numberline {6.6.1}Contexts}{89}{subsection.6.6.1}
106 \contentsline {subsection}{\numberline {6.6.2}Zippers}{89}{subsection.6.6.2}
107 \contentsline {section}{\numberline {6.7}Mapping URIs to zipper-based paths and back}{95}{section.6.7}
108 \contentsline {subsection}{\numberline {6.7.1}Path and context}{95}{subsection.6.7.1}
109 \contentsline {subsection}{\numberline {6.7.2}Homomorphisms and obfuscation}{95}{subsection.6.7.2}
110 \contentsline {section}{\numberline {6.8}Applying zippers to our project}{95}{section.6.8}
111 \contentsline {subsection}{\numberline {6.8.1}Navigating and editing terms}{95}{subsection.6.8.1}
112 \contentsline {subsection}{\numberline {6.8.2}Navigating and editing projects}{97}{subsection.6.8.2}
113 \contentsline {chapter}{\numberline {7}A review of collections as monads}{99}{chapter.7}
114 \contentsline {section}{\numberline {7.1}Sets, Lists and Languages}{99}{section.7.1}
115 \contentsline {subsection}{\numberline {7.1.1}Witnessing Sets and Lists monadicity}{99}{subsection.7.1.1}
116 \contentsline {subsection}{\numberline {7.1.2}Languages and Sets of Words}{104}{subsection.7.1.2}
117 \contentsline {subsubsection}{Kleene star}{104}{section*.57}
118 \contentsline {subsubsection}{I am not a number, I am a free monoid}{104}{section*.58}
119 \contentsline {subsection}{\numberline {7.1.3}Of lenses and bananas}{104}{subsection.7.1.3}
120 \contentsline {section}{\numberline {7.2}Containers and syntax}{104}{section.7.2}
121 \contentsline {subsection}{\numberline {7.2.1}The algebra of Sets}{104}{subsection.7.2.1}
122 \contentsline {subsection}{\numberline {7.2.2}The algebra of Lists}{104}{subsection.7.2.2}
123 \contentsline {subsection}{\numberline {7.2.3}The algebra of Sets of Words}{105}{subsection.7.2.3}
124 \contentsline {section}{\numberline {7.3}Algebras}{105}{section.7.3}
125 \contentsline {subsection}{\numberline {7.3.1}Kleisli}{105}{subsection.7.3.1}
126 \contentsline {subsection}{\numberline {7.3.2}Eilenberg-Moore}{105}{subsection.7.3.2}
127 \contentsline {section}{\numberline {7.4}Monad as container}{105}{section.7.4}
128 \contentsline {section}{\numberline {7.5}Monads and take-out}{105}{section.7.5}
129 \contentsline {subsection}{\numberline {7.5.1}Option as container}{106}{subsection.7.5.1}
130 \contentsline {subsection}{\numberline {7.5.2}I/O monad for contrast}{106}{subsection.7.5.2}
131 \contentsline {subsection}{\numberline {7.5.3}Matching gazintas and gazoutas}{106}{subsection.7.5.3}
132 \contentsline {subsubsection}{Intuitionistic discipline}{106}{section*.60}
133 \contentsline {subsubsection}{Linear discipline}{106}{section*.61}
134 \contentsline {section}{\numberline {7.6}Co-monad and take-out}{106}{section.7.6}
135 \contentsline {section}{\numberline {7.7}Hopf structure}{106}{section.7.7}
136 \contentsline {section}{\numberline {7.8}Container and control}{106}{section.7.8}
137 \contentsline {subsection}{\numberline {7.8.1}Delimited continuations reconsidered}{106}{subsection.7.8.1}
138 \contentsline {chapter}{\numberline {8}Domain model, storage and state}{107}{chapter.8}
139 \contentsline {section}{\numberline {8.1}Mapping our domain model to storage}{107}{section.8.1}
140 \contentsline {subsection}{\numberline {8.1.1}Functional and relational models}{107}{subsection.8.1.1}
141 \contentsline {subsection}{\numberline {8.1.2}Functional and XML models}{107}{subsection.8.1.2}
142 \contentsline {subsection}{\numberline {8.1.3}ORM}{107}{subsection.8.1.3}
143 \contentsline {section}{\numberline {8.2}Storage and language-integrated query}{107}{section.8.2}
144 \contentsline {subsection}{\numberline {8.2.1}LINQ and \lstinline [language=Scala]!for!-comprehensions}{107}{subsection.8.2.1}
145 \contentsline {subsubsection}{Open source implementations}{107}{section*.62}
146 \contentsline {paragraph}{ScalaQuery}{107}{section*.63}
147 \contentsline {paragraph}{Squeryl}{107}{section*.64}
148 \contentsline {section}{\numberline {8.3}Continuations revisited}{108}{section.8.3}
149 \contentsline {subsection}{\numberline {8.3.1}Stored state}{108}{subsection.8.3.1}
150 \contentsline {subsection}{\numberline {8.3.2}Transactions}{108}{subsection.8.3.2}
151 \contentsline {chapter}{\numberline {9}Putting it all together}{109}{chapter.9}
152 \contentsline {section}{\numberline {9.1}Our web application end-to-end}{109}{section.9.1}
153 \contentsline {section}{\numberline {9.2}Deploying our application}{109}{section.9.2}
154 \contentsline {subsection}{\numberline {9.2.1}Why we are not deploying on GAE}{109}{subsection.9.2.1}
155 \contentsline {section}{\numberline {9.3}From one web application to web framework}{109}{section.9.3}
156 \contentsline {chapter}{\numberline {10}The semantic web}{111}{chapter.10}
157 \contentsline {section}{\numberline {10.1}Referential transparency}{111}{section.10.1}
158 \contentsline {paragraph}{A little motivation}{112}{section*.65}
159 \contentsline {section}{\numberline {10.2}Composing monads}{113}{section.10.2}
160 \contentsline {subsubsection}{Preliminary}{114}{section*.66}
161 \contentsline {section}{\numberline {10.3}Semantic application queries}{115}{section.10.3}
162 \contentsline {subsubsection}{An alternative presentation}{115}{section*.67}
163 \contentsline {paragraph}{Logic: the set monad as an algebra}{116}{section*.68}
164 \contentsline {paragraph}{Primes: an application}{117}{section*.69}
165 \contentsline {paragraph}{Summary}{117}{section*.70}
166 \contentsline {subsubsection}{Patterns}{118}{section*.71}
167 \contentsline {subsubsection}{A first mini-query language}{118}{section*.72}
168 \contentsline {subsubsection}{Iterating the design pattern}{118}{section*.73}
169 \contentsline {paragraph}{A spatial-behavioral-style logic for $\lambda $-calculus}{119}{section*.74}
170 \contentsline {paragraph}{Examples}{119}{section*.75}
171 \contentsline {subsubsection}{Logical semantics}{120}{section*.76}
172 \contentsline {subsubsection}{Other collection monads, other logics}{120}{section*.77}
173 \contentsline {paragraph}{Stateful collections}{120}{section*.78}
174 \contentsline {subsection}{\numberline {10.3.1}Other logical operations}{122}{subsection.10.3.1}
175 \contentsline {section}{\numberline {10.4}Searching for programs}{122}{section.10.4}
176 \contentsline {subsection}{\numberline {10.4.1}A new foundation for search}{122}{subsection.10.4.1}
177 \contentsline {subsubsection}{Monad composition via distributive laws}{122}{section*.79}
178 \contentsline {subsection}{\numberline {10.4.2}Examples}{122}{subsection.10.4.2}
Something went wrong with that request. Please try again.