Skip to content

Commit 3706c01

Browse files
authored
Merge pull request #127 from facundominguez/fd/intro-edits
Fixes to the introduction chapter
2 parents f95d443 + 63d0827 commit 3706c01

File tree

1 file changed

+23
-33
lines changed

1 file changed

+23
-33
lines changed

src/Tutorial_01_Introduction.lhs

Lines changed: 23 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ built on a foundation of machine code, or at the very least, `C`.
8080
Consider the ubiquitous `vector` library:
8181

8282
~~~~~{.ghci}
83-
ghci> :m +Data.Vector
83+
ghci> :m +Data.Vector
8484
ghci> let v = fromList ["haskell", "ocaml"]
8585
ghci> unsafeIndex v 0
8686
"haskell"
@@ -110,7 +110,7 @@ Finally, for certain kinds of programs, there is a fate worse than death.
110110
is used, for example, to build web services.
111111

112112
~~~~~{.ghci}
113-
ghci> :m +Data.Text Data.Text.Unsafe
113+
ghci> :m +Data.Text Data.Text.Unsafe
114114
ghci> let t = pack "Voltage"
115115
ghci> takeWord16 5 t
116116
"Volta"
@@ -144,7 +144,7 @@ there are fast *decision procedures* called SMT solvers.
144144
\newthought{By combining types with predicates} you can specify *contracts*
145145
which describe valid inputs and outputs of functions. The refinement
146146
type system *guarantees at compile-time* that functions adhere to
147-
their contracts. That is, you can rest assured that
147+
their contracts. That is, you can rest assured that
148148
the above calamities *cannot occur at run-time*.
149149

150150
\newthought{LiquidHaskell} is a Refinement Type Checker for Haskell, and in
@@ -190,7 +190,7 @@ solver, e.g. one of
190190
+ [Z3][z3] (which we recommend)
191191
+ [CVC4][cvc4]
192192
+ [MathSat][mathsat]
193-
193+
194194
\newthought{This Tutorial} is written in literate Haskell and
195195
the code for it is available [here][liquid-tutorial].
196196
Hence, we *strongly* recommend you grab the code, and follow
@@ -208,7 +208,7 @@ git clone --recursive https://github.com/ucsd-progsys/liquidhaskell-tutorial.git
208208
cabal v2-build
209209
~~~~~
210210

211-
or
211+
or
212212

213213
~~~~~{.sh}
214214
stack build --fast --file-watch
@@ -219,49 +219,39 @@ compilation will stop with a Liquid type error:
219219

220220
~~~~~{.spec}
221221
src/Tutorial_01_Introduction.lhs:30:27: error:
222-
Liquid Type Mismatch
223-
.
224-
The inferred type
222+
Liquid Type Mismatch
223+
.
224+
The inferred type
225225
VV : {v : GHC.Types.Int | v >= 0
226226
&& v == len xs}
227-
.
227+
.
228228
is not a subtype of the required type
229229
VV : {VV : GHC.Types.Int | VV /= 0}
230-
.
231-
in the context
230+
.
231+
in the context
232232
xs : {v : [GHC.Types.Int] | len v >= 0}
233-
|
233+
|
234234
30 | average xs = sum xs `div` length xs
235235
| ^^^^^^^^^
236236
~~~~~
237237

238-
**Step 3:** Iteratively edit-compile until the code in `src/`
239-
238+
**Step 3:** Iteratively edit-compile the code in `src/`
240239
until it _builds_ without any liquid type errors.
241240

242-
The above workflow will let you use whatever GHC/Haskell tooling you use for your
241+
The above workflow will let you use whatever GHC/Haskell tooling you use for your
243242
favorite editor, to automatically display LH errors as well.
244243

245-
Sample Code
246-
-----------
247-
248-
This tutorial is written in literate Haskell and
249-
the code for it is available [here][liquid-tutorial].
250-
251-
We *strongly* recommend you grab the code, and follow
252-
along, and especially that you do the exercises.
253-
254-
If you'd like to copy and paste code snippets into the
244+
If you'd like to copy and paste code snippets into the
255245
web demo, instead of cloning the repo, note that you may
256246
need to pass `--no-termination` to `liquid`, or equivalently,
257-
add the pragma `{-@ LIQUID "--no-termination" @-}` to the top
258-
of the source file. (By default, `liquid` tries to ensure that
259-
all code it examines will terminate. Some of the code in this
260-
tutorial is written in such a way that termination is not
261-
immediately obvious to LH.)
262-
263-
**Note:** This tutorial is a *work in progress*, and we will
264-
be **very** grateful for feedback and suggestions, ideally
247+
add the pragma `{-@ LIQUID "--no-termination" @-}` to the top
248+
of the source file. (By default, `liquid` tries to ensure that
249+
all code it examines will terminate. Some of the code in this
250+
tutorial is written in such a way that termination is not
251+
immediately obvious to LH.)
252+
253+
**Note:** This tutorial is a *work in progress*, and we will
254+
be **very** grateful for feedback and suggestions, ideally
265255
via pull-requests on github.
266256

267257
\noindent Lets begin!

0 commit comments

Comments
 (0)