on master help sign in
Tutorial changes.

+ Tutorial is now developed in a separate github repo. + Moved examples to top-level + Added binary of tutorial for v0.9.10

commit17c7240825fe134f4b9f1f715622d935dae2ff97 authorJan de Muijnck-Hughes <jfdm@st-andrews.ac.uk> dateThu 28 Nov 2013, 11:40 (13 years ago) parenta10bcf0
38 files changed−9185
tutorial/examples/Makefile → examples/Makefile tutorial/examples/binary.idr → examples/binary.idr tutorial/examples/bmain.idr → examples/bmain.idr tutorial/examples/btree.idr → examples/btree.idr tutorial/examples/classes.idr → examples/classes.idr tutorial/examples/foo.idr → examples/foo.idr tutorial/examples/hello.idr → examples/hello.idr tutorial/examples/idiom.idr → examples/idiom.idr tutorial/examples/interp.idr → examples/interp.idr tutorial/examples/letbind.idr → examples/letbind.idr tutorial/examples/prims.idr → examples/prims.idr tutorial/examples/theorems.idr → examples/theorems.idr tutorial/examples/universe.idr → examples/universe.idr tutorial/examples/usefultypes.idr → examples/usefultypes.idr tutorial/examples/vbroken.idr → examples/vbroken.idr tutorial/examples/views.idr → examples/views.idr tutorial/examples/wheres.idr → examples/wheres.idr idris-tutorial.pdf tutorial/Makefile−40 tutorial/conf.ltx−17 tutorial/content/classes.tex−440 tutorial/content/conclusions.tex−14 tutorial/content/dsl.tex−82 tutorial/content/interp.tex−332 tutorial/content/intro.tex−65 tutorial/content/miscellany.tex−458 tutorial/content/modules.tex−201 tutorial/content/provisional.tex−284 tutorial/content/starting.tex−145 tutorial/content/syntax.tex−104 tutorial/content/theorems.tex−377 tutorial/content/typesfuns.tex−1017 tutorial/content/views.tex−96 tutorial/fpmacros.sty−1086 tutorial/idris-tutorial.tex−56 tutorial/idrislang.sty−190 tutorial/library.ltx−325 tutorial/literature.bib−3856
tutorial/examples/Makefile → examples/Makefilerenamed

The content is the same.

tutorial/examples/binary.idr → examples/binary.idrrenamed

The content is the same.

tutorial/examples/bmain.idr → examples/bmain.idrrenamed

The content is the same.

tutorial/examples/btree.idr → examples/btree.idrrenamed

The content is the same.

tutorial/examples/classes.idr → examples/classes.idrrenamed

The content is the same.

tutorial/examples/foo.idr → examples/foo.idrrenamed

The content is the same.

tutorial/examples/hello.idr → examples/hello.idrrenamed

The content is the same.

tutorial/examples/idiom.idr → examples/idiom.idrrenamed

The content is the same.

tutorial/examples/interp.idr → examples/interp.idrrenamed

The content is the same.

tutorial/examples/letbind.idr → examples/letbind.idrrenamed

The content is the same.

tutorial/examples/prims.idr → examples/prims.idrrenamed

The content is the same.

tutorial/examples/theorems.idr → examples/theorems.idrrenamed

The content is the same.

tutorial/examples/universe.idr → examples/universe.idrrenamed

The content is the same.

tutorial/examples/usefultypes.idr → examples/usefultypes.idrrenamed

The content is the same.

tutorial/examples/vbroken.idr → examples/vbroken.idrrenamed

The content is the same.

tutorial/examples/views.idr → examples/views.idrrenamed

The content is the same.

tutorial/examples/wheres.idr → examples/wheres.idrrenamed

The content is the same.

idris-tutorial.pdfnew file

Binary file not shown.

tutorial/Makefiledeleted−40
@@ -1,40 +0,0 @@
1−PAPER = idris-tutorial
2−
3−all: ${PAPER}.pdf
4−
5−TEXFILES = ${PAPER}.tex content/*.tex
6−
7−DIAGS =
8−
9−SOURCES = ${TEXFILES} ${DIAGS} macros.ltx library.ltx literature.bib
10−
11−DITAA = java -jar ~/Downloads/ditaa.jar
12−
13−${PAPER}.pdf: ${SOURCES}
14− pdflatex ${PAPER}
15− -bibtex ${PAPER}
16− -pdflatex ${PAPER}
17− -pdflatex ${PAPER}
18−
19−${PAPER}.ps: ${PAPER}.dvi
20− dvips -o ${PAPER}.ps ${PAPER}
21−
22−${PAPER}.dvi: $(SOURCES)
23− -latex ${PAPER}
24− -bibtex ${PAPER}
25− -latex ${PAPER}
26− -latex ${PAPER}
27−
28−progress: .PHONY
29− wc -w ${TEXFILES}
30−
31−%.png : %.diag
32− $(DITAA) -o -E $<
33−
34−todropbox: .PHONY
35− cp ${SOURCES} ~/Dropbox/TeX/idris-tutorial
36−
37−fromdropbox: .PHONY
38− cp ~/Dropbox/TeX/idris-tutorial/* .
39−
40−.PHONY:
tutorial/conf.ltxdeleted−17
@@ -1,17 +0,0 @@
1−%% This file contains configurations of used packages
2−
3−\lstset{%
4− basicstyle=\ttfamily,
5− xleftmargin=\parindent,
6− tabsize=2
7−}
8−
9−
10−% Configuration of hyperref (to not use colors):
11−\hypersetup{
12− colorlinks,
13− linkcolor=black,
14− citecolor=black,
15− filecolor=black,
16− urlcolor=black
17−}
tutorial/content/classes.texdeleted−440
@@ -1,440 +0,0 @@
1−\section{Type Classes}
2−\label{sec:classes}
3−
4−We often want to define functions which work across several different data
5−types. For example, we would like arithmetic operators to work on \texttt{Int},
6−\texttt{Integer} and \texttt{Float} at the very least. We would like
7−\texttt{==} to work on the majority of data types. We would like to be able to
8−display different types in a uniform way.
9−
10−To achieve this, we use a feature which has proved to be effective in Haskell, namely
11−\emph{type classes}. To define a type class, we provide a collection of overloaded
12−operations which describe the interface for \emph{instances} of that class. A simple example
13−is the \texttt{Show} type class, which is defined in the prelude and
14−provides an interface for converting values to
15−\texttt{String}s:
16−
17−\begin{code}
18−class Show a where
19− show : a -> String
20−\end{code}
21−
22−\noindent
23−This generates a function of the following type (which we call a \emph{method} of the
24−\texttt{Show} class):
25−
26−\begin{code}
27−show : Show a => a -> String
28−\end{code}
29−
30−\noindent
31−We can read this as ``under the constraint that \texttt{a} is an instance of \texttt{Show},
32−take an \texttt{a} as input and return a \texttt{String}.'' An instance of a class
33−is defined with an \texttt{instance} declaration, which provides implementations of
34−the function for a specific type. For example, the \texttt{Show} instance for \texttt{Nat}
35−could be defined as:
36−
37−\begin{code}
38−instance Show Nat where
39− show Z = "Z"
40− show (S k) = "s" ++ show k
41−\end{code}
42−
43−\begin{lstlisting}
44−Idris> show (S (S (S Z)))
45−"sssO" : String
46−\end{lstlisting}
47−
48−\noindent
49−Only one instance of a class can be given for a type --- instances may not overlap.
50−Instance declarations can themselves have constraints. For example, to define a
51−\texttt{Show} instance for vectors, we need to know that there is a \texttt{Show}
52−instance for the element type, because we are going to use it to convert each element
53−to a \texttt{String}:
54−
55−\begin{code}
56−instance Show a => Show (Vect n a) where
57− show xs = "[" ++ show' xs ++ "]" where
58− show' : Vect n a -> String
59− show' Nil = ""
60− show' (x :: Nil) = show x
61− show' (x :: xs) = show x ++ ", " ++ show' xs
62−\end{code}
63−
64−%\noindent
65−%\textbf{Remark: } The type of the auxiliary function \texttt{show'} is
66−%important. The type variables \texttt{a} and \texttt{n} which are part of the
67−%instance declaration for \texttt{Show (Vect a n)} are fixed across the entire
68−%instance declaration. As a result, we do not have to constrain \texttt{a}
69−%again. Furthermore, it means that if we use \texttt{n} in the type, it refers
70−%to the (fixed) length of the outermost list \texttt{xs}. Therefore,
71−%we use a different name for the length \texttt{n'} in \texttt{show'}.
72−
73−\subsection{Default Definitions}
74−
75−The library defines an \texttt{Eq} class which provides an interface for comparing
76−values for equality or inequality, with instances for all of the built-in types:
77−
78−\begin{code}
79−class Eq a where
80− (==) : a -> a -> Bool
81− (/=) : a -> a -> Bool
82−\end{code}
83−
84−\noindent
85−To declare an instance of a type, we have to give definitions of all of the methods.
86−For example, for an instance of \texttt{Eq} for \texttt{Nat}:
87−
88−\begin{code}
89−instance Eq Nat where
90− Z == Z = True
91− (S x) == (S y) = x == y
92− Z == (S y) = False
93− (S x) == Z = False
94−
95− x /= y = not (x == y)
96−\end{code}
97−
98−\noindent
99−It is hard to imagine many cases where the \texttt{/=} method will be anything other
100−than the negation of the result of applying the \texttt{==} method. It is therefore
101−convenient to give a default definition for each method in the class
102−declaration, in terms of the other method:
103−
104−\begin{code}
105−class Eq a where
106− (==) : a -> a -> Bool
107− (/=) : a -> a -> Bool
108−
109− x /= y = not (x == y)
110− y == y = not (x /= y)
111−\end{code}
112−
113−\noindent
114−A minimal complete definition of an \texttt{Eq} instance requires either \texttt{==}
115−or \texttt{/=} to be defined, but does not require both. If a method definition is
116−missing, and there is a default definition for it, then the default is used instead.
117−
118−\subsection{Extending Classes}
119−
120−Classes can also be extended. A logical next step from an equality relation \texttt{Eq}
121−is to define an ordering relation \texttt{Ord}. We can define an \texttt{Ord} class
122−which inherits methods from \texttt{Eq} as well as defining some of its own:
123−
124−\begin{code}
125−data Ordering = LT | EQ | GT
126−\end{code}
127−
128−\begin{code}
129−class Eq a => Ord a where
130− compare : a -> a -> Ordering
131−
132− (<) : a -> a -> Bool
133− (>) : a -> a -> Bool
134− (<=) : a -> a -> Bool
135− (>=) : a -> a -> Bool
136− max : a -> a -> a
137− min : a -> a -> a
138−\end{code}
139−
140−\noindent
141−The \texttt{Ord} class allows us to compare two values and determine their ordering.
142−Only the \texttt{compare} method is required; every other method has a default definition.
143−Using
144−this we can write functions such as \texttt{sort}, a function which sorts a list into
145−increasing order, provided that the element type of the list is in the \texttt{Ord} class.
146−We give the constraints on the type variables left of the fat arrow \texttt{=>}, and the
147−function type to the right of the fat arrow:
148−
149−\begin{code}
150−sort : Ord a => List a -> List a
151−\end{code}
152−
153−\noindent
154−Functions, classes and instances can have multiple constraints. Multiple constaints are
155−written in brackets in a comma separated list, for example:
156−
157−\begin{code}
158−sortAndShow : (Ord a, Show a) => List a -> String
159−sortAndShow xs = show (sort xs)
160−\end{code}
161−
162−\subsection{Monads and \texttt{do}-notation}
163−
164−\label{sec:monad}
165−
166−So far, we have seen single parameter type classes, where the parameter is of type
167−\texttt{Type}. In general, there can be any number (greater than 0) of parameters,
168−and the parameters can have \remph{any} type.
169−If the type of the parameter is not \texttt{Type}, we need to give an explicit type
170−declaration. For example:
171−
172−\begin{code}
173−class Monad (m : Type -> Type) where
174− return : a -> m a
175− (>>=) : m a -> (a -> m b) -> m b
176−\end{code}
177−
178−\noindent
179−The \texttt{Monad} class allows us to encapsulate binding and computation, and is the
180−basis of \texttt{do}-notation introduced in Section \ref{sect:do}. Inside a
181−\texttt{do} block, the following syntactic transformations are applied:
182−
183−\begin{itemize}
184−\item \texttt{x <- v; e} becomes \texttt{v >>= ($\backslash$x => e)}
185−\item \texttt{v; e} becomes \texttt{v >>= ($\backslash$\_ => e)}
186−\item \texttt{let x = v; e} becomes \texttt{let x = v in e}
187−\end{itemize}
188−
189−\noindent
190−\texttt{IO} is an instance of \texttt{Monad}, defined using primitive functions.
191−We can also define an instance for \texttt{Maybe}, as follows:
192−
193−\begin{code}
194−instance Monad Maybe where
195− return = Just
196−
197− Nothing >>= k = Nothing
198− (Just x) >>= k = k x
199−\end{code}
200−
201−\noindent
202−Using this we can, for example, define a function which adds two
203−\texttt{Maybe Int}s, using the monad to encapsulate the error handling:
204−
205−\begin{code}
206−m_add : Maybe Int -> Maybe Int -> Maybe Int
207−m_add x y = do x' <- x -- Extract value from x
208− y' <- y -- Extract value from y
209− return (x' + y') -- Add them
210−\end{code}
211−
212−\noindent
213−This function will extract the values from \texttt{x} and \texttt{y}, if they
214−are available, or return \texttt{Nothing} if they are not. Managing the
215−\texttt{Nothing} cases is achieved by the \texttt{>>=} operator, hidden by the
216−\texttt{do} notation.
217−
218−\begin{lstlisting}
219−*classes> m_add (Just 20) (Just 22)
220−Just 42 : Maybe Int
221−*classes> m_add (Just 20) Nothing
222−Nothing : Maybe Int
223−\end{lstlisting}
224−
225−\subsubsection*{Monad comprehensions}
226−
227−The list comprehension notation we saw in Section \ref{sec:listcomp} is more
228−general, and applies to anything which is an instance of \texttt{MonadPlus}:
229−
230−\begin{code}
231−class Monad m => MonadPlus (m : Type -> Type) where
232− mplus : m a -> m a -> m a
233− mzero : m a
234−\end{code}
235−
236−\noindent
237−In general, a comprehension takes the form \texttt{[ exp | qual1, qual2, ..., qualn ]} where
238−\texttt{quali} can be one of:
239−
240−\begin{itemize}
241−\item A generator \texttt{x <- e}
242−\item A \emph{guard}, which is an expression of type \texttt{Bool}
243−\item A let binding \texttt{let x = e}
244−\end{itemize}
245−
246−\noindent
247−To translate a comprehension \texttt{[exp | qual1, qual2, ..., qualn]}, first
248−any qualifier
249−\texttt{qual} which is a \emph{guard} is translated to \texttt{guard qual}, using
250−the following function:
251−
252−\begin{code}
253−guard : MonadPlus m => Bool -> m ()
254−\end{code}
255−
256−\noindent
257−Then the comprehension is converted to \texttt{do} notation:
258−
259−\begin{code}
260−do { qual1; qual2; ...; qualn; return exp; }
261−\end{code}
262−
263−\noindent
264−Using monad comprehensions, an alternative definition for \texttt{m\_add} would be:
265−
266−\begin{code}
267−m_add : Maybe Int -> Maybe Int -> Maybe Int
268−m_add x y = [ x' + y' | x' <- x, y' <- y ]
269−\end{code}
270−
271−\subsection{Idiom brackets}
272−
273−While \texttt{do} notation gives an alternative meaning to sequencing, idioms give an
274−alternative meaning to \emph{application}. The notation and larger example in this
275−section is inspired by Conor McBride and Ross Paterson's paper "Applicative
276−Programming with Effects"~\cite{idioms}.
277−
278−First, let us revisit \texttt{m\_add} above. All it is really doing is applying
279−an operator to two values extracted from Maybe Ints. We could abstract out the
280−application:
281−
282−\begin{code}
283−m_app : Maybe (a -> b) -> Maybe a -> Maybe b
284−m_app (Just f) (Just a) = Just (f a)
285−m_app _ _ = Nothing
286−\end{code}
287−
288−\noindent
289−Using this, we can write an alternative \texttt{m\_add} which uses this alternative
290−notion of function application, with explicit calls to \texttt{m\_app}:
291−
292−\begin{code}
293−m_add' : Maybe Int -> Maybe Int -> Maybe Int
294−m_add' x y = m_app (m_app (Just (+)) x) y
295−\end{code}
296−
297−\noindent
298−Rather than having to insert \texttt{m\_app} everywhere there is an
299−application, we can use \remph{idiom brackets} to do the job for us. To do
300−this, we use the \texttt{Applicative} class, which captures the notion of
301−application for a data type:
302−
303−\begin{code}
304−infixl 2 <$>
305−
306−class Applicative (f : Type -> Type) where
307− pure : a -> f a
308− (<$>) : f (a -> b) -> f a -> f b
309−\end{code}
310−
311−\noindent
312−\texttt{Maybe} is made an instance of \texttt{Applicative} as follows, where
313−\texttt{<\$>} is defined in the same way as \texttt{m\_app} above:
314−
315−\begin{code}
316−instance Applicative Maybe where
317− pure = Just
318−
319− (Just f) <$> (Just a) = Just (f a)
320− _ <$> _ = Nothing
321−\end{code}
322−
323−\noindent
324−Using \remph{idiom brackets} we can use this instance as follows, where a function
325−application \texttt{[| f a1 ... an |]}
326−is translated into \texttt{pure f <\$> a1 <\$> ... <\$> an}:
327−
328−\begin{code}
329−m_add' : Maybe Int -> Maybe Int -> Maybe Int
330−m_add' x y = [| x + y |]
331−\end{code}
332−
333−\subsubsection{An error-handling interpreter}
334−
335−Idiom notation is commonly useful when defining evaluators. McBride and
336−Paterson describe such an evaluator~\cite{idioms}, for a language similar to
337−the following:
338−
339−\begin{code}
340−data Expr = Var String -- variables
341− | Val Int -- values
342− | Add Expr Expr -- addition
343−\end{code}
344−
345−\noindent
346−Evaluation will take place relative to a context mapping variables (represented as
347−\texttt{String}s) to integer values, and can possibly fail. We define a data type
348−\texttt{Eval} to wrap an evaluator:
349−
350−\begin{code}
351−data Eval : Type -> Type where
352− MkEval : (List (String, Int) -> Maybe a) -> Eval a
353−\end{code}
354−
355−\noindent
356−Wrapping the evaluator in a data type means we will be able to make it an instance
357−of a type class later. We begin by defining a function to retrieve values from
358−the context during evaluation:
359−
360−\begin{code}
361−fetch : String -> Eval Int
362−fetch x = MkEval (\e => fetchVal e) where
363− fetchVal : List (String, Int) -> Maybe Int
364− fetchVal [] = Nothing
365− fetchVal ((v, val) :: xs) = if (x == v) then (Just val) else (fetchVal xs)
366−\end{code}
367−
368−\noindent
369−When defining an evaluator for the language, we will be applying functions in
370−the context of an \texttt{Eval}, so it is natural to make \texttt{Eval} an
371−instance of \texttt{Applicative}.
372−Before \texttt{Eval} can be an instance of
373−\texttt{Applicative} it is necessary to make \texttt{Eval} an instance of
374−\texttt{Functor}:
375−
376−\begin{code}
377−instance Functor Eval where
378− fmap f (MkEval g) = MkEval (\e => fmap f (g e))
379−
380−instance Applicative Eval where
381− pure x = MkEval (\e => Just x)
382−
383− (<$>) (MkEval f) (MkEval g) = MkEval (\x => app (f x) (g x)) where
384− app : Maybe (a -> b) -> Maybe a -> Maybe b
385− app (Just fx) (Just gx) = Just (fx gx)
386− app _ _ = Nothing
387−\end{code}
388−
389−\noindent
390−Evaluating an expression can now make use of the idiomatic application to handle
391−errors:
392−
393−\begin{code}
394−eval : Expr -> Eval Int
395−eval (Var x) = fetch x
396−eval (Val x) = [| x |]
397−eval (Add x y) = [| eval x + eval y |]
398−
399−runEval : List (String, Int) -> Expr -> Maybe Int
400−runEval env e = case eval e of
401− MkEval envFn => envFn env
402−\end{code}
403−
404−\subsection{Named Instances}
405−
406−It can be desirable to have multiple instances of a type class, for example to provide
407−alternative methods for sorting or printing values. To achieve this, instances can
408−be \remph{named} as follows:
409−
410−\begin{code}
411−instance [myord] Ord Nat where
412− compare Z (S n) = GT
413− compare (S n) Z = LT
414− compare Z Z = EQ
415− compare (S x) (S y) = compare @{myord} x y
416−\end{code}
417−
418−\noindent
419−This declares an instance as normal, but with an explicit name, \texttt{myord}.
420−The syntax \texttt{compare @\{myord\}} gives an explicit instance to
421−\texttt{compare}, otherwise it would use the default instance for \texttt{Nat}.
422−We can use this, for example, to sort a list of \texttt{Nat}s in reverse.
423−Given the following list:
424−
425−\begin{code}
426−testList : List Nat
427−testList = [3,4,1]
428−\end{code}
429−
430−\noindent
431−\ldots we can sort it using the default \texttt{Ord} instance, then the named
432−instance \texttt{myord} as follows, at the \Idris{} prompt:
433−
434−\begin{lstlisting}
435−*named_instance> show (sort testList)
436−"[sO, sssO, ssssO]" : String
437−*named_instance> show (sort @{myord} testList)
438−"[ssssO, sssO, sO]" : String
439−\end{lstlisting}
440−
tutorial/content/conclusions.texdeleted−14
@@ -1,14 +0,0 @@
1−\section{Further Reading}
2−
3−Further information about \Idris{} programming, and programming with dependent
4−types in general, can be obtained from various sources:
5−
6−\begin{itemize}
7−\item The \Idris{} web site (\url{http://idris-lang.org/}) and by asking questions
8−on the mailing list.
9−\item The IRC channel \texttt{\#idris}, on \url{chat.freenode.net}.
10−\item Examining the prelude and exploring the \texttt{samples} in the distribution.
11−\item Various papers (e.g. \cite{plpv11, scrap-engine,res-dsl-padl12}). These mostly describe
12−older versions of \Idris{}.
13−\end{itemize}
14−
tutorial/content/dsl.texdeleted−82
@@ -1,82 +0,0 @@
1−\subsection{\texttt{dsl} notation}
2−
3−The well-typed interpreter in Section \ref{sect:interp} is a simple example of
4−a common programming pattern with dependent types, namely: describe an
5−\emph{object language}
6−and its type system with dependent types to guarantee that only well-typed programs
7−can be represented, then program using that representation. Using this approach
8−we can, for example, write programs for serialising binary data~\cite{plpv11} or
9−running concurrent processes safely~\cite{cbconc-fi}.
10−
11−Unfortunately, the form of object language programs makes it rather hard to program
12−this way in practice. Recall the factorial program in \texttt{Expr} for example:
13−
14−\begin{code}
15−fact : Expr G (TyFun TyInt TyInt)
16−fact = Lam (If (Op (==) (Var stop) (Val 0))
17− (Val 1) (Op (*) (app fact (Op (-) (Var stop) (Val 1)))
18− (Var stop)))
19−\end{code}
20−
21−\noindent
22−Since this is a particularly useful pattern, \Idris{} provides syntax
23−overloading~\cite{res-dsl-padl12} to make it easier to program in such
24−object languages:
25−
26−\begin{code}
27−dsl expr
28− lambda = Lam
29− variable = Var
30− index_first = stop
31− index_next = pop
32−\end{code}
33−
34−\noindent
35−A \texttt{dsl} block describes how each syntactic construct is represented in an
36−object language. Here, in the \texttt{expr} language, any \Idris{} lambda is
37−translated to a \texttt{Lam} constructor; any variable is translated to the
38−\texttt{Var} constructor, using \texttt{pop} and \texttt{stop} to construct the
39−de Bruijn index (i.e., to count how many bindings since the variable itself was bound).
40−It is also possible to overload \texttt{let} in this way. We can now write \texttt{fact}
41−as follows:
42−
43−\begin{code}
44−fact : Expr G (TyFun TyInt TyInt)
45−fact = expr (\x => If (Op (==) x (Val 0))
46− (Val 1) (Op (*) (app fact (Op (-) x (Val 1))) x))
47−\end{code}
48−
49−\noindent
50−In this new version, \texttt{expr} declares that the next expression will be overloaded.
51−We can take this further, using idiom brackets, by declaring:
52−
53−\begin{code}
54−(<$>) : |(f : Expr G (TyFun a t)) -> Expr G a -> Expr G t
55−(<$>) = \f, a => App f a
56−
57−pure : Expr G a -> Expr G a
58−pure = id
59−\end{code}
60−
61−\noindent
62−Note that there is no need for these to be part of an instance of \texttt{Applicative},
63−since idiom bracket notation translates directly to the names \texttt{<\$>} and
64−\texttt{pure}, and ad-hoc type-directed overloading is allowed. We can now say:
65−
66−\begin{code}
67−fact : Expr G (TyFun TyInt TyInt)
68−fact = expr (\x => If (Op (==) x (Val 0))
69− (Val 1) (Op (*) [| fact (Op (-) x (Val 1)) |] x))
70−\end{code}
71−
72−\noindent
73−With some more ad-hoc overloading and type class instances, and a new
74−syntax rule, we can even go as far as:
75−
76−\begin{code}
77−syntax IF [x] THEN [t] ELSE [e] = If x t e
78−
79−fact : Expr G (TyFun TyInt TyInt)
80−fact = expr (\x => IF x == 0 THEN 1 ELSE [| fact (x - 1) |] * x)
81−\end{code}
82−
tutorial/content/interp.texdeleted−332
@@ -1,332 +0,0 @@
1−\section{Example: The Well-Typed Interpreter}
2−\label{sect:interp}
3−
4−In this section, we'll use the features we've seen so far to write a larger
5−example, an interpreter for a simple functional programming language, with
6−variables, function application, binary operators and an \texttt{if...then...else}
7−construct. We will use the dependent type system to ensure that any programs
8−which can be represented are well-typed. First, let us define the types in the
9−language. We have integers, booleans, and functions, represented by \texttt{Ty}:
10−
11−\begin{code}
12−data Ty = TyInt | TyBool | TyFun Ty Ty
13−\end{code}
14−
15−\noindent
16−We can write a function to translate these representations to a concrete \Idris{}
17−type --- remember that types are first class, so can be calculated just like
18−any other value:
19−
20−\begin{code}
21−interpTy : Ty -> Type
22−interpTy TyInt = Int
23−interpTy TyBool = Bool
24−interpTy (TyFun A T) = interpTy A -> interpTy T
25−\end{code}
26−
27−\noindent
28−We're going to define a representation of our language in such a way that only
29−well-typed programs can be represented. We'll index the representations of
30−expressions by their type and the types of local variables (the context), which
31−we'll be using regularly as an implicit argument, so we define everything
32−in a \texttt{using} block:
33−
34−\begin{code}
35−using (G:Vect n Ty)
36−\end{code}
37−
38−\noindent
39−The full representation of expressions is given in Figure \ref{exprty}. They are
40−indexed by the types of the local variables, and the type of the expression itself:
41−
42−\begin{code}
43−data Expr : Vect n Ty -> Ty -> Type
44−\end{code}
45−
46−\noindent
47−Since expressions are indexed by their type, we can read the typing rules of
48−the language from the definitions of the constructors. Let us look at each
49−constructor in turn.
50−
51−\begin{code}[caption={Expression representation},label=exprty]
52−data HasType : (i : Fin n) -> Vect n Ty -> Ty -> Type where
53− stop : HasType fZ (t :: G) t
54− pop : HasType k G t -> HasType (fS k) (u :: G) t
55−
56−data Expr : Vect n Ty -> Ty -> Type where
57− Var : HasType i G t -> Expr G t
58− Val : (x : Int) -> Expr G TyInt
59− Lam : Expr (a :: G) t -> Expr G (TyFun a t)
60− App : Expr G (TyFun a t) -> Expr G a -> Expr G t
61− Op : (interpTy a -> interpTy b -> interpTy c) -> Expr G a -> Expr G b ->
62− Expr G c
63− If : Expr G TyBool -> Expr G a -> Expr G a -> Expr G a
64−\end{code}
65−
66−\noindent
67−We use a nameless representation for variables --- they are \emph{de Bruijn indexed}.
68−Variables are represented by a proof of their membership in the context,
69−\texttt{HasType i G T}, which is a proof that variable \texttt{i} in context
70−\texttt{G} has type \texttt{T}. This is defined as follows:
71−
72−\begin{code}
73−data HasType : (i : Fin n) -> Vect n Ty -> Ty -> Type where
74− stop : HasType fZ (t :: G) t
75− pop : HasType k G t -> HasType (fS k) (u :: G) t
76−\end{code}
77−
78−\noindent
79−We can treat \remph{stop} as a proof that the most recently defined variable is well-typed,
80−and \remph{pop n} as a proof that, if the \texttt{n}th most recently defined variable is
81−well-typed, so is the \texttt{n+1}th. In practice, this means we use \texttt{stop} to
82−refer to the most recently defined variable, \texttt{pop stop} to refer to the next, and so on,
83−via the \texttt{Var} constructor:
84−
85−\begin{code}
86−Var : HasType i G t -> Expr G t
87−\end{code}
88−
89−\noindent
90−So, in an expression \texttt{$\backslash$x. $\backslash$y. x y},
91−the variable \texttt{x} would have a de Bruijn index
92−of 1, represented as \texttt{pop stop}, and \texttt{y 0}, represented
93−as \texttt{stop}. We find these by counting the number of lambdas between the
94−definition and the use.
95−
96−\noindent
97−A value carries a concrete representation of an integer:
98−
99−\begin{code}
100−Val : (x : Int) -> Expr G TyInt
101−\end{code}
102−
103−\noindent
104−A lambda creates a function. In the scope of a function of type \texttt{a -> t}, there is
105−a new local variable of type \texttt{a}, which is expressed by the context index:
106−
107−\begin{code}
108−Lam : Expr (a :: G) t -> Expr G (TyFun a t)
109−\end{code}
110−
111−\noindent
112−Function application produces a value of type \texttt{t} given a function from
113−\texttt{a} to \texttt{t}
114−and a value of type \texttt{a}:
115−
116−\begin{code}
117−App : Expr G (TyFun a t) -> Expr G a -> Expr G t
118−\end{code}
119−
120−\noindent
121−We allow arbitrary binary operators, where the type of the operator
122−informs what the types of the arguments must be:
123−
124−\begin{code}
125−Op : (interpTy a -> interpTy b -> interpTy c) -> Expr G a -> Expr G b ->
126− Expr G c
127−\end{code}
128−
129−\noindent
130−Finally, if expressions make a choice given a boolean. Each branch must
131−have the same type:
132−
133−\begin{code}
134−If : Expr G TyBool -> Expr G a -> Expr G a -> Expr G a
135−\end{code}
136−
137−\noindent
138−When we evaluate an \texttt{Expr}, we'll need to know the values in scope, as well as
139−their types. \texttt{Env} is an environment, indexed over the types in scope.
140−Since an environment is just another form of list, albeit with a strongly specified connection
141−to the vector of local variable types, we use the usual \texttt{::} and \texttt{Nil}
142−constructors so that we can use the usual list syntax. Given a proof that a variable
143−is defined in the context, we can then produce a value from the environment:
144−
145−\begin{code}
146−data Env : Vect n Ty -> Type where
147− Nil : Env Nil
148− (::) : interpTy a -> Env G -> Env (a :: G)
149−
150−lookup : HasType i G t -> Env G -> interpTy t
151−lookup stop (x :: xs) = x
152−lookup (pop k) (x :: xs) = lookup k xs
153−\end{code}
154−
155−\begin{code}[caption={Intepreter definition},label=interpdef]
156−interp : Env G -> Expr G t -> interpTy t
157−interp env (Var i) = lookup i env
158−interp env (Val x) = x
159−interp env (Lam sc) = \x => interp (x :: env) sc
160−interp env (App f s) = interp env f (interp env s)
161−interp env (Op op x y) = op (interp env x) (interp env y)
162−interp env (If x t e) = if interp env x then interp env t
163− else interp env e
164−\end{code}
165−
166−\noindent
167−Given this, an interpreter (Figure \ref{interpdef})
168−is a function which translates an \texttt{Expr} into a
169−concrete \Idris{} value with respect to a specific environment:
170−
171−\begin{code}
172−interp : Env G -> Expr G t -> interpTy t
173−\end{code}
174−
175−\noindent
176−To translate a variable, we simply look it up in the environment:
177−
178−\begin{code}
179−interp env (Var i) = lookup i env
180−\end{code}
181−
182−\noindent
183−To translate a value, we just return the concrete representation of the value:
184−
185−\begin{code}
186−interp env (Val x) = x
187−\end{code}
188−
189−\noindent
190−Lambdas are more interesting. In this case, we construct a function which
191−interprets the scope of the lambda with a new value in the environment. So, a
192−function in the object language is translated to an \Idris{} function:
193−
194−\begin{code}
195−interp env (Lam sc) = \x => interp (x :: env) sc
196−\end{code}
197−
198−\noindent
199−For an application, we interpret the function and its argument and apply it
200−directly. We know that interpreting \texttt{f} must produce a function, because of its
201−type:
202−
203−\begin{code}
204−interp env (App f s) = interp env f (interp env s)
205−\end{code}
206−
207−\noindent
208−Operators and interpreters are, again, direct translations into the equivalent
209−\Idris{} constructs. For operators, we apply the function to its operands directly,
210−and for \texttt{If}, we apply the \Idris{} \texttt{if...then...else} construct
211−directly.
212−
213−\begin{code}
214−interp env (Op op x y) = op (interp env x) (interp env y)
215−interp env (If x t e) = if interp env x then interp env t
216− else interp env e
217−\end{code}
218−
219−\noindent
220−We can make some simple test functions. Firstly, adding two inputs
221−\texttt{$\backslash$x. $\backslash$y. y + x} is written as follows:
222−
223−\begin{code}
224−add : Expr G (TyFun TyInt (TyFun TyInt TyInt))
225−add = Lam (Lam (Op (+) (Var stop) (Var (pop stop))))
226−\end{code}
227−
228−\noindent
229−More interestingly, we can write a factorial function. First, we write a \emph{lazy}
230−version of the \texttt{App} constructor, so that the recursive branch will only
231−be evaluated if necessary:
232−
233−\begin{code}
234−app : |(f : Expr G (TyFun a t)) -> Expr G a -> Expr G t
235−app = \f, a => App f a
236−\end{code}
237−
238−\noindent
239−The vertical bar annotation before the \texttt{f} argument indicates that this
240−argument should be evaluated lazily when \texttt{app} is applied --- that is, the
241−argument will be evaluated only when needed.
242−Then \texttt{fact}
243−(i.e. \texttt{$\backslash$x. if (x == 0) then 1 else (fact (x-1) * x)})
244−is written as follows:
245−
246−\begin{code}
247−fact : Expr G (TyFun TyInt TyInt)
248−fact = Lam (If (Op (==) (Var stop) (Val 0))
249− (Val 1) (Op (*) (app fact (Op (-) (Var stop) (Val 1)))
250− (Var stop)))
251−\end{code}
252−
253−To finish, we write a \texttt{main} program which interprets the factorial function
254−on user input:
255−
256−\begin{code}
257−main : IO ()
258−main = do putStr "Enter a number: "
259− x <- getLine
260− print (interp [] fact (cast x))
261−\end{code}
262−
263−\noindent
264−Here, \texttt{cast} is an overloaded function which converts a value from one
265−type to another if possible. Here, it converts a string to
266−an integer, giving 0 if the input is invalid. An example run of this program
267−at the \Idris{} interactive environment is shown in Figure \ref{factrun}.
268−
269−\begin{lstlisting}[caption={Running the well-typed interpreter}, label=factrun, escapechar=^]
270−$ idris interp.idr
271− ____ __ _
272− / _/___/ /____(_)____
273− / // __ / ___/ / ___/ Version ^\version{}^
274− _/ // /_/ / / / (__ ) http://www.idris-lang.org/
275− /___/\__,_/_/ /_/____/ Type :? for help
276−
277−Type checking ./interp.idr
278−*interp> :exec
279−Enter a number: 6
280−720
281−*interp>
282−\end{lstlisting}
283−
284−\subsubsection*{Aside: \texttt{cast}}
285−
286−The prelude defines a type class \texttt{Cast} which allows conversion between
287−types:
288−
289−\begin{code}
290−class Cast from to where
291− cast : from -> to
292−\end{code}
293−
294−\noindent
295−It is a \emph{multi-parameter} type class, defining the source type and object
296−type of the cast. It must be possible for the type checker to infer \remph{both}
297−parameters at the point where the cast is applied.
298−There are casts defined between all of the primitive types, as far as
299−they make sense.
300−
301−\subsection{Unit testing}
302−
303−Recall the \texttt{so} data type:
304−
305−\begin{code}
306−data so : Bool -> Type where
307− oh : so True
308−\end{code}
309−
310−\noindent
311−This requires its parameter to be a \texttt{True} value. One simple application of this
312−is to perform unit testing of functions at compile time. For example, we know that
313−\texttt{4! = 24} so we can set up a test case as follows:
314−
315−\begin{code}
316−unitTestFac : so (interp [] fact 4 == 24)
317−unitTestFac = oh
318−\end{code}
319−
320−\noindent
321−For the program to compile, the test case must pass. If we change \texttt{24} to \texttt{25},
322−say, we will get an error message like the following:
323−
324−\begin{lstlisting}
325−Type checking ./interp.idr
326−interp.idr:64:Can't unify so True with so False
327−
328−Specifically:
329− Can't unify True with False
330−\end{lstlisting}
331−
332−
tutorial/content/intro.texdeleted−65
@@ -1,65 +0,0 @@
1−\section{Introduction}
2−
3−In conventional programming languages, there is a clear distinction between
4−\remph{types} and \remph{values}. For example, in Haskell~\cite{haskell-report},
5−the following are types, representing integers, characters, lists of characters,
6−and lists of any value respectively:
7−
8−\begin{itemize}
9−\item \texttt{Int}, \texttt{Char}, \texttt{[Char]}, \texttt{[a]}
10−\end{itemize}
11−
12−\noindent
13−Correspondingly, the following values are examples of inhabitants of those types:
14−
15−\begin{itemize}
16−\item \texttt{42}, \texttt{'a'}, \texttt{"Hello world!"}, \texttt{[2,3,4,5,6]}
17−\end{itemize}
18−
19−\noindent
20−In a language with \emph{dependent types}, however, the distinction is less
21−clear.
22−Dependent types allow types to ``depend'' on values --- in other words,
23−types are a \emph{first class} language construct and can be manipulated like
24−any other value. The standard
25−example is the type of lists of a given length\footnote{Typically, and perhaps
26−confusingly, referred to in the dependently typed programming literature as
27−``vectors''}, \texttt{Vect n a}, where \texttt{a} is the element type and
28−\texttt{n} is the length of the list and can be an arbitrary
29−term.
30−
31−When types can contain values, and where those values describe properties (e.g.
32−the length of a list)
33−the type of a function can begin to describe its own properties. For example,
34−concatenating two lists has the property that the resulting list's length is
35−the sum of the lengths of the two input lists. We can therefore give the following type
36−to the \texttt{app} function, which concatenates vectors:
37−
38−\begin{lstlisting}
39−app : Vect n a -> Vect m a -> Vect (n + m) a
40−\end{lstlisting}
41−
42−\noindent
43−This tutorial introduces \Idris{}, a general purpose functional
44−programming language with dependent types.
45−The goal of the \Idris{} project is to build a dependently typed language suitable
46−for verifiable \emph{systems} programming. To this end, \Idris{} is a compiled language
47−which aims to generate efficient executable code. It also has a lightweight foreign
48−function interface which allows easy interaction with external C libraries.
49−
50−\subsection{Intended Audience}
51−
52−This tutorial is intended as a brief introduction to the language, and is aimed
53−at readers already familiar with a functional language such as Haskell or
54−OCaml. In particular, a certain amount of familiarity with Haskell syntax is
55−assumed, although most concepts will at least be explained briefly. The reader
56−is also assumed to have some interest in using dependent types for writing and
57−verifying systems software.
58−
59−\subsection{Example Code}
60−
61−This tutorial includes some example code, which has been tested with \Idris{} version
62−\version{}. The files are available in the \Idris{} distribution,
63−so that you can try them out easily,
64−under \texttt{tutorial/examples}. However, it is strongly recommended that you
65−type them in yourself, rather than simply loading and reading them.
tutorial/content/miscellany.texdeleted−458
@@ -1,458 +0,0 @@
1−\section{Miscellany}
2−
3−In this section we discuss a variety of additional features:
4−auto implicit and default
5−arguments, literate programming, interfacing with external libraries through the
6−foreign function interface, type providers, code generation and the universe hierarchy.
7−
8−\subsection{Auto implicit arguments}
9−
10−We have already seen implicit arguments, which allows arguments to be omitted when
11−they can be inferred by the type checker, e.g.
12−
13−\begin{code}
14−index : {a:Type} -> {n:Nat} -> Fin n -> Vect n a -> a
15−\end{code}
16−
17−\noindent
18−In other situations, it may be possible to infer arguments not by type checking but
19−by searching the context for an appropriate value, or constructing a proof. For example,
20−the following definition of \texttt{head} which requires a proof that the list is
21−non-empty
22−
23−\begin{code}
24−isCons : List a -> Bool
25−isCons [] = False
26−isCons (x :: xs) = True
27−
28−head : (xs : List a) -> (isCons xs = True) -> a
29−head (x :: xs) _ = x
30−\end{code}
31−
32−\noindent
33−If the list is statically known to be non-empty, either because its value is known or
34−because a proof already exists in the context, the proof can be constructed
35−automatically. Auto implicit arguments allow this to happen silently. We define
36−\texttt{head} as follows:
37−
38−\begin{code}
39−head : (xs : List a) -> {auto p : isCons xs = True} -> a
40−head (x :: xs) = x
41−\end{code}
42−
43−\noindent
44−The \texttt{auto} annotation on the implicit argument means that \Idris{} will
45−attempt to fill in the implicit argument using the \texttt{trivial} tactic, which
46−searches through the context for a proof, and tries to solve with \texttt{refl}
47−if a proof is not found.
48−Now when \texttt{head} is applied, the proof can be omitted. In the case that a proof
49−is not found, it can be provided explicitly as normal:
50−
51−\begin{code}
52−head xs {p = ?headProof}
53−\end{code}
54−
55−\noindent
56−More generally, we can fill in implicit arguments with a default value by annotating
57−them with \texttt{default}. The definition above is equivalent to:
58−
59−\begin{code}
60−head : (xs : List a) ->
61− {default proof { trivial; } p : isCons xs = True} -> a
62−head (x :: xs) = x
63−\end{code}
64−
65−\subsection{Implicit conversions}
66−
67−\Idris{} supports the creation of \emph{implicit conversions}, which allow
68−automatic conversion of values from one type to another when required to make
69−a term type correct. This is intended to increase convenience and reduce
70−verbosity. A contrived but simple example is the following:
71−
72−\begin{code}
73−implicit intString : Int -> String
74−intString = show
75−
76−test : Int -> String
77−test x = "Number " ++ x
78−\end{code}
79−
80−\noindent
81−In general, we cannot append an \texttt{Int} to a \texttt{String}, but the
82−implicit conversion function \texttt{intString} can convert \texttt{x} to a
83−\texttt{String}, so the definition of \texttt{test} is type correct. An
84−implicit conversion is implemented just like any other function, but given
85−the \texttt{implicit} modifier, and restricted to one explicit argument.
86−
87−Only one implicit conversion will be applied at a time. That is, implicit
88−conversions cannot be chained.
89−Implicit conversions of simple types, as above, are however discouraged! More
90−commonly, an implicit conversion would be used to reduce verbosity in an
91−embedded domain specific language, or to hide details of a proof. Such examples
92−are beyond the scope of this tutorial.
93−
94−\subsection{Literate programming}
95−
96−Like Haskell, \Idris{} supports \emph{literate} programming. If a file has an
97−extension of \texttt{.lidr} then it is assumed to be a literate file. In literate
98−programs, everything is assumed to be a comment unless the line begins with a
99−greater than sign \texttt{>}, for example:
100−
101−\begin{lstlisting}
102−> module literate
103−
104−This is a comment. The main program is below
105−
106−> main : IO ()
107−> main = putStrLn "Hello literate world!\n"
108−\end{lstlisting}
109−
110−\noindent
111−An additional restriction is that there must be a blank line between a program
112−line (beginning with \texttt{>}) and a comment line (beginning with any other
113−character).
114−
115−\subsection{Foreign function calls}
116−
117−For practical programming, it is often necessary to be able to use external libraries,
118−particularly for interfacing with the operating system, file system, networking, etc.
119−\Idris{} provides a lightweight foreign function interface for achieving this,
120−as part of the prelude. For this, we assume a certain amount of knowledge of
121−C and the \texttt{gcc} compiler. First, we define a datatype which describes the external
122−types we can handle:
123−
124−\begin{code}
125−data FTy = FInt | FFloat | FChar | FString | FPtr | FUnit
126−\end{code}
127−
128−\noindent
129−Each of these corresponds directly to a C type. Respectively: \texttt{int},
130−\texttt{double}, \texttt{char}, \texttt{char*}, \texttt{void*} and \texttt{void}.
131−There is also a translation to a concrete \Idris{} type, described by the
132−following function:
133−
134−\begin{code}
135−interpFTy : FTy -> Type
136−interpFTy FInt = Int
137−interpFTy FFloat = Float
138−interpFTy FChar = Char
139−interpFTy FString = String
140−interpFTy FPtr = Ptr
141−interpFTy FUnit = ()
142−\end{code}
143−
144−\noindent
145−A foreign function is described by a list of input types and a return type, which
146−can then be converted to an \Idris{} type:
147−
148−\begin{code}
149−ForeignTy : (xs:List FTy) -> (t:FTy) -> Type
150−\end{code}
151−
152−\noindent
153−A foreign function is assumed to be impure, so \texttt{ForeignTy} builds an
154−\texttt{IO} type, for example:
155−
156−\begin{lstlisting}
157−Idris> ForeignTy [FInt, FString] FString
158−Int -> String -> IO String : Type
159−
160−Idris> ForeignTy [FInt, FString] FUnit
161−Int -> String -> IO () : Type
162−\end{lstlisting}
163−
164−\noindent
165−We build a call to a foreign function by giving the name of the function, a list of
166−argument types and the return type. The built in function \texttt{mkForeign}
167−converts this description to a function callable by \Idris{}
168−
169−\begin{code}
170−data Foreign : Type -> Type where
171− FFun : String -> (xs:List FTy) -> (t:FTy) ->
172− Foreign (ForeignTy xs t)
173−
174−mkForeign : Foreign x -> x
175−\end{code}
176−
177−\noindent
178−For example, the \texttt{putStr} function is implemented as follows, as a call to
179−an external function \texttt{putStr} defined in the run-time system:
180−
181−\begin{code}
182−putStr : String -> IO ()
183−putStr x = mkForeign (FFun "putStr" [FString] FUnit) x
184−\end{code}
185−
186−\subsubsection*{Include and linker directives}
187−
188−Foreign function calls are translated directly to calls to C functions, with appropriate
189−conversion between the \Idris{} representation of a value and the C representation.
190−Often this will require extra libraries to be linked in, or extra header and object files.
191−This is made possible through the following directives:
192−
193−\begin{itemize}
194−\item \texttt{\%lib \emph{target} "x"} --- include the \texttt{libx} library. If the target is \texttt{C} this is equivalent to passing the
195−\texttt{-lx} option to \texttt{gcc}. If the target is Java the library will be interpreted as a
196−"groupId:artifactId:packaging:version" dependency coordinate for maven.
197−\item \texttt{\%include \emph{target} "x"} --- use the header file or import \texttt{x} for the given back end target.
198−\item \texttt{\%link \emph{target} "x.o"} --- link with the object file \texttt{x.o} when using the given back end target.
199−\item \texttt{\%dynamic "x.so"} --- dynamically link the interpreter with the shared object \texttt{x.so}.
200−\end{itemize}
201−
202−\subsubsection*{Testing foreign function calls}
203−Normally, the Idris interpreter (used for typechecking and at the REPL) will
204−not perform IO actions. Additionally, as it neither generates C code nor
205−compiles to machine code, the \texttt{\%lib}, \texttt{\%include} and
206−\texttt{\%link} directives have no effect. IO actions and FFI calls can be
207−tested using the special REPL command \texttt{:x EXPR}, and C libraries can be
208−dynamically loaded in the interpreter by using the \texttt{:dynamic} command
209−or the \texttt{\%dynamic} directive. For example:
210−
211−\begin{lstlisting}
212−Idris> :dynamic libm.so
213−Idris> :x unsafePerformIO ((mkForeign (FFun "sin" [FFloat] FFloat)) 1.6)
214−0.9995736030415051 : Float
215−\end{lstlisting}
216−
217−\subsection{Type Providers}
218−Idris type providers, inspired by F\#'s type providers, are a means of making
219−our types be ``about'' something in the world outside of Idris. For example,
220−given a type that represents a database schema and a query that is checked
221−against it, a type provider could read the schema of a real database during
222−type checking.
223−
224−Idris type providers use the ordinary execution semantics of Idris to run an
225−IO action and extract the result. This result is then saved as a constant in
226−the compiled code. It can be a type, in which case it is used like any other
227−type, or it can be a value, in which case it can be used as any other value,
228−including as an index in types.
229−
230−Type providers are still an experimental extension. To enable the extension,
231−use the \texttt{\%language} directive:
232−
233−\begin{code}
234−%language TypeProviders
235−\end{code}
236−
237−A provider \texttt{p} for some type \texttt{t} is simply an expression of type
238−\texttt{IO (Provider t)}. The \texttt{\%provide} directive causes the type
239−checker to execute the action and bind the result to a name. This is perhaps
240−best illustrated with a simple example. The type provider \texttt{fromFile}
241−reads a text file. If the file consists of the string \texttt{"Int"}, then the
242−type \texttt{Int} will be provided. Otherwise, it will provide the type
243−\texttt{Nat}.
244−
245−\begin{code}
246−strToType : String -> Type
247−strToType "Int" = Int
248−strToType _ = Nat
249−
250−fromFile : String -> IO (Provider Type)
251−fromFile fname = do str <- readFile fname
252− return (Provide (strToType (trim str)))
253−\end{code}
254−
255−We then use the \texttt{\%provide} directive:
256−
257−\begin{code}
258−%provide (T1 : Type) with fromFile "theType"
259−
260−foo : T1
261−foo = 2
262−\end{code}
263−
264−\noindent
265−If the file named \texttt{theType} consists of the word \texttt{Int}, then
266−\texttt{foo} will be an \texttt{Int}. Otherwise, it will be a \texttt{Nat}.
267−When Idris encounters the directive, it first checks that the provider
268−expression \texttt{fromFile "theType"} has type \texttt{IO (Provider
269− Type)}. Next, it executes the provider. If the result is \texttt{Provide t},
270−then \texttt{T1} is defined as \texttt{t}. Otherwise, the result is an error.
271−
272−Our datatype \texttt{Provider t} has the following definition:
273−
274−\begin{code}
275−data Provider a = Error String
276− | Provide a
277−\end{code}
278−
279−\noindent
280−We have already seen the \texttt{Provide} constructor. The \texttt{Error}
281−constructor allows type providers to return useful error messages. The
282−example in this section was purposefully simple. More complex type provider
283−implementations, including a statically-checked SQLite binding, are available
284−in an external collection.\footnote{\url{https://github.com/david-christiansen/idris-type-providers}}
285−
286−\subsection{JavaScript Target}
287−
288−\Idris{} is capable of producing \emph{JavaScript} code that can be run in a browser
289−as well as in the \emph{NodeJS} environment or alike. One can use the FFI to
290−communicate with the \emph{JavaScript} ecosystem.
291−
292−\subsubsection*{Code Generation}
293−
294−\noindent
295−Code generation is split into two separate targets. To generate code that is
296−tailored for running in the browser issue the following command:
297−
298−\begin{lstlisting}[language=bash]
299−$ idris --codegen javascript hello.idr -o hello.js
300−\end{lstlisting}
301−
302−\noindent
303−The resulting file can be embedded into your HTML just like any other
304−\emph{JavaScript} code.
305−
306−\noindent
307−Generating code for \emph{NodeJS} is slightly different. \Idris{} outputs
308−a \emph{JavaScript} file that can be directly executed via \texttt{node}.
309−
310−\begin{lstlisting}[language=bash]
311−$ idris --codegen node hello.idr -o hello
312−$ ./hello
313−Hello world
314−\end{lstlisting}
315−
316−\noindent
317−Take into consideration that the \emph{JavaScript} code generator is using
318−\texttt{console.log} to write text to \texttt{stdout}, this means that it will
319−automatically add a newline to the end of each string. This behavior
320−does not show up in the \emph{NodeJS} code generator.
321−
322−\subsubsection*{Using the FFI}
323−
324−\noindent
325−To write a useful application we need to communicate with the outside
326−world. Maybe we want to manipulate the DOM or send an Ajax request. For this
327−task we can use the FFI. Since most \emph{JavaScript} APIs demand callbacks
328−we need to extend the FFI so we can pass functions as arguments.
329−
330−\noindent
331−The \emph{JavaScript} FFI works a little bit differently than the regular FFI.
332−It uses positional arguments to directly insert our arguments into a piece
333−of \emph{JavaScript} code.
334−
335−\noindent
336−One could use the primitive addition of \emph{JavaScript} like so:
337−
338−\begin{code}
339−module Main
340−
341−primPlus : Int -> Int -> IO Int
342−primPlus a b = mkForeign (FFun "%0 + %1" [FInt, FInt] FInt) a b
343−
344−main : IO ()
345−main = do
346− a <- primPlus 1 1
347− b <- primPlus 1 2
348− print (a, b)
349−\end{code}
350−
351−\noindent
352−Notice that the \texttt{\%n} notation qualifies the position of the
353−\texttt{n}-th argument given to our foreign function starting from 0. When
354−you need a percent sign rather than a position simply use \texttt{\%\%}
355−instead.
356−
357−\noindent
358−Passing functions to a foreign function is very similar. Let's assume that
359−we want to call the following function from the \emph{JavaScript} world:
360−
361−\begin{code}[language=c]
362−function twice(f, x) {
363− return f(f(x));
364−}
365−\end{code}
366−
367−\noindent
368−We obviously need to pass a function \texttt{f} here (we can infer it from
369−the way we use \texttt{f} in \texttt{twice}, it would be more obvious if
370−\emph{JavaScript} had types).
371−
372−\noindent
373−The \emph{JavaScript} FFI is able to understand functions as arguments when
374−you give it something of type \texttt{FFunction}. The following example code
375−calls \texttt{twice} in \emph{JavaScript} and returns the result to our
376−\Idris{} program:
377−
378−\begin{code}
379−module Main
380−
381−twice : (Int -> Int) -> Int -> IO Int
382−twice f x = mkForeign (
383− FFun "twice(%0,%1)" [FFunction FInt FInt, FInt] FInt
384−) f x
385−
386−main : IO ()
387−main = do
388− a <- twice (+1) 1
389− print a
390−\end{code}
391−
392−\noindent
393−The program outputs \texttt{3}, just like we expected.
394−
395−\subsubsection*{Shrinking down generated \emph{JavaScript}}
396−
397−\Idris{} can produce very big chunks of \emph{JavaScript} code. However, the
398−generated code can be minified using the \texttt{closure-compiler} from
399−Google. Any other minifier is also suitable but \texttt{closure-compiler}
400−offers advanced compilation that does some aggressive inlining and code
401−elimination. \Idris{} can take full advantage of this compilation mode and
402−it's highly recommended to use it when shipping a \emph{JavaScript}
403−application written in \Idris{}.
404−
405−\subsection{Cumulativity}
406−
407−Since values can appear in types and \emph{vice versa}, it is natural that types themselves
408−have types. For example:
409−
410−\begin{lstlisting}
411−*universe> :t Nat
412−Nat : Type
413−*universe> :t Vect
414−Vect : Nat -> Type -> Type
415−\end{lstlisting}
416−
417−\noindent
418−But what about the type of \texttt{Type}? If we ask \Idris{} it reports
419−
420−\begin{lstlisting}
421−*universe> :t Type
422−Type : Type 1
423−\end{lstlisting}
424−
425−\noindent
426−If \texttt{Type} were its own type, it would lead to an inconsitency
427−due to Girard's paradox~\cite{girard-thesis}, so internally there is a \emph{hierarchy}
428−of types (or \emph{universes}):
429−
430−\begin{code}
431−Type : Type 1 : Type 2 : Type 3 : ...
432−\end{code}
433−
434−\noindent
435−Universes are \emph{cumulative}, that is, if \texttt{x : Type n} we can also have that
436−\texttt{x : Type m}, as long as \texttt{n < m}.
437−The typechecker generates such universe
438−constraints and reports an error if any inconsistencies are found. Ordinarily, a
439−programmer does not need to worry about this, but it does prevent (contrived)
440−programs such as the following:
441−
442−\begin{code}
443−myid : (a : Type) -> a -> a
444−myid _ x = x
445−
446−idid : (a : Type) -> a -> a
447−idid = myid _ myid
448−\end{code}
449−
450−\noindent
451−The application of \texttt{myid} to itself leads to a cycle in the universe hierarchy
452−--- \texttt{myid}'s first argument is a \texttt{Type}, which cannot be at a lower level
453−than required if it is applied to itself.
454−
455−%\subsection{Comparison}
456−
457−%How does \Idris{} compare with other dependently typed languages and proof
458−%assistants, such as Coq, Agda and Epigram?
tutorial/content/modules.texdeleted−201
@@ -1,201 +0,0 @@
1−\section{Modules and Namespaces}
2−\label{sect:namespaces}
3−
4−An \Idris{} program consists of a collection of modules. Each module includes
5−an optional \texttt{module} declaration giving the name of the module, a
6−list of \texttt{import} statements giving the other modules which are to be imported,
7−and a collection of declarations and definitions of types, classes and functions.
8−For example, Figure \ref{bstmod} gives a module which defines a binary
9−tree type \texttt{BTree} (in a file \texttt{btree.idr}) and Figure
10−\ref{bstmain} gives a main program (in a file \texttt{bmain.idr} which uses the
11−\texttt{bst} module to sort a list.
12−
13−\begin{code}[caption={Binary Tree module}, label=bstmod]
14−module btree
15−
16−data BTree a = Leaf
17− | Node (BTree a) a (BTree a)
18−
19−insert : Ord a => a -> BTree a -> BTree a
20−insert x Leaf = Node Leaf x Leaf
21−insert x (Node l v r) = if (x < v) then (Node (insert x l) v r)
22− else (Node l v (insert x r))
23−
24−toList : BTree a -> List a
25−toList Leaf = []
26−toList (Node l v r) = toList l ++ (v :: toList r)
27−
28−toTree : Ord a => List a -> BTree a
29−toTree [] = Leaf
30−toTree (x :: xs) = insert x (toTree xs)
31−\end{code}
32−
33−\begin{code}[caption={Binary Tree main program},label=bstmain]
34−module Main
35−
36−import btree
37−
38−main : IO ()
39−main = do let t = toTree [1,8,2,7,9,3]
40− print (toList t)
41−\end{code}
42−
43−\noindent
44−The same names can be defined in multiple modules. This is possible because in practice names
45−are \emph{qualified} with the name of the module.
46−The names defined in the \texttt{btree} module are, in full:
47−
48−\begin{itemize}
49−\item \texttt{btree.BTree}, \texttt{btree.Leaf}, \texttt{btree.Node}, \texttt{btree.insert},
50−\texttt{btree.toList} and \texttt{btree.toTree}.
51−\end{itemize}
52−
53−\noindent
54−If names are otherwise unambiguous, there is no need to give the fully qualified name.
55−Names can be disambiguated either by giving an explicit qualification, or according to
56−their type.
57−
58−There is no formal link between the module name and its filename, although it
59−is generally advisable to use the same name for each. An \texttt{import}
60−statement refers to a filename, using dots to separate directories. For
61−example, \texttt{import foo.bar} would import the file \texttt{foo/bar.idr},
62−which would conventionally have the module declaration \texttt{module foo.bar}.
63−The only requirement for module names is that the main module, with the
64−\texttt{main} function, must be called \texttt{Main} (though its filename need
65−not be \texttt{Main.idr}).
66−
67−\subsection{Export Modifiers}
68−
69−By default, all names defined in a module are exported for use by other modules.
70−However, it is good practice only to export a minimal interface and keep internal
71−details abstract. \Idris{} allows functions, types and classes to be marked
72−as \texttt{public}, \texttt{abstract} or \texttt{private}:
73−
74−\begin{itemize}
75−\item \texttt{public} means that both the name and definition are exported.
76−For functions, this means that the implementation is exported (which means, for example,
77−it can be used in a dependent type). For data types, this means that the type name and
78−the constructors are exported. For classes, this means that the class name and
79−method names are exported.
80−\item \texttt{abstract} means that only the name is exported. For functions, this means
81−that the implementation is not exported. For data types, this means that the type name
82−is exported but not the constructors. For classes, this means that the class name is exported
83−but not the method names.
84−\item \texttt{private} means that neither the name nor the definition is exported.
85−\end{itemize}
86−
87−\noindent
88−If any definition is given an export modifier, then all names with no modifier are assumed
89−to be \texttt{private}. For our \texttt{btree} module, it makes sense for the
90−tree data type and the functions to be exported as \texttt{abstract}, as we see in
91−Figure \ref{bstmodp}.
92−
93−\begin{code}[caption={Binary Tree module, with export modifiers}, label=bstmodp]
94−module btree
95−
96−abstract data BTree a = Leaf
97− | Node (BTree a) a (BTree a)
98−
99−abstract
100−insert : Ord a => a -> BTree a -> BTree a
101−insert x Leaf = Node Leaf x Leaf
102−insert x (Node l v r) = if (x < v) then (Node (insert x l) v r)
103− else (Node l v (insert x r))
104−
105−abstract
106−toList : BTree a -> List a
107−toList Leaf = []
108−toList (Node l v r) = app (toList l) (v :: toList r)
109−
110−abstract
111−toTree : Ord a => List a -> BTree a
112−toTree [] = Leaf
113−toTree (x :: xs) = insert x (toTree xs)
114−\end{code}
115−
116−\noindent
117−Finally, the default export mode can be changed with the \texttt{\%access} directive,
118−for example:
119−
120−\begin{code}
121−%access abstract
122−\end{code}
123−
124−\noindent
125−In this case, any function with no access modifier will be exported as \texttt{abstract},
126−rather than left \texttt{private}.
127−
128−\subsection{Explicit Namespaces}
129−
130−Defining a module also defines a namespace implicitly. However, namespaces can also
131−be given \emph{explicitly}. This is most useful if you wish to overload names within
132−the same module:
133−
134−\begin{code}
135−module foo
136−
137−namespace x
138− test : Int -> Int
139− test x = x * 2
140−
141−namespace y
142− test : String -> String
143− test x = x ++ x
144−\end{code}
145−
146−\noindent
147−This (admittedly contrived) module defines two functions with fully qualified names
148−\texttt{foo.x.test} and \texttt{foo.y.test}, which can be disambiguated by their
149−types:
150−
151−\begin{lstlisting}
152−*foo> test 3
153−6 : Int
154−*foo> test "foo"
155−"foofoo" : String
156−\end{lstlisting}
157−
158−\subsection{Parameterised blocks}
159−
160−Groups of functions can be parameterised over a number of arguments using a
161−\texttt{parameters} declaration, for example:
162−
163−\begin{code}
164−parameters (x : Nat, y : Nat)
165− addAll : Nat -> Nat
166− addAll z = x + y + z
167−\end{code}
168−
169−\noindent
170−The effect of a \texttt{parameters} block is to add the declared parameters to every
171−function, type and data constructor within the block. Outside the block, the parameters
172−must be given explicitly:
173−
174−\begin{lstlisting}
175−*params> :t addAll
176−addAll : Nat -> Nat -> Nat -> Nat
177−\end{lstlisting}
178−
179−\noindent
180−Parameters blocks can be nested, and can also include data declarations, in
181−which case the parameters are added explicitly to all type and data
182−constructors. They may also be dependent types with implicit arguments:
183−
184−\begin{code}
185−parameters (xs : Vect x a, y : Nat)
186− data Vects : Type -> Type where
187− MkVects : Vect a y -> Vects a
188−
189− append : Vects a -> Vect (x + y) a
190− append (MkVects ys) = xs ++ ys
191−\end{code}
192−
193−\noindent
194−To use \texttt{Vects} or \texttt{append} outside the block, we must also
195−give the \texttt{xs} and \texttt{y} arguments. Here, we can use placeholders for
196−the values which can be inferred by the type checker:
197−
198−\begin{lstlisting}
199−*params> show (append _ _ (MkVects [1,2,3] _ [4,5,6]))
200−"[1, 2, 3, 4, 5, 6]" : String
201−\end{lstlisting}
tutorial/content/provisional.texdeleted−284
@@ -1,284 +0,0 @@
1−\section{Provisional Definitions}
2−
3−\label{sect:provisional}
4−
5−Sometimes when programming with dependent types, the type required by the type
6−checker and the type of the program we have written will be different (in that
7−they do not have the same normal form), but nevertheless provably equal. For
8−example, recall the \texttt{parity} function:
9−
10−\begin{code}
11−data Parity : Nat -> Type where
12− even : Parity (n + n)
13− odd : Parity (S (n + n))
14−
15−parity : (n:Nat) -> Parity n
16−\end{code}
17−
18−\noindent
19−We'd like to implement this as follows:
20−
21−\begin{code}
22−parity : (n:Nat) -> Parity n
23−parity Z = even {n=Z}
24−parity (S Z) = odd {n=Z}
25−parity (S (S k)) with (parity k)
26− parity (S (S (j + j))) | even = even {n=S j}
27− parity (S (S (S (j + j)))) | odd = odd {n=S j}
28−\end{code}
29−
30−\noindent
31−This simply states that zero is even, one is odd, and recursively, the parity
32−of \texttt{k+2} is the same as the parity of \texttt{k}.
33−Explicitly marking the value of \texttt{n} in
34−even and odd is necessary to help type inference. Unfortunately, the type
35−checker rejects this:
36−
37−\begin{code}
38−views.idr:12:Can't unify Parity (plus (S j) (S j)) with
39−Parity (S (S (plus j j)))
40−\end{code}
41−
42−\noindent
43−The type checker
44−is telling us that \texttt{(j+1)+(j+1)} and \texttt{2+j+j}
45−do not normalise to the same value.
46−This is because \texttt{plus} is defined by recursion on its first argument, and in the
47−second value, there is a successor symbol on the second argument, so this will
48−not help with reduction. These values are obviously equal --- how can we rewrite the program to fix this problem?
49−
50−\subsection{Provisional definitions}
51−
52−\emph{Provisional definitions} help with this problem by allowing us to defer the
53−proof details until a later point. There are two main reasons why they are
54−useful.
55−
56−\begin{itemize}
57−\item When \emph{prototyping}, it is useful to be able to test programs before
58−finishing all the details of proofs.
59−\item When \emph{reading} a program, it is often much clearer to defer the proof
60−details so that they do not distract the reader from the underlying algorithm.
61−\end{itemize}
62−
63−\noindent
64−Provisional definitions are written in the same way as ordinary definitions,
65−except that they introduce the right hand side with a \texttt{?=} rathar than
66−\texttt{=}. We define
67−\texttt{parity} as follows:
68−
69−\begin{code}
70−parity : (n:Nat) -> Parity n
71−parity Z = even {n=Z}
72−parity (S Z) = odd {n=Z}
73−parity (S (S k)) with (parity k)
74− parity (S (S (j + j))) | even ?= even {n=S j}
75− parity (S (S (S (j + j)))) | odd ?= odd {n=S j}
76−\end{code}
77−
78−\noindent
79−When written in this form, instead of reporting a type error, \Idris{} will insert
80−a metavariable standing for a theorem which will correct the type error. \Idris{}
81−tells us we have two proof obligations, with names generated from the module and
82−function names:
83−
84−\begin{lstlisting}
85−*views> :m
86−Global metavariables:
87− [views.parity_lemma_2,views.parity_lemma_1]
88−\end{lstlisting}
89−
90−\noindent
91−The first of these has the following type:
92−
93−\begin{lstlisting}
94−*views> :p views.parity_lemma_1
95−
96−---------------------------------- (views.parity_lemma_1) --------
97−{hole0} : (j : Nat) -> (Parity (plus (S j) (S j))) -> Parity (S (S (j + j)))
98−
99−-views.parity_lemma_1>
100−\end{lstlisting}
101−
102−\noindent
103−The two arguments are \texttt{j}, the variable in scope from the pattern match,
104−and \texttt{value}, which is the value we gave in the right hand side of the
105−provisional definition. Our goal is to rewrite the type so that we can use
106−this value.
107−We can achieve this using the following theorem from
108−the prelude:
109−
110−\begin{code}
111−plusSuccRightSucc : (left : Nat) -> (right : Nat) ->
112− S (left + right) = left + (S right)
113−\end{code}
114−
115−\noindent
116−After applying \texttt{intro} twice, we have:
117−
118−\begin{lstlisting}
119−-views.parity_lemma_1> intro
120−
121− j : Nat
122− value : Parity (S (plus j (S j)))
123−---------------------------------- (views.parity_lemma_1) --------
124−{hole2} : Parity (S (S (j + j)))
125−\end{lstlisting}
126−
127−\noindent
128−We need to use \texttt{compute} again to unfold the definition of \texttt{(+)}.
129−
130−\begin{lstlisting}
131−-views.parity_lemma_1> intro
132−
133− j : Nat
134− value : Parity (S (plus j (S j)))
135−---------------------------------- (views.parity_lemma_1) --------
136−{hole2} : Parity (S (S (plus j j)))
137−\end{lstlisting}
138−
139−\noindent
140−Then we apply the \texttt{plusSuccRightSucc} rewrite rule, symmetrically,
141−to \texttt{j} and \texttt{j}, giving:
142−
143−\begin{lstlisting}
144−-views.parity_lemma_1> rewrite sym (plusSuccRightSucc j j)
145−
146− j : Nat
147− value : Parity (S (plus j (S j)))
148−---------------------------------- (views.parity_lemma_1) --------
149−{hole3} : Parity (S (plus j (S j)))
150−\end{lstlisting}
151−
152−\noindent
153−\texttt{sym} is a function, defined in the library, which reverses the order of the rewrite:
154−
155−\begin{lstlisting}
156−sym : l = r -> r = l
157−sym refl = refl
158−\end{lstlisting}
159−
160−\noindent
161−We can complete this proof using the \texttt{trivial} tactic, which finds
162−\texttt{value} in the premisses. The proof of the second lemma proceeds in
163−exactly the same way.
164−
165−We can now test the \texttt{natToBin} function from Section
166−\ref{sect:nattobin} at the prompt. 42 is 101010 in
167−binary. The binary digits are reversed:
168−
169−\begin{lstlisting}
170−*views> show (natToBin 42)
171−"[False, True, False, True, False, True]" : String
172−\end{lstlisting}
173−
174−
175−\subsection{Suspension of Disbelief}
176−
177−\Idris{} requires that proofs be complete before compiling programs (although
178−evaluation at the prompt is possible without proof details). Sometimes,
179−especially when prototyping, it is easier not to have to do this. It might even
180−be beneficial to test programs before attempting to prove things about them ---
181−if testing finds an error, you know you had better not waste your time proving
182−something!
183−
184−Therefore, \Idris{} provides a built-in coercion function, which allows you to use
185−a value of the incorrect types:
186−
187−\begin{code}
188−believe_me : a -> b
189−\end{code}
190−
191−\noindent
192−Obviously, this should be used with extreme caution. It is useful when prototyping, and
193−can also be appropriate when asserting properties of external code (perhaps in an
194−external C library). The ``proof'' of \texttt{views.parity\_lemma\_1} using this is:
195−
196−\begin{lstlisting}
197−views.parity_lemma_2 = proof {
198− intro;
199− intro;
200− exact believe_me value;
201−}
202−\end{lstlisting}
203−
204−\noindent
205−The \texttt{exact} tactic allows us to provide an exact value for the proof. In this case,
206−we assert that the value we gave was correct.
207−
208−\subsection{Example: Binary numbers}
209−
210−Previously, we implemented conversion to binary numbers using the \texttt{Parity} view.
211−Here, we show how to use the same view to implement a verified conversion to
212−binary.
213−We begin by indexing binary numbers over their \texttt{Nat} equivalent. This is a common
214−pattern, linking a representation (in this case \texttt{Binary}) with a meaning (in this
215−case \texttt{Nat}):
216−
217−\begin{code}
218−data Binary : Nat -> Type where
219− bEnd : Binary Z
220− bO : Binary n -> Binary (n + n)
221− bI : Binary n -> Binary (S (n + n))
222−\end{code}
223−
224−\noindent
225−\texttt{bO} and \texttt{bI} take a binary number as an argument and effectively shift it one bit
226−left, adding either a zero or one as the new least significant bit. The index,
227−\texttt{n + n} or \texttt{S (n + n)} states the result that this left shift then add will
228−have to the meaning of the number. This will result in a representation with
229−the least significant bit at the front.
230−
231−Now a function which converts a Nat to binary will state, in the type, that the
232−resulting binary number is a faithful representation of the original Nat:
233−
234−\begin{code}
235−natToBin : (n:Nat) -> Binary n
236−\end{code}
237−
238−\noindent
239−The \texttt{Parity} view makes the definition fairly simple --- halving the
240−number is effectively a right shift after all --- although we need to use a
241−provisional definition in the odd case:
242−
243−\begin{code}
244−natToBin : (n:Nat) -> Binary n
245−natToBin Z = bEnd
246−natToBin (S k) with (parity k)
247− natToBin (S (j + j)) | even = bI (natToBin j)
248− natToBin (S (S (j + j))) | odd ?= bO (natToBin (S j))
249−\end{code}
250−
251−\noindent
252−The problem with the odd case is the same as in the definition of \texttt{parity}, and
253−the proof proceeds in the same way:
254−
255−\begin{code}
256−natToBin_lemma_1 = proof {
257− intro;
258− intro;
259− rewrite sym (plusSuccRightSucc j j);
260− trivial;
261−}
262−\end{code}
263−
264−\noindent
265−To finish, we'll implement a main program which reads an integer from the user and
266−outputs it in binary.
267−
268−\begin{code}
269−main : IO ()
270−main = do putStr "Enter a number: "
271− x <- getLine
272− print (natToBin (fromInteger (cast x)))
273−\end{code}
274−
275−\noindent
276−For this to work, of course, we need a \texttt{Show} instance for \texttt{Binary n}:
277−
278−\begin{code}
279−instance Show (Binary n) where
280− show (bO x) = show x ++ "0"
281− show (bI x) = show x ++ "1"
282− show bEnd = ""
283−\end{code}
284−
tutorial/content/starting.texdeleted−145
@@ -1,145 +0,0 @@
1−\section{Getting Started}
2−
3−\subsection{Prerequisites}
4−
5−Before installing \Idris{}, you will need to make sure you have all of the necessary
6−libraries and tools. You will need:
7−
8−\begin{itemize}
9−\item A fairly recent Haskell platform. Version 2010.1.0.0.1 is currently
10−sufficiently recent.
11−\item The GNU multiprecision arithmetic library, GMP, available from MacPorts and
12−all major Linux distributions.
13−\end{itemize}
14−
15−\subsection{Downloading and Installing}
16−
17−The easiest way to install \Idris{}, if you have all of the prerequisites, is to type:
18−
19−\begin{lstlisting}[language=bash]
20−cabal update; cabal install idris
21−\end{lstlisting}
22−
23−\noindent
24−This will install the latest version released on Hackage, along with any dependencies.
25−If, however, you would like the most up
26−to date development version, you can find it on GitHub at
27−\url{https://github.com/edwinb/Idris-dev}.
28−
29−To check that installation has succeeded, and to write your first \Idris{}
30−program, create a file called ``\texttt{hello.idr}'' containing the following
31−text:
32−
33−\begin{code}
34−module Main
35−
36−main : IO ()
37−main = putStrLn "Hello world"
38−\end{code}
39−
40−\noindent
41−If you are familiar with Haskell, it should be fairly clear what the program is doing
42−and how it works, but if not, we will explain the details later.
43−You can compile the program to an executable by entering \texttt{idris hello.idr -o hello}
44−at the shell prompt. This will create an executable called \texttt{hello}, which you can run:
45−
46−\begin{lstlisting}[language=bash]
47−$ idris hello.idr -o hello
48−$ ./hello
49−Hello world
50−\end{lstlisting}
51−
52−\noindent
53−Note that the \texttt{\$} indicates the shell prompt! Some useful options to the
54−\texttt{idris} command are:
55−
56−\begin{itemize}
57−\item \texttt{-o prog} to compile to an executable called \texttt{prog}.
58−\item \texttt{--check} type check the file and its dependencies without starting the
59−interactive environment.
60−\item \texttt{--help} display usage summary and command line options
61−\end{itemize}
62−
63−\subsection{The interactive environment}
64−
65−Entering \texttt{idris} at the shell prompt starts up the interactive
66−environment. You should see something like the following:
67−
68−\begin{lstlisting}[escapechar=^]
69−$ idris
70− ____ __ _
71− / _/___/ /____(_)____
72− / // __ / ___/ / ___/ Version ^\version{}^
73− _/ // /_/ / / / (__ ) http://www.idris-lang.org/
74− /___/\__,_/_/ /_/____/ Type :? for help
75−
76−Idris>
77−\end{lstlisting}
78−
79−\noindent
80−This gives a \texttt{ghci}-style interface which allows evaluation of expressions,
81−as well as type checking expressions, theorem proving, compilation, editing
82−and various other operations. \texttt{:?} gives a list of supported commands,
83−as shown in Figure \ref{cmds}. Figure \ref{run1} shows an example run in which
84−\texttt{hello.idr} is loaded, the type of \texttt{main} is checked and then
85−the program is compiled to the executable \texttt{hello}.
86−
87−\begin{lstlisting}[caption={Interactive environment commands}, label=cmds, escapechar=^]
88−Idris version ^\version{}^
89−--------------------
90−
91− Command Arguments Purpose
92−
93− <expr> Evaluate an expression
94− :t <expr> Check the type of an expression
95− :miss :missing <name> Show missing clauses
96− :i :info <name> Display information about a type class
97− :total <name> Check the totality of a name
98− :r :reload Reload current file
99− :l :load <filename> Load a new file
100− :cd <filename> Change working directory
101− :m :module <module> Import an extra module
102− :e :edit Edit current file using $EDITOR or $VISUAL
103− :m :metavars <metavar> Show remaining proof obligations (metavariables)
104− :p :prove <metavar> Prove a metavariable
105− :a :addproof <name> Add proof to source file
106− :rmproof <name> Remove proof from proof stack
107− :showproof <name> Show proof
108− :proofs Show available proofs
109− :x <expr> Execute IO actions resulting from an expression
110− using the interpreter
111− :c :compile <filename> Compile to an executable <filename>
112− :js :javascript <filename> Compile to JavaScript <filename>
113− :exec :execute Compile to an executable and run
114− :dynamic <filename> Dynamically load a C library (similar to %dynamic)
115− :dynamic List dynamically loaded C libraries
116− :? :h :help Display this help text
117− :set <option> Set an option (errorcontext, showimplicits)
118− :unset <option> Unset an option
119− :colour :color <option> Turn REPL colours on or off; set a specific colour
120− :q :quit Exit the Idris system
121−\end{lstlisting}
122−
123−\begin{lstlisting}[caption={Sample Interactive Run}, label=run1, escapechar=^]
124−$ idris hello.idr
125− ____ __ _
126− / _/___/ /____(_)____
127− / // __ / ___/ / ___/ Version ^\version{}^
128− _/ // /_/ / / / (__ ) http://www.idris-lang.org/
129− /___/\__,_/_/ /_/____/ Type :? for help
130−
131−Type checking ./hello.idr
132−*hello> :t main
133−main : IO ()
134−*hello> :c hello
135−*hello> :q
136−Bye bye
137−$ ./hello
138−Hello world
139−\end{lstlisting}
140−
141−\noindent
142−Type checking a file, if successful, creates a bytecode version of the file (in
143−this case \texttt{hello.ibc}) to speed up loading in future. The bytecode is
144−regenerated if the source file changes.
145−
tutorial/content/syntax.texdeleted−104
@@ -1,104 +0,0 @@
1−\section{Syntax Extensions}
2−
3−\Idris{} supports the implementation of Embedded Domain Specific Languages (EDSLs) in
4−several ways~\cite{res-dsl-padl12}. One way, as we have already seen, is through
5−extending \texttt{do} notation. Another important way is to allow extension of the core
6−syntax. In this section we describe two ways of extending the syntax: \texttt{syntax}
7−rules and \texttt{dsl} notation.
8−
9−\subsection{\texttt{syntax} rules}
10−
11−We have seen \texttt{if...then...else} expressions, but these
12−are not built in --- instead, we define a function in the prelude\ldots
13−
14−\begin{code}
15−boolElim : (x:Bool) -> |(t : a) -> |(f : a) -> a;
16−boolElim True t e = t;
17−boolElim False t e = e;
18−\end{code}
19−
20−\noindent
21−\ldots and extend the core syntax with a \texttt{syntax} declaration:
22−
23−\begin{code}
24−syntax if [test] then [t] else [e] = boolElim test t e;
25−\end{code}
26−
27−\noindent
28−The left hand side of a \texttt{syntax} declaration describes the syntax rule, and the right
29−hand side describes its expansion. The syntax rule itself consists of:
30−
31−\begin{itemize}
32−\item \textbf{Keywords} --- here, \texttt{if}, \texttt{then} and \texttt{else}, which must
33−be valid identifiers
34−\item \textbf{Non-terminals} --- included in square brackets, \texttt{[test]}, \texttt{[t]}
35−and \texttt{[e]} here, which stand for arbitrary expressions. To avoid parsing ambiguities,
36−these expressions cannot use syntax extensions at the top level (though they can be used
37−in parentheses).
38−\item \textbf{Names} --- included in braces, which stand for names which may be bound
39−on the right hand side.
40−\item \textbf{Symbols} --- included in quotations marks, e.g. \texttt{":="}. This can
41−also be used to include reserved words in syntax rules, such as \texttt{"let"} or \texttt{"in"}.
42−\end{itemize}
43−
44−\noindent
45−The limitations on the form of a syntax rule are that it must include at least
46−one symbol or keyword, and there must be no repeated variables standing for
47−non-terminals. Any expression can be used, but if there are two non-terminals
48−in a row in a rule, only simple expressions may be used (that is, variables,
49−constants, or bracketed expressions). Rules can use previously defined rules,
50−but may not be recursive. The following syntax extensions would therefore be
51−valid:
52−
53−\begin{code}
54−syntax [var] ":=" [val] = Assign var val;
55−syntax [test] "?" [t] ":" [e] = if test then t else e;
56−syntax select [x] from [t] where [w] = SelectWhere x t w;
57−syntax select [x] from [t] = Select x t;
58−\end{code}
59−
60−\noindent
61−Syntax macros can be further restricted to apply only in patterns (i.e., only on the left
62−hand side of a pattern match clause) or only in terms (i.e. everywhere but the left hand side
63−of a pattern match clause) by being marked as \texttt{pattern} or \texttt{term} syntax
64−rules. For example, we might define an interval as follows, with a static check
65−that the lower bound is below the upper bound using \texttt{so}:
66−
67−\begin{code}
68−data Interval : Type where
69− MkInterval : (lower : Float) -> (upper : Float) ->
70− so (lower < upper) -> Interval
71−\end{code}
72−
73−\noindent
74−We can define a syntax which, in patterns, always matches \texttt{oh} for the proof
75−argument, and in terms requires a proof term to be provided:
76−
77−\begin{code}
78−pattern syntax "[" [x] "..." [y] "]" = MkInterval x y oh
79−term syntax "[" [x] "..." [y] "]" = MkInterval x y ?bounds_lemma
80−\end{code}
81−
82−\noindent
83−In terms, the syntax \texttt{[x...y]} will generate a proof obligation
84−\texttt{bounds\_lemma} (possibly renamed).
85−
86−Finally, syntax rules may be used to introduce alternative binding forms. For
87−exampe, a \texttt{for} loop binds a variable on each iteration:
88−
89−\begin{code}
90−syntax for {x} "in" [xs] ":" [body] = forLoop xs (\x => body)
91−
92−main : IO ()
93−main = do for x in [1..10]:
94− putStrLn ("Number " ++ show x)
95− putStrLn "Done!"
96−\end{code}
97−
98−\noindent
99−Note that we have used the \texttt{\{x\}} form to state that \texttt{x} represents
100−a bound variable, substituted on the right hand side. We have also put \texttt{"in"} in
101−quotation marks since it is already a reserved word.
102−
103−\input{./content/dsl}
104−
tutorial/content/theorems.texdeleted−377
@@ -1,377 +0,0 @@
1−\section{Theorem Proving}
2−
3−\subsection{Equality}
4−
5−\Idris{} allows propositional equalities to be declared, allowing theorems about
6−programs to be stated and proved. Equality is built in, but conceptually has
7−the following definition:
8−
9−\begin{code}
10−data (=) : a -> b -> Type where
11− refl : x = x
12−\end{code}
13−
14−\noindent
15−Equalities can be proposed between any values of any types, but the only way to
16−construct a proof of equality is if values actually are equal. For example:
17−
18−\begin{code}
19−fiveIsFive : 5 = 5
20−fiveIsFive = refl
21−
22−twoPlusTwo : 2 + 2 = 4
23−twoPlusTwo = refl
24−\end{code}
25−
26−\subsection{The Empty Type}
27−
28−\label{sect:empty}
29−
30−There is an empty type, \texttt{\_|\_}, which has no constructors. It is
31−therefore impossible to construct an element of the empty type, at least
32−without using a partially defined or general recursive function (see Section
33−\ref{sect:totality} for more details). We can therefore use the empty type
34−to prove that something is impossible, for example zero is never equal
35−to a successor:
36−
37−\begin{code}
38−disjoint : (n : Nat) -> Z = S n -> _|_
39−disjoint n p = replace {P = disjointTy} p ()
40− where
41− disjointTy : Nat -> Type
42− disjointTy Z = ()
43− disjointTy (S k) = _|_
44−\end{code}
45−
46−\noindent
47−There is no need to worry too much about how this function works --- essentially,
48−it applies the library function \texttt{replace}, which uses an equality proof to
49−transform a predicate. Here we use it to transform a value of a type which can exist,
50−the empty tuple, to a value of a type which can't, by using a proof of something which can't exist.
51−
52−Once we have an element of the empty type, we can prove anything. \texttt{FalseElim}
53−is defined in the library, to assist with proofs by contradiction.
54−
55−\begin{code}
56−FalseElim : _|_ -> a
57−\end{code}
58−
59−\subsection{Simple Theorems}
60−
61−When type checking dependent types, the type itself gets \emph{normalised}. So imagine
62−we want to prove the following theorem about the reduction behaviour of \texttt{plus}:
63−
64−\begin{code}
65−plusReduces : (n:Nat) -> plus Z n = n
66−\end{code}
67−
68−\noindent
69−We've written down the statement of the theorem as a type, in just the same way
70−as we would write the type of a program. In fact there is no real distinction
71−between proofs and programs. A proof, as far as we are concerned here, is
72−merely a program with a precise enough type to guarantee a particular property
73−of interest.
74−
75−We won't go into details here, but the Curry-Howard
76−correspondence~\cite{howard} explains this relationship.
77−The proof itself is trivial, because \texttt{plus Z n} normalises to \texttt{n}
78−by the definition of \texttt{plus}:
79−
80−\begin{code}
81−plusReduces n = refl
82−\end{code}
83−
84−\noindent
85−It is slightly harder if we try the arguments the other way, because plus is
86−defined by recursion on its first argument. The proof also works by recursion
87−on the first argument to \texttt{plus}, namely \texttt{n}.
88−
89−\begin{code}
90−plusReducesZ : (n:Nat) -> n = plus n Z
91−plusReducesZ Z = refl
92−plusReducesZ (S k) = cong (plusReducesZ k)
93−\end{code}
94−
95−\noindent
96−\texttt{cong} is a function defined in the library which states that
97−equality respects function application:
98−
99−\begin{code}
100−cong : {f : t -> u} -> a = b -> f a = f b
101−\end{code}
102−
103−\noindent
104−We can do the same for the reduction behaviour of plus on successors:
105−
106−\begin{code}
107−plusReducesS : (n:Nat) -> (m:Nat) -> S (plus n m) = plus n (S m)
108−plusReducesS Z m = refl
109−plusReducesS (S k) m = cong (plusReducesS k m)
110−\end{code}
111−
112−\noindent
113−Even for trival theorems like these, the proofs are a little tricky to
114−construct in one go. When things get even slightly more complicated, it becomes
115−too much to think about to construct proofs in this 'batch mode'. \Idris{}
116−therefore provides an interactive proof mode.
117−
118−\subsection{Interactive theorem proving}
119−
120−Instead of writing the proof in one go, we can use \Idris{}'s interactive
121−proof mode. To do this, we write the general \emph{structure} of the proof,
122−and use the interactive mode to complete the details. We'll be constructing
123−the proof by \emph{induction}, so we write the cases for \texttt{Z} and
124−\texttt{S}, with a recursive call in the \texttt{S} case giving the inductive
125−hypothesis, and insert \emph{metavariables} for the rest of the definition:
126−
127−\begin{code}
128−plusReducesZ' : (n:Nat) -> n = plus n Z
129−plusReducesZ' Z = ?plusredZ_Z
130−plusReducesZ' (S k) = let ih = plusReducesZ' k in
131− ?plusredZ_S
132−\end{code}
133−
134−\noindent
135−On running \Idris{}, two global names are created, \texttt{plusredZ\_O} and
136−\texttt{plusredZ\_S}, with no definition. We can use the \texttt{:m} command
137−at the prompt to find out which metavariables are still to be solved (or, more
138−precisely, which functions exist but have no definitions), then the
139−\texttt{:t} command to see their types:
140−
141−\begin{lstlisting}
142−*theorems> :m
143−Global metavariables:
144− [plusredZ_S,plusredZ_Z]
145−
146−\end{lstlisting}
147−
148−\begin{lstlisting}
149−*theorems> :t plusredZ_Z
150−plusredZ_Z : Z = plus Z Z
151−
152−*theorems> :t plusredZ_S
153−plusredZ_S : (k : Nat) -> (k = plus k Z) -> S k = plus (S k) Z
154−\end{lstlisting}
155−
156−\noindent
157−The \texttt{:p} command enters interactive proof mode, which can be used to complete
158−the missing definitions.
159−
160−\begin{lstlisting}
161−*theorems> :p plusredZ_Z
162−
163−---------------------------------- (plusredZ_Z) --------
164−{hole0} : Z = plus Z Z
165−\end{lstlisting}
166−
167−\noindent
168−This gives us a list of premisses
169−(above the line; there are none here) and the current goal (below the line;
170−named \texttt{\{hole0\}} here).
171−At the prompt we can enter tactics to direct the construction of the proof. In this case,
172−we can normalise the goal with the \texttt{compute} tactic:
173−
174−\begin{lstlisting}
175−-plusredZ_Z> compute
176−
177−---------------------------------- (plusredZ_Z) --------
178−{hole0} : Z = Z
179−\end{lstlisting}
180−
181−\noindent
182−Now we have to prove that \texttt{Z} equals \texttt{Z}, which is easy to prove by
183−\texttt{refl}. To apply a function, such as \texttt{refl}, we use \texttt{refine}
184−which introduces subgoals for each of the function's explicit arguments (\texttt{refl}
185−has none):
186−
187−\begin{lstlisting}
188−-plusredZ_Z> refine refl
189−plusredZ_Z: no more goals
190−\end{lstlisting}
191−
192−\noindent
193−Here, we could also have used the \texttt{trivial} tactic, which tries to refine by
194−\texttt{refl}, and if that fails, tries to refine by each name in the local context.
195−When a proof is complete, we use the \texttt{qed} tactic to add the proof to the
196−global context, and remove the metavariable from the unsolved metavariables list.
197−This also outputs a trace of the proof:
198−
199−\begin{code}
200−-plusredZ_Z> qed
201−plusredZ_Z = proof {
202− compute;
203− refine refl;
204−}
205−\end{code}
206−
207−\begin{lstlisting}
208−*theorems> :m
209−Global metavariables:
210− [plusredZ_S]
211−\end{lstlisting}
212−
213−\noindent
214−The \texttt{:addproof} command, at the interactive prompt, will add the proof to
215−the source file (effectively in an appendix).
216−Let us now prove the other required lemma, \texttt{plusredZ\_S}:
217−
218−\begin{lstlisting}
219−*theorems> :p plusredZ_S
220−
221−---------------------------------- (plusredZ_S) --------
222−{hole0} : (k : Nat) -> (k = plus k Z) -> S k = plus (S k) Z
223−\end{lstlisting}
224−
225−\noindent
226−In this case, the goal is a function type, using \texttt{k} (the argument accessible by
227−pattern matching) and \texttt{ih} (the local variable containing the result of
228−the recursive call). We can introduce these as premisses using the \texttt{intro} tactic
229−twice (or \texttt{intros}, which introduces all arguments as premisses). This gives:
230−
231−\begin{lstlisting}
232− k : Nat
233− ih : k = plus k Z
234−---------------------------------- (plusredZ_S) --------
235−{hole2} : S k = plus (S k) Z
236−\end{lstlisting}
237−
238−\noindent
239−Since plus is defined is defined by recursion on its first argument, the term
240−\texttt{plus (S k) Z} in the goal can be simplified, so we use
241−\texttt{compute}.
242−
243−\begin{lstlisting}
244− k : Nat
245− ih : k = plus k Z
246−---------------------------------- (plusredZ_S) --------
247−{hole2} : S k = S (plus k Z)
248−\end{lstlisting}
249−
250−\noindent
251−We know, from the type of \texttt{ih}, that \texttt{k = plus k Z}, so we would like to
252−use this knowledge to replace \texttt{plus k Z} in the goal with \texttt{k}. We can
253−achieve this with the \texttt{rewrite} tactic:
254−
255−\begin{lstlisting}
256−-plusredZ_S> rewrite ih
257−
258− k : Nat
259− ih : k = plus k Z
260−---------------------------------- (plusredZ_S) --------
261−{hole3} : S k = S k
262−
263−-plusredZ_S>
264−\end{lstlisting}
265−
266−\noindent
267−The \texttt{rewrite} tactic takes an equality proof as an argument, and tries to rewrite
268−the goal using that proof. Here, it results in an equality which is trivially provable:
269−
270−\begin{lstlisting}
271−-plusredZ_S> trivial
272−plusredZ_S: no more goals
273−-plusredZ_S> qed
274−plusredZ_S = proof {
275− intros;
276− rewrite ih;
277− trivial;
278−}
279−\end{lstlisting}
280−
281−\noindent
282−Again, we can add this proof to the end of our source file using the \texttt{:addproof}
283−command at the interactive prompt.
284−
285−\subsection{Totality Checking}
286−
287−\label{sect:totality}
288−
289−If we really want to trust our proofs, it is important that they are defined by
290−\emph{total} functions --- that is, a function which is defined for all
291−possible inputs and is guaranteed to terminate. Otherwise we could construct an
292−element of the empty type, from which we could prove anything:
293−
294−\begin{code}
295−-- making use of 'hd' being partially defined
296−empty1 : _|_
297−empty1 = hd [] where
298− hd : List a -> a
299− hd (x :: xs) = x
300−
301−-- not terminating
302−empty2 : _|_
303−empty2 = empty2
304−\end{code}
305−
306−\noindent
307−Internally, \Idris{} checks every definition for totality, and we can check at
308−the prompt with the \texttt{:total} command. We see that neither of the above
309−definitions is total:
310−
311−\begin{lstlisting}
312−*theorems> :total empty1
313−possibly not total due to: empty1#hd
314− not total as there are missing cases
315−*theorems> :total empty2
316−possibly not total due to recursive path empty2
317−\end{lstlisting}
318−
319−\noindent
320−Note the use of the word ``possibly'' --- a totality check can, of course,
321−never be certain due to the undecidability of the halting problem. The check
322−is, therefore, conservative. It is also possible (and indeed advisable, in the
323−case of proofs) to mark functions as total so that it will be a compile time
324−error for the totality check to fail:
325−
326−\begin{lstlisting}
327−total empty2 : _|_
328−empty2 = empty2
329−
330−Type checking ./theorems.idr
331−theorems.idr:25:empty2 is possibly not total due to recursive path empty2
332−\end{lstlisting}
333−
334−\noindent
335−Reassuringly, our proof in Section \ref{sect:empty} that the zero and successor constructors
336−are disjoint is total:
337−
338−\begin{lstlisting}
339−*theorems> :total disjoint
340−Total
341−\end{lstlisting}
342−
343−\noindent
344−The totality check is, necessarily, conservative. To be recorded as total, a
345−function \texttt{f} must:
346−
347−\begin{itemize}
348−\item Cover all possible inputs
349−\item Be \emph{well-founded} --- i.e. by the time a sequence of
350−(possibly mutually) recursive calls reaches \texttt{f} again, it must
351−be possible to show that one of its arguments has decreased.
352−\item Not use any data types which are not \emph{strictly positive}
353−\item Not call any non-total functions
354−\end{itemize}
355−
356−\subsubsection{Directives and Compiler Flags for Totality}
357−
358−By default, \Idris{} allows all definitions, whether total or not. However,
359−it is desirable for functions to be total as far as possible, as this
360−provides a guarantee that they provide a result for all possible inputs,
361−in finite time. It is possible to make total functions a requirement,
362−either:
363−
364−\begin{itemize}
365−\item By using the \texttt{--total} compiler flag.
366−\item By adding a \texttt{\%default total} directive to a source file.
367−All definitions after this will be required to be total, unless
368−explicitly flagged as \texttt{partial}.
369−\end{itemize}
370−
371−\noindent
372−All functions \remph{after} a \texttt{\%default total} declaration are required
373−to be total. Correspondingly, after a \texttt{\%default partial} declaration,
374−the requirement is relaxed.
375−
376−Finally, the compiler flag \texttt{--warnpartial} causes \Idris{} to print
377−a warning for any undeclared partial function.
tutorial/content/typesfuns.texdeleted−1017
@@ -1,1017 +0,0 @@
1−\section{Types and Functions}
2−
3−\subsection{Primitive Types}
4−
5−\Idris{} defines several primitive types: \tTC{Int}, \tTC{Integer} and
6−\tTC{Float} for numeric operations, \tTC{Char} and \tTC{String} for
7−text manipulation, and \tTC{Ptr} which represents foreign pointers.
8−There are also several data types declared in the library, including
9−\tTC{Bool}, with values \tDC{True} and \tDC{False}.
10−We can declare some constants with these types. Enter the following
11−into a file \texttt{prims.idr} and load it into the \Idris{} interactive
12−environment by typing \texttt{idris prims.idr}:
13−
14−\begin{code}
15−module prims
16−
17−x : Int
18−x = 42
19−
20−foo : String
21−foo = "Sausage machine"
22−
23−bar : Char
24−bar = 'Z'
25−
26−quux : Bool
27−quux = False
28−\end{code}
29−
30−\noindent
31−An \Idris{} file consists of an optional module declaration (here
32−\texttt{module prims}) followed by an optional list of imports (none here,
33−however \Idris{} programs can consist of several modules, and the definitions
34−in each module each have their own namespace, as we will discuss in Section
35−\ref{sect:namespaces}) and a
36−collection of declarations and definitions. The order of definitions is
37−significant --- functions and data types must be defined before use.
38−Each definition must have a type
39−declaration (here, \texttt{x : Int}, \texttt{foo : String}, etc).
40−Indentation is significant --- a new declaration begins at the same level
41−of indentation as the preceding declaration. Alternatively, declarations
42−may be terminated with a semicolon.
43−
44−A library module \texttt{prelude} is automatically imported by every \Idris{} program,
45−including facilities for IO, arithmetic, data structures and various common
46−functions. The prelude defines several arithmetic and comparison operators,
47−which we can use at the prompt. Evaluating things at the prompt gives an
48−answer, and the type of the answer. For example:
49−
50−\begin{lstlisting}
51−*prims> 6*6+6
52−42 : Int
53−*prims> x == 6*6+6
54−True : Bool
55−\end{lstlisting}
56−
57−\noindent
58−All of the usual arithmetic and comparison operators are defined for the primitive
59−types. They are overloaded using type classes, as we will discuss in Section
60−\ref{sec:classes} and can be extended to work on user defined types.
61−Boolean expressions can be tested with the \texttt{if...then...else} construct:
62−
63−\begin{lstlisting}
64−*prims> if x == 6 * 6 + 6 then "The answer!" else "Not the answer"
65−"The answer!" : String
66−\end{lstlisting}
67−
68−\subsection{Data Types}
69−
70−Data types are declared in a similar way to Haskell data types, with a similar
71−syntax. Natural numbers and lists, for example, can be declared as follows:
72−
73−\begin{code}
74−data Nat = Z | S Nat -- Natural numbers
75− -- (zero and successor)
76−data List a = Nil | (::) a (List a) -- Polymorphic lists
77−\end{code}
78−
79−\noindent
80−The above declarations are taken from the standard library. Unary natural
81−numbers can be either zero (\texttt{Z}), or
82−the successor of another natural number (\texttt{S k}).
83−Lists can either be empty (\texttt{Nil})
84−or a value added to the front of another list (\texttt{x :: xs}).
85−In the declaration for \tTC{List}, we used an infix operator \tDC{::}. New operators
86−such as this can be added using a fixity declaration, as follows:
87−
88−\begin{code}
89−infixr 10 ::
90−\end{code}
91−
92−\noindent
93−Functions, data constructors and type constuctors may all be given infix
94−operators as names. They may be used in prefix form if enclosed in brackets,
95−e.g. \tDC{(::)}. Infix operators can use any of the symbols:
96−
97−\begin{lstlisting}
98−:+-*/=_.?|&><!@$%^~.
99−\end{lstlisting}
100−
101−\subsection{Functions}
102−
103−Functions are implemented by pattern matching, again using a similar syntax to
104−Haskell. The main difference is that \Idris{} requires type declarations for all
105−functions, using a single colon \texttt{:} (rather than
106−Haskell's double colon \texttt{::}). Some natural number arithmetic functions can be
107−defined as follows, again taken from the standard library:
108−
109−\begin{code}
110−-- Unary addition
111−plus : Nat -> Nat -> Nat
112−plus Z y = y
113−plus (S k) y = S (plus k y)
114−
115−-- Unary multiplication
116−mult : Nat -> Nat -> Nat
117−mult Z y = Z
118−mult (S k) y = plus y (mult k y)
119−\end{code}
120−
121−\noindent
122−The standard arithmetic operators \texttt{+} and \texttt{*} are also overloaded
123−for use by \texttt{Nat}, and are implemented
124−using the above functions. Unlike Haskell, there is no restriction on whether
125−types and function names must begin with a capital letter or not. Function
126−names (\tFN{plus} and \tFN{mult} above), data constructors (\tDC{Z}, \tDC{S},
127−\tDC{Nil} and \tDC{::}) and type constructors (\tTC{Nat} and \tTC{List}) are
128−all part of the same namespace.
129−
130−We can test these functions at the \Idris{} prompt:
131−
132−\begin{lstlisting}
133−Idris> plus (S (S Z)) (S (S Z))
134−S (S (S (S Z))) : Nat
135−Idris> mult (S (S (S Z))) (plus (S (S Z)) (S (S Z)))
136−S (S (S (S (S (S (S (S (S (S (S (S Z))))))))))) : Nat
137−\end{lstlisting}
138−
139−\noindent
140−Like arithmetic operations, integer literals are also overloaded using type classes,
141−meaning that we can also test the functions as follows:
142−
143−\begin{lstlisting}
144−Idris> plus 2 2
145−S (S (S (S Z))) : Nat
146−Idris> mult 3 (plus 2 2)
147−S (S (S (S (S (S (S (S (S (S (S (S Z))))))))))) : Nat
148−\end{lstlisting}
149−
150−\noindent
151−You may wonder, by the way, why we have unary natural numbers when our
152−computers have perfectly good integer arithmetic built in. The reason is
153−primarily that unary numbers have a very convenient structure which is easy to
154−reason about, and easy to relate to other data structures as we will see later.
155−Nevertheless, we do not want this convenience to be at the expense of
156−efficiency. Fortunately, \Idris{} knows about the relationship between
157−\tTC{Nat} (and similarly structured types) and numbers, so optimises the
158−representation and functions such as \tFN{plus} and \tFN{mult}.
159−
160−\subsubsection*{\texttt{where} clauses}
161−
162−Functions can also be defined \emph{locally} using \texttt{where} clauses. For example,
163−to define a function which reverses a list, we can use an auxiliary function which
164−accumulates the new, reversed list, and which does not need to be visible globally:
165−
166−\begin{code}
167−reverse : List a -> List a
168−reverse xs = revAcc [] xs where
169− revAcc : List a -> List a -> List a
170− revAcc acc [] = acc
171− revAcc acc (x :: xs) = revAcc (x :: acc) xs
172−\end{code}
173−
174−\noindent
175−Indentation is significant --- functions in the \texttt{where} block must be indented
176−further than the outer function.
177−
178−\textbf{Scope:}
179−Any names which are visible in the outer scope are also visible in the
180−\texttt{where} clause (unless they have been redefined, such as \texttt{xs}
181−here). A name which appears only in the type will be in scope in the
182−\texttt{where} clause if it is a \remph{parameter} to one of the types,
183−i.e. it is fixed across the entire structure.
184−
185−As well as functions, \texttt{where} blocks can include local data
186−declarations, such as the following where \texttt{MyLT} is not accessible outside
187−the definition of \texttt{foo}:
188−
189−\begin{code}
190−foo : Int -> Int
191−foo x = case isLT of
192− Yes => x*2
193− No => x*4
194− where
195− data MyLT = Yes | No
196−
197− isLT : MyLT
198− isLT = if x < 20 then Yes else No
199−\end{code}
200−
201−\noindent
202−In general, functions defined in a \texttt{where} clause need a type declaration
203−just like any top level function. However, the type declaration for
204−a function \texttt{f} \remph{can} be omitted if:
205−
206−\begin{itemize}
207−\item \texttt{f} appears in the right hand side of the top level definition
208−\item The type of \texttt{f} can be completely determined from its first
209−application
210−\end{itemize}
211−
212−\noindent
213−So, for example, the following definitions are legal:
214−
215−\begin{code}
216−even : Nat -> Bool
217−even Z = True
218−even (S k) = odd k where
219− odd Z = False
220− odd (S k) = even k
221−
222−test : List Nat
223−test = [c (S 1), c Z, d (S Z)]
224− where c x = 42 + x
225− d y = c (y + 1 + z y)
226− where z w = y + w
227−\end{code}
228−
229−\subsection{Dependent Types}
230−
231−\subsubsection{Vectors}
232−
233−A standard example of a dependent type is the type of ``lists with length'',
234−conventionally called vectors in the dependent type literature. In \Idris{},
235−we declare vectors as follows\footnote{Note that prior to \Idris{} 0.9.9,
236−the order of the arguments to \texttt{Vect} was reversed.}:
237−
238−\begin{code}
239−data Vect : Nat -> Type -> Type where
240− Nil : Vect Z a
241− (::) : a -> Vect k a -> Vect (S k) a
242−\end{code}
243−
244−\noindent
245−Note that we have used the same constructor names as for \tTC{List}. Ad-hoc
246−name overloading such as this is accepted by \Idris{}, provided that the names
247−are declared in different namespaces (in practice, normally in different modules).
248−Ambiguous constructor names can normally be resolved from context.
249−
250−This declares a family of types, and so the form of the declaration is rather
251−different from the simple type declarations above. We explicitly state the type
252−of the type constructor \tTC{Vect} --- it takes a \tTC{Nat} and a type as an
253−argument, where \tTC{Type} stands for the type of types. We say that \tTC{Vect}
254−is \emph{indexed} over \tTC{Nat} and \emph{parameterised} by \tTC{Type}. Each
255−constructor targets a different part of the family of types. \tDC{Nil} can only
256−be used to construct vectors with zero length, and \tDC{::} to construct
257−vectors with non-zero length. In the type of \tDC{::}, we state explicitly that an element
258−of type \texttt{a} and a tail of type \texttt{Vect k a} (i.e., a vector of length \texttt{k})
259−combine to make a vector of length \texttt{S k}.
260−
261−We can define functions on dependent types such as \tTC{Vect} in the same way
262−as on simple types such as \tTC{List} and \tTC{Nat} above, by pattern matching.
263−The type of a function over \tTC{Vect} will describe what happens to the
264−lengths of the vectors involved. For example, \tFN{++}, defined in the
265−library, appends two \tTC{Vect}s:
266−
267−\begin{code}
268−(++) : Vect n a -> Vect m a -> Vect (n + m) a
269−(++) Nil ys = ys
270−(++) (x :: xs) ys = x :: xs ++ ys
271−\end{code}
272−
273−\noindent
274−The type of \tFN{(++)} states that the resulting vector's length will be the sum of
275−the input lengths. If we get the definition wrong in such a way that this does
276−not hold, \Idris{} will not accept the definition. For example:
277−
278−\begin{code}
279−(++) : Vect n a -> Vect m a -> Vect (n + m) a
280−(++) Nil ys = ys
281−(++) (x :: xs) ys = x :: xs ++ xs -- BROKEN
282−\end{code}
283−
284−\begin{lstlisting}
285−$ idris vbroken.idr --check
286−vbroken.idr:3:Can't unify Vect n a with Vect m a
287−
288−Specifically:
289− Can't unify n with m
290−\end{lstlisting}
291−
292−
293−\noindent
294−This error message suggests that there is a length mismatch between two vectors
295−--- we needed a vector of length \texttt{m}, but provided a vector
296−of length \texttt{n}.
297−%Note that the terms in the error message have been \emph{normalised}, so in
298−%particular \texttt{n + m} has been reduced to \texttt{plus n m}.
299−
300−\subsubsection{The Finite Sets}
301−
302−Finite sets, as the name suggests, are sets with a finite number of elements.
303−They are declared as follows (again, in the prelude):
304−
305−\begin{code}
306−data Fin : Nat -> Type where
307− fZ : Fin (S k)
308− fS : Fin k -> Fin (S k)
309−\end{code}
310−
311−\noindent
312−\tDC{fZ} is the zeroth element of a finite set with \texttt{S k} elements;
313−\texttt{fS n} is the
314−\texttt{n+1}th element of a finite set with \texttt{S k} elements.
315−\tTC{Fin} is indexed by a \tTC{Nat}, which
316−represents the number of elements in the set. Obviously we can't construct an
317−element of an empty set, so neither constructor targets \texttt{Fin Z}.
318−
319−A useful application of the \tTC{Fin} family is to represent bounded
320−natural numbers. Since the first \tTC{n} natural numbers form a finite
321−set of \tTC{n} elements, we can treat \tTC{Fin n} as the set of natural
322−numbers bounded by \tTC{n}.
323−
324−For example, the following function which looks up an element in a \tTC{Vect},
325−by a bounded index given as a \tTC{Fin n}, is defined in the prelude:
326−
327−\begin{code}
328−index : Fin n -> Vect n a -> a
329−index fZ (x :: xs) = x
330−index (fS k) (x :: xs) = index k xs
331−\end{code}
332−
333−\noindent
334−This function looks up a value at a given location in a vector. The location is
335−bounded by the length of the vector (\texttt{n} in each case), so there is no
336−need for a run-time bounds check. The type checker guarantees that the location
337−is no larger than the length of the vector.
338−
339−Note also that there is no case for \texttt{Nil} here. This is because it is
340−impossible. Since there is no element of \texttt{Fin Z}, and the location is a
341−\texttt{Fin n}, then \texttt{n} can not be \tDC{Z}. As a result, attempting to
342−look up an element in an empty vector would give a compile time type error,
343−since it would force \texttt{n} to be \tDC{Z}.
344−
345−\subsubsection{Implicit Arguments}
346−
347−Let us take a closer look at the type of \texttt{index}:
348−
349−\begin{code}
350−index : Fin n -> Vect n a -> a
351−\end{code}
352−
353−\noindent
354−It takes two arguments, an element of the finite set of \texttt{n} elements, and a vector
355−with \texttt{n} elements of type \texttt{a}. But there are also two names,
356−\texttt{n} and \texttt{a}, which are not declared explictly. These are \emph{implicit}
357−arguments to \texttt{index}. We could also write the type of \texttt{index} as:
358−
359−\begin{code}
360−index : {a:Type} -> {n:Nat} -> Fin n -> Vect n a -> a
361−\end{code}
362−
363−\noindent
364−Implicit arguments, given in braces \texttt{\{\}} in the type declaration, are
365−not given in applications of \texttt{index}; their values can be inferred from
366−the types of the \texttt{Fin n} and \texttt{Vect n a} arguments. Any name
367−with a \remph{lower case initial letter} which
368−appears as a parameter or index in a type declaration, but which is otherwise
369−free, will be automatically bound as an implicit argument. Implicit arguments
370−can still be given explicitly in applications, using \texttt{\{a=value\}} and
371−\texttt{\{n=value\}}, for example:
372−
373−\begin{code}
374−index {a=Int} {n=2} fZ (2 :: 3 :: Nil)
375−\end{code}
376−
377−\noindent
378−In fact, any argument, implicit or explicit, may be given a name. We could have
379−declared the type of \texttt{index} as:
380−
381−\begin{code}
382−index : (i:Fin n) -> (xs:Vect n a) -> a
383−\end{code}
384−
385−\noindent
386−It is a matter of taste whether you want to do this --- sometimes it can help
387−document a function by making the purpose of an argument more clear.
388−
389−\subsubsection{``\texttt{using}'' notation}
390−
391−Sometimes it is necessary to provide types of implicit arguments where
392−the type checker can not work them out itself. This can happen if there is a
393−dependency ordering --- obviously, \texttt{a} and \texttt{n} must be given as arguments above
394−before being used --- or if an implicit argument has a complex type. For example,
395−we will need to state the types of the implicit arguments in the following
396−definition, which defines a predicate on vectors:
397−
398−\begin{code}
399−data Elem : a -> Vect n a -> Type where
400− here : {x:a} -> {xs:Vect n a} -> Elem x (x :: xs)
401− there : {x,y:a} -> {xs:Vect n a} -> Elem x xs -> Elem x (y :: xs)
402−\end{code}
403−
404−\noindent
405−An instance of \texttt{Elem x xs} states that \texttt{x} is an element of
406−\texttt{xs}. We can construct
407−such a predicate if the required element is \texttt{here}, at the head of the vector,
408−or \texttt{there}, in the tail of the vector. For example:
409−
410−\begin{code}
411−testVec : Vect 4 Int
412−testVec = 3 :: 4 :: 5 :: 6 :: Nil
413−
414−inVect : Elem 5 testVec
415−inVect = there (there here)
416−\end{code}
417−
418−\noindent
419−If the same implicit arguments are being used a lot, it can make a definition
420−difficult to read. To avoid this problem, a \texttt{using} block gives the types and
421−ordering of any implicit arguments which can appear within the block:
422−
423−\begin{code}
424−using (x:a, y:a, xs:Vect n a)
425− data Elem : a -> Vect n a -> Type where
426− here : Elem x (x :: xs)
427− there : Elem x xs -> Elem x (y :: xs)
428−\end{code}
429−
430−
431−\subsubsection*{Note: Declaration Order and \texttt{mutual} blocks}
432−
433−In general, functions and data types must be defined before use, since
434−dependent types allow functions to appear as part of types, and their
435−reduction behaviour to affect type checking. However, this
436−restriction can be relaxed by using a \texttt{mutual} block, which allows
437−data types and functions to be defined simultaneously:
438−
439−\begin{code}
440−mutual
441− even : Nat -> Bool
442− even Z = True
443− even (S k) = odd k
444−
445− odd : Nat -> Bool
446− odd Z = False
447− odd (S k) = even k
448−\end{code}
449−
450−
451−\noindent
452−In a \texttt{mutual} block, first all of the type declarations are added,
453−then the function bodies. As a result, none of the function types can depend
454−on the reduction behaviour of any of the functions in the block.
455−
456−\subsection{I/O}
457−
458−Computer programs are of little use if they do not interact with the user or
459−the system in some way. The difficulty in a pure language such as \Idris{} ---
460−that is, a language where expressions do not have side-effects --- is that I/O
461−is inherently side-effecting. Therefore in \Idris{}, such interactions are
462−encapsulated in the type \texttt{IO}:
463−
464−\begin{code}
465−data IO a -- IO operation returning a value of type a
466−\end{code}
467−
468−
469−\noindent
470−We'll leave the definition of \texttt{IO} abstract, but effectively it describes what
471−the I/O operations to be executed are, rather than how to execute them. The
472−resulting operations are executed externally,
473−by the run-time system. We've already seen one IO
474−program:
475−
476−\begin{code}
477−main : IO ()
478−main = putStrLn "Hello world"
479−\end{code}
480−
481−
482−\noindent
483−The type of \texttt{putStrLn} explains that it takes a string, and returns an
484−element of the unit type () via an I/O action. There is a variant \texttt{putStr} which
485−outputs a string without a newline:
486−
487−\begin{code}
488−putStrLn : String -> IO ()
489−putStr : String -> IO ()
490−\end{code}
491−
492−We can also read strings from user input:
493−
494−\begin{code}
495−getLine : IO String
496−\end{code}
497−
498−
499−\noindent
500−A number of other I/O operations are defined in the prelude, for example for reading and
501−writing files, including:
502−
503−\begin{code}
504−data File -- abstract
505−data Mode = Read | Write | ReadWrite
506−
507−openFile : String -> Mode -> IO File
508−closeFile : File -> IO ()
509−
510−fread : File -> IO String
511−fwrite : File -> String -> IO ()
512−feof : File -> IO Bool
513−
514−readFile : String -> IO String
515−\end{code}
516−
517−
518−\subsection{``\texttt{do}'' notation}
519−
520−\label{sect:do}
521−
522−I/O programs will typically need to sequence actions, feeding the output of one
523−computation into the input of the next. \texttt{IO} is an abstract type, however, so we
524−can't access the result of a computation directly. Instead, we sequence
525−operations with \texttt{do} notation:
526−
527−\begin{code}
528−greet : IO ()
529−greet = do putStr "What is your name? "
530− name <- getLine
531− putStrLn ("Hello " ++ name)
532−\end{code}
533−
534−
535−\noindent
536−The syntax \texttt{x <- iovalue} executes the I/O operation \texttt{iovalue}, of type
537−\texttt{IO a}, and
538−puts the result, of type \texttt{a} into the variable \texttt{x}.
539−In this case, \texttt{getLine} returns an \texttt{IO String},
540−so \texttt{name} has type \texttt{String}. Indentation is significant --- each
541−statement in the do block must begin in the same column.
542−The \texttt{return} operation allows us to inject a value directly into an IO
543−operation:
544−
545−\begin{code}
546−return : a -> IO a
547−\end{code}
548−
549−
550−\noindent
551−As we will see later, \texttt{do} notation is more general than this, and can be
552−overloaded.
553−
554−\subsection{Useful Data Types}
555−
556−\Idris{} includes a number of useful data types and library functions (see the
557−\texttt{lib/} directory in the distribution). This chapter describes a few of these. The
558−functions described here are imported automatically by every \Idris{} program, as
559−part of \texttt{prelude.idr}.
560−
561−\subsubsection{\texttt{List} and \texttt{Vect}}
562−
563−We have already seen the \texttt{List} and \texttt{Vect} data types:
564−
565−\begin{code}
566−data List a = Nil | (::) a (List a)
567−
568−data Vect : Nat -> Type -> Type where
569− Nil : Vect Z a
570− (::) : a -> Vect k a -> Vect (S k) a
571−\end{code}
572−
573−
574−\noindent
575−Note that the constructor names are the same for each --- constructor names (in
576−fact, names in general) can be overloaded, provided that they are declared in
577−different namespaces (see Section \ref{sect:namespaces}), and will typically be
578−resolved according to their type. As syntactic sugar, any type with the constructor
579−names \texttt{Nil} and \texttt{::} can be written in list form. For example:
580−
581−\begin{itemize}
582−\item \texttt{[]} means \texttt{Nil}
583−\item \texttt{[1,2,3]} means \texttt{1 :: 2 :: 3 :: Nil}
584−\end{itemize}
585−
586−\noindent
587−The library also defines a number of functions for manipulating these types.
588−\texttt{map} is overloaded both for \texttt{List} and \texttt{Vect}
589−and applies a function to every element of the list or vector.
590−
591−\begin{code}
592−map : (a -> b) -> List a -> List b
593−map f [] = []
594−map f (x :: xs) = f x :: map f xs
595−
596−map : (a -> b) -> Vect n a -> Vect n b
597−map f [] = []
598−map f (x :: xs) = f x :: map f xs
599−\end{code}
600−
601−
602−\noindent
603−For example, to double every element in a vector of integers:
604−
605−\begin{code}
606−intVec : Vect 5 Int
607−intVec = [1, 2, 3, 4, 5]
608−
609−double : Int -> Int
610−double x = x * 2
611−\end{code}
612−
613−
614−\noindent
615−You'll find these examples in \texttt{usefultypes.idr} in the \texttt{examples/} directory:
616−
617−\begin{lstlisting}
618−*usefultypes> show (map double intVec)
619−"[2, 4, 6, 8, 10]" : String
620−\end{lstlisting}
621−
622−
623−\noindent
624−For more details of the functions available on \texttt{List} and \texttt{Vect},
625−look in the library, in \texttt{prelude/list.idr} and \texttt{prelude/vect.idr} respectively.
626−Functions include filtering, appending, reversing, and so on. Also remember
627−that \Idris{} is still in development, so if you don't see the function you
628−need, please feel free to add it and submit a patch!
629−
630−\subsubsection*{Aside: Anonymous functions and operator sections}
631−
632−There are actually neater ways to write the above expression. One way would be
633−to use an anonymous function:
634−
635−\begin{lstlisting}
636−*usefultypes> show (map (\x => x * 2) intVec)
637−"[2, 4, 6, 8, 10]" : String
638−\end{lstlisting}
639−
640−
641−\noindent
642−The notation \texttt{$\backslash$x => val} constructs an anonymous function
643−which takes one argument, \texttt{x} and returns the expression \texttt{val}.
644−Anonymous functions may take several arguments, separated by commas, e.g.
645−\texttt{$\backslash$x, y, z => val}. Arguments may also be given explicit
646−types, e.g. \texttt{$\backslash$x : Int => x * 2}, and can pattern match,
647−e.g. \texttt{$\backslash$ (x, y) => x + y}.
648−We could also use an operator section:
649−
650−\begin{code}
651−*usefultypes> show (map (* 2) intVec)
652−"[2, 4, 6, 8, 10]" : String
653−\end{code}
654−
655−
656−\noindent
657−\texttt{(*2)} is shorthand for a function which multiplies a number by 2. It expands to
658−\texttt{$\backslash$x => x * 2}.
659−Similarly, \texttt{(2*)} would expand to \texttt{$\backslash$x => 2 * x}.
660−
661−\subsubsection{Maybe}
662−
663−\texttt{Maybe} describes an optional value. Either there is a value of the given type,
664−or there isn't:
665−
666−\begin{code}
667−data Maybe a = Just a | Nothing
668−\end{code}
669−
670−
671−\noindent
672−\texttt{Maybe} is one way of giving a type to an operation that may fail. For example,
673−looking something up in a \texttt{List} (rather than a vector) may result in an out of
674−bounds error:
675−
676−\begin{code}
677−list_lookup : Nat -> List a -> Maybe a
678−list_lookup _ Nil = Nothing
679−list_lookup Z (x :: xs) = Just x
680−list_lookup (S k) (x :: xs) = list_lookup k xs
681−\end{code}
682−
683−
684−\noindent
685−The \texttt{maybe} function is used to process values of type \texttt{Maybe},
686−either by applying a function to the value, if there is one, or by providing a default value:
687−
688−\begin{code}
689−maybe : Maybe a -> |(default:b) -> (a -> b) -> b
690−\end{code}
691−
692−
693−\noindent
694−The vertical bar $\mid$ before the default value is a laziness annotation. Normally
695−expressions are evaluated before being passed to a function. This is typically
696−the most efficient behaviour. However, in this case, the default value might
697−not be used and if it is a large expression, evaluating it will be wasteful.
698−The $\mid$ annotation tells the compiler not to evaluate the argument until it is
699−needed.
700−
701−\subsubsection{Tuples and Dependent Pairs}
702−
703−Values can be paired with the following built-in data type:
704−
705−\begin{code}
706−data Pair a b = MkPair a b
707−\end{code}
708−
709−
710−\noindent
711−As syntactic sugar, we can write \texttt{(a, b)} which, according to context,
712−means either \texttt{Pair a b} or \texttt{MkPair a b}.
713−Tuples can contain an arbitrary number of values, represented as nested pairs:
714−
715−\begin{code}
716−fred : (String, Int)
717−fred = ("Fred", 42)
718−
719−jim : (String, Int, String)
720−jim = ("Jim", 25, "Cambridge")
721−\end{code}
722−
723−
724−\subsubsection*{Dependent Pairs}
725−
726−Dependent pairs allow the type of the second element of a pair to depend on
727−the value of the first element:
728−
729−\begin{code}
730−data Exists : (A : Type) -> (P : A -> Type) -> Type where
731− Ex_intro : {P : A -> Type} -> (a : A) -> P a -> Exists A P
732−\end{code}
733−
734−
735−\noindent
736−Again, there is syntactic sugar for this. \texttt{(a : A ** P)} is the type of a pair of
737−A and P, where the name \texttt{a} can occur inside P. \texttt{( a ** p )}
738−constructs a value of this type. For example, we can pair a number with a
739−\texttt{Vect} of a particular length.
740−
741−\begin{code}
742−vec : (n : Nat ** Vect n Int)
743−vec = (2 ** [3, 4])
744−\end{code}
745−
746−
747−\noindent
748−The type checker could of course infer the value of the first element from the
749−length of the vector. We can write an underscore \texttt{\_} in place of values which we
750−expect the type checker to fill in, so the above definition could also be
751−written as:
752−
753−\begin{code}
754−vec : (n : Nat ** Vect n Int)
755−vec = (_ ** [3, 4])
756−\end{code}
757−
758−
759−\noindent
760−We might also prefer to omit the type of the first element of the pair, since,
761−again, it can be inferred:
762−
763−\begin{code}
764−vec : (n ** Vect n Int)
765−vec = (_ ** [3, 4])
766−\end{code}
767−
768−
769−\noindent
770−One use for dependent pairs is to return values of dependent types where the
771−index is not necessarily known in advance. For example, if we filter elements
772−out of a \texttt{Vect} according to some predicate, we will not know in advance what the
773−length of the resulting vector will be:
774−
775−\begin{code}
776−filter : (a -> Bool) -> Vect n a -> (p ** Vect p a)
777−\end{code}
778−
779−
780−\noindent
781−If the \texttt{Vect} is empty, the result is easy:
782−
783−\begin{code}
784−filter p Nil = (_ ** [])
785−\end{code}
786−
787−
788−\noindent
789−In the \texttt{::} case, we need to inspect the result of a recursive call to
790−\texttt{filter} to
791−extract the length and the vector from the result. To do this, we use \texttt{with}
792−notation, which allows pattern matching on intermediate values:
793−
794−\begin{code}
795−filter p (x :: xs) with (filter p xs)
796− | ( _ ** xs' ) = if (p x) then ( _ ** x :: xs' ) else ( _ ** xs' )
797−\end{code}
798−
799−\noindent
800−We will see more on \texttt{with} notation later.
801−
802−\subsection{\texttt{so}}
803−
804−The \texttt{so} data type is a predicate on \texttt{Bool} which guarantees that the
805−value is true:
806−
807−\begin{code}
808−data so : Bool -> Type where
809− oh : so True
810−\end{code}
811−
812−
813−\noindent
814−This is most useful for providing a static guarantee that a dynamic check has been made.
815−For example, we might provide a safe interface to a function which draws a pixel
816−on a graphical display as follows, where \texttt{so (inBounds x y)} guarantees that
817−the point \texttt{(x,y)} is within the bounds of a 640x480 window:
818−
819−\begin{code}
820−inBounds : Int -> Int -> Bool
821−inBounds x y = x >= 0 && x < 640 && y >= 0 && y < 480
822−
823−drawPoint : (x : Int) -> (y : Int) -> so (inBounds x y) -> IO ()
824−drawPoint x y p = unsafeDrawPoint x y
825−\end{code}
826−
827−
828−\subsection{More Expressions}
829−
830−\subsubsection*{\texttt{let} bindings}
831−
832−Intermediate values can be calculated using \texttt{let} bindings:
833−
834−\begin{code}
835−mirror : List a -> List a
836−mirror xs = let xs' = rev xs in
837− xs ++ xs'
838−\end{code}
839−
840−
841−\noindent
842−We can do simple pattern matching in \texttt{let} bindings too. For example, we can extract
843−fields from a record as follows, as well as by pattern matching at the top level:
844−
845−\begin{code}
846−data Person = MkPerson String Int
847−
848−showPerson : Person -> String
849−showPerson p = let MkPerson name age = p in
850− name ++ " is " ++ show age ++ " years old"
851−\end{code}
852−
853−
854−\subsubsection*{List comprehensions}
855−
856−\label{sec:listcomp}
857−
858−\Idris{} provides \emph{comprehension} notation as a convenient shorthand for
859−building lists. The general form is:
860−
861−\begin{lstlisting}
862−[ expression | qualifiers ]
863−\end{lstlisting}
864−
865−
866−\noindent
867−This generates the list of values produced by evaluating the
868−\texttt{expression}, according to the conditions given by the comma separated
869−\texttt{qualifiers}. For example, we can build a list of Pythagorean triples as
870−follows:
871−
872−\begin{code}
873−pythag : Int -> List (Int, Int, Int)
874−pythag n = [ (x, y, z) | z <- [1..n], y <- [1..z], x <- [1..y],
875− x*x + y*y == z*z ]
876−\end{code}
877−
878−
879−\noindent
880−The \texttt{[a..b]} notation is another shorthand which builds a list of
881−numbers between \texttt{a} and \texttt{b}. Alternatively \texttt{[a,b..c]}
882−builds a list of numbers between \texttt{a} and \texttt{c} with the increment
883−specified by the difference between \texttt{a} and \texttt{b}. This works for
884−any numeric type, using the \texttt{count} function from the prelude.
885−
886−\subsubsection*{\texttt{case} expressions}
887−
888−Another way of inspecting intermediate values of \emph{simple} types
889−is to use a \texttt{case} expression.
890−The following function, for example, splits a string into two at a given character:
891−
892−\begin{code}
893−splitAt : Char -> String -> (String, String)
894−splitAt c x = case break (== c) x of
895− (x, y) => (x, strTail y)
896−\end{code}
897−
898−
899−\noindent
900−\texttt{break} is a library function which breaks a string into a pair of strings
901−at the point where the given function returns true. We then deconstruct the
902−pair it returns, and remove the first character of the second string.
903−
904−A \texttt{case} expression can match several cases, for example, to inspect an
905−intermediate value of type \texttt{Maybe a}. Recall \texttt{list\_lookup} which
906−looks up an index in a list, returning \texttt{Nothing} if the index is out
907−of bounds. We can use this to write \texttt{lookup\_default}, which
908−looks up an index and returns a default value if the index is out of bounds:
909−
910−\begin{code}
911−lookup_default : Nat -> List a -> a -> a
912−lookup_default i xs def = case list_lookup i xs of
913− Nothing => def
914− Just x => x
915−\end{code}
916−
917−
918−\noindent
919−If the index is in bounds, we get the value at that index, otherwise we get
920−a default value:
921−
922−\begin{lstlisting}
923−*usefultypes> lookup_default 2 [3,4,5,6] (-1)
924−5 : Int
925−*usefultypes> lookup_default 4 [3,4,5,6] (-1)
926−-1 : Int
927−\end{lstlisting}
928−
929−
930−\noindent
931−\textbf{Restrictions:} The \texttt{case} construct is intended for simple analysis
932−of intermediate expressions to avoid the need to write auxiliary functions, and is
933−also used internally to implement pattern matching \texttt{let} and lambda bindings.
934−It will \emph{only} work if:
935−
936−\begin{itemize}
937−\item Each branch \emph{matches} a value of the same type, and \emph{returns} a
938−value of the same type.
939−\item The type of the result is ``known''. i.e. the type of the expression can be
940−determined \emph{without} type checking the \texttt{case}-expression itself.
941−\end{itemize}
942−
943−\subsection{Dependent Records}
944−
945−\remph{Records} are data types which collect several values (the record's
946−\remph{fields}) together. \Idris{} provides syntax for defining records and
947−automatically generating field access and update functions. For example, we
948−can represent a person's name and age in a record:
949−
950−\begin{code}
951−record Person : Type where
952− MkPerson : (name : String) ->
953− (age : Int) -> Person
954−
955−fred : Person
956−fred = MkPerson "Fred" 30
957−\end{code}
958−
959−
960−\noindent
961−Record declarations are like \texttt{data} declarations, except that they are
962−introduced by the \texttt{record} keyword, and can only have one constructor.
963−The names of the binders in the constructor type (\texttt{name} and \texttt{age})
964−here are the field names, which we can use to access the field values:
965−
966−\begin{lstlisting}
967−*record> name fred
968−"Fred" : String
969−*record> age fred
970−30 : Int
971−*record> :t name
972−name : Person -> String
973−\end{lstlisting}
974−
975−\noindent
976−We can also use the field names to update a record (or, more precisely, produce a
977−new record with the given fields updates).
978−
979−\begin{lstlisting}
980−*record> record { name = "Jim" } fred
981−MkPerson "Jim" 30 : Person
982−*record> record { name = "Jim", age = 20 } fred
983−MkPerson "Jim" 20 : Person
984−\end{lstlisting}
985−
986−\noindent
987−The syntax \texttt{record \{ field = val, ... \}} generates a function which updates
988−the given fields in a record.
989−
990−Records, and fields within records, can have dependent types.
991−Updates are allowed to change the type of a field,
992−provided that the result is well-typed, and the result does not affect the type of
993−the record as a whole. For example:
994−
995−\begin{code}
996−record Class : Type where
997− ClassInfo : (students : Vect n Person) ->
998− (className : String) ->
999− Class
1000−\end{code}
1001−
1002−\noindent
1003−It is safe to update the \texttt{students} field to a vector of a different length
1004−because it will not affect the type of the record:
1005−
1006−\begin{code}
1007−addStudent : Person -> Class -> Class
1008−addStudent p c = record { students = p :: students c } c
1009−\end{code}
1010−
1011−\begin{lstlisting}
1012−*record> addStudent fred (ClassInfo [] "CS")
1013−ClassInfo (prelude.vect.:: (MkPerson "Fred" 30) (prelude.vect.Nil)) "CS"
1014− : Class
1015−\end{lstlisting}
1016−
1017−
tutorial/content/views.texdeleted−96
@@ -1,96 +0,0 @@
1−\section{Views and the ``\texttt{with}'' rule}
2−
3−\subsection{Dependent pattern matching}
4−
5−Since types can depend on values, the form of some arguments can be determined
6−by the value of others. For example, if we were to write down the implicit
7−length arguments to \texttt{(++)}, we'd see that the form of the length argument was
8−determined by whether the vector was empty or not:
9−
10−\begin{code}
11−(++) : Vect n a -> Vect m a -> Vect (n + m) a
12−(++) {n=Z} [] ys = ys
13−(++) {n=S k} (x :: xs) ys = x :: xs ++ ys
14−\end{code}
15−
16−\noindent
17−If \texttt{n} was a successor in the \texttt{[]} case, or zero in the
18−\texttt{::} case, the definition
19−would not be well typed.
20−
21−\subsection{The \texttt{with} rule --- matching intermediate values}
22−
23−Very often, we need to match on the result of an intermediate computation.
24−\Idris{} provides a construct for this, the \texttt{with} rule,
25−inspired by views in \Epigram~\cite{view-left},
26−which takes account of the
27−fact that matching on a value in a dependently typed language can affect what
28−we know about the forms of other values. In its simplest form, the \texttt{with} rule
29−adds another argument to the function being defined, e.g. we have already seen
30−a vector filter function, defined as follows:
31−
32−\begin{code}
33−filter : (a -> Bool) -> Vect n a -> (p ** Vect p a)
34−filter p [] = ( _ ** [] )
35−filter p (x :: xs) with (filter p xs)
36− | ( _ ** xs' ) = if (p x) then ( _ ** x :: xs' ) else ( _ ** xs' )
37−\end{code}
38−
39−\noindent
40−Here, the \texttt{with} clause allows us to deconstruct the result of
41−\texttt{filter p xs}.
42−Effectively, it adds this value as an extra argument, which we place after the
43−vertical bar.
44−
45−If the intermediate computation itself has a dependent type, then the result
46−can affect the forms of other arguments --- we can learn the form of one value by
47−testing another. For example, a \texttt{Nat} is either even or odd. If it's even it will
48−be the sum of two equal \texttt{Nat}s. Otherwise, it is the sum of two equal \texttt{Nat}s
49−plus one:
50−
51−\begin{code}
52−data Parity : Nat -> Type where
53− even : Parity (n + n)
54− odd : Parity (S (n + n))
55−\end{code}
56−
57−\noindent
58−We say \texttt{Parity} is a \emph{view} of \texttt{Nat}.
59−It has a \emph{covering function} which tests whether
60−it is even or odd and constructs the predicate accordingly.
61−
62−\begin{code}
63−parity : (n:Nat) -> Parity n
64−\end{code}
65−
66−\label{sect:nattobin}
67−
68−\noindent
69−We'll come back to the definition of \texttt{parity} shortly. We can use it
70−to write a function which converts a natural number to a list of binary digits
71−(least significant first) as follows, using the \texttt{with} rule:
72−
73−\begin{code}
74−natToBin : Nat -> List Bool
75−natToBin Z = Nil
76−natToBin k with (parity k)
77− natToBin (j + j) | even = False :: natToBin j
78− natToBin (S (j + j)) | odd = True :: natToBin j
79−\end{code}
80−
81−\noindent
82−The value of the result of \texttt{parity k} affects the form of \texttt{k},
83−because the result
84−of \texttt{parity k} depends on \texttt{k}.
85−So, as well as the patterns for the result of the
86−intermediate computation (\texttt{even} and \texttt{odd}) right of the
87−\texttt{$\mid$}, we also write how
88−the results affect the other patterns left of the $\mid$. Note that there is a
89−function in the patterns (\texttt{+}) and repeated occurrences of \texttt{j} ---
90−this is allowed
91−because another argument has determined the form of these patterns.
92−
93−We will return to this function in Section \ref{sect:provisional} to complete
94−the definition of \texttt{parity}.
95−
96−
tutorial/fpmacros.stydeleted−1086
@@ -1,1086 +0,0 @@
1−%% ------------------------------------------- [ Functional Programming Macros ]
2−%% A Package to provide support for functional programming.
3−%%
4−\NeedsTeXFormat{LaTeX2e}[1994/06/01]
5−\ProvidesPackage{fpmacros}[2013/12/17 fpmacros]
6−%% ------------------------------------------------------- [ Required Packages ]
7−\RequirePackage{ifthen}
8−\RequirePackage{amssymb}
9−\RequirePackage{latexsym}
10−\RequirePackage{eepic}
11−\RequirePackage{fancyvrb}
12−%% ----------------------------------------------------- [ Option Delcarations ]
13−\newboolean{useverb}
14−\setboolean{useverb}{true}
15−
16−\DeclareOption{noverb}{%
17− \setboolean{useverb}{false}
18−}
19−
20−\ProcessOptions\relax
21−
22−%% --------------------------------------------------------- [ Inference Rules ]
23−\newlength{\rulevgap}
24−\setlength{\rulevgap}{0.05in}
25−\newlength{\ruleheight}
26−\newlength{\ruledepth}
27−\newsavebox{\rulebox}
28−\newlength{\GapLength}
29−\newcommand{\gap}[1]{\settowidth{\GapLength}{#1} \hspace*{\GapLength}}
30−\newcommand{\dotstep}[2]{\begin{tabular}[b]{@{}c@{}}
31− #1\\$\vdots$\\#2
32− \end{tabular}}
33−\newlength{\fracwid}
34−\newcommand{\dotfrac}[2]{\settowidth{\fracwid}{$\frac{#1}{#2}$}
35− \addtolength{\fracwid}{0.1in}
36− \begin{tabular}[b]{@{}c@{}}
37− $#1$\\
38− \parbox[c][0.02in][t]{\fracwid}{\dotfill} \\
39− $#2$\\
40− \end{tabular}}
41−\newcommand{\Rule}[2]{\savebox{\rulebox}[\width][b] %
42− {\( \frac{\raisebox{0in} {\( #1 \)}} %
43− {\raisebox{-0.03in}{\( #2 \)}} \)} %
44− \settoheight{\ruleheight}{\usebox{\rulebox}} %
45− \addtolength{\ruleheight}{\rulevgap} %
46− \settodepth{\ruledepth}{\usebox{\rulebox}} %
47− \addtolength{\ruledepth}{\rulevgap} %
48− \raisebox{0in}[\ruleheight][\ruledepth] %
49− {\usebox{\rulebox}}}
50−\newcommand{\Case}[2]{\savebox{\rulebox}[\width][b] %
51− {\( \dotfrac{\raisebox{0in} {\( #1 \)}} %
52− {\raisebox{-0.03in}{\( #2 \)}} \)} %
53− \settoheight{\ruleheight}{\usebox{\rulebox}} %
54− \addtolength{\ruleheight}{\rulevgap} %
55− \settodepth{\ruledepth}{\usebox{\rulebox}} %
56− \addtolength{\ruledepth}{\rulevgap} %
57− \raisebox{0in}[\ruleheight][\ruledepth] %
58− {\usebox{\rulebox}}}
59−\newcommand{\Axiom}[1]{\savebox{\rulebox}[\width][b] %
60− {$\frac{}{\raisebox{-0.03in}{$#1$}}$} %
61− \settoheight{\ruleheight}{\usebox{\rulebox}} %
62− \addtolength{\ruleheight}{\rulevgap} %
63− \settodepth{\ruledepth}{\usebox{\rulebox}} %
64− \addtolength{\ruledepth}{\rulevgap} %
65− \raisebox{0in}[\ruleheight][\ruledepth] %
66− {\usebox{\rulebox}}}
67−\newcommand{\RuleSide}[3]{\gap{$#2$} \hspace*{0.1in} %
68− \Rule{#1}{#3} %
69− \hspace*{0.1in}$#2$}
70−\newcommand{\AxiomSide}[2]{\gap{$#1$} \hspace*{0.1in} %
71− \Axiom{#2} %
72− \hspace*{0.1in}$#1$}
73−\newcommand{\RULE}[1]{\textbf{#1}}
74−\newcommand{\hg}{\hspace{0.2in}}
75−
76−\newcommand{\ProofState}
77− [2]{\parbox{10cm}{\AR{\hg\AR{#1}\\\Axiom{\hg#2\hg}}}}
78−
79−%%%%%%%%%%%% TRISTUFF
80−
81−\newcommand{\btr}{
82−\setlength{\unitlength}{0.0005in}
83−\begin{picture}(69,180)(0,12)
84−\blacken\path(57,192)(57,12)(12,102)
85− (57,192)(57,192)
86−\path(57,192)(57,12)(12,102)
87− (57,192)(57,192)
88−\end{picture}
89−}
90−
91−\newcommand{\btl}{
92−\setlength{\unitlength}{0.0005in}
93−\begin{picture}(69,180)(0,12)
94−\blacken\path(12,192)(12,12)(57,102)
95− (12,192)(12,192)\path(12,192)(12,12)(57,102)
96− (12,192)(12,192)
97−\end{picture}
98−}
99−
100−\newcommand{\wtr}{
101−\setlength{\unitlength}{0.0005in}
102−\begin{picture}(69,180)(0,12)
103−%\blacken\path(57,192)(57,12)(12,102)
104−% (57,192)(57,192)
105−\path(57,192)(57,12)(12,102)
106− (57,192)(57,192)
107−\end{picture}
108−}
109−
110−\newcommand{\wtl}{
111−\setlength{\unitlength}{0.0005in}
112−\begin{picture}(69,180)(0,12)
113−%\blacken\path(12,192)(12,12)(57,102)
114−% (12,192)(12,192)
115−\path(12,192)(12,12)(57,102)
116− (12,192)(12,192)
117−\end{picture}
118−}
119−
120−
121−
122−%%%%%%%%%%%% FONTS
123−
124−\newcommand{\TC}[1]{\mathsf{#1}}
125−\newcommand{\DC}[1]{\mathsf{#1}}
126−\newcommand{\VV}[1]{\mathit{#1}}
127−\newcommand{\FN}[1]{\mathbf{#1}}
128−\newcommand{\HFN}[1]{\mathtt{#1}}
129−\newcommand{\RW}[1]{\underline{\textrm{#1}}}
130−\newcommand{\MO}[1]{\mbox{\textsc{#1}}}
131−
132−\newcommand{\tTC}[1]{\texttt{#1}}
133−\newcommand{\tDC}[1]{\texttt{#1}}
134−\newcommand{\tFN}[1]{\texttt{#1}}
135−
136−\newcommand{\HF}[1]{\mathtt{#1}}
137−
138−\newcommand{\MV}[1]{\nhole\mathit{#1}}
139−\newcommand{\Lang}[1]{\mathsf{#1}}
140−\newcommand{\Name}[1]{\mathit{#1}}
141−
142−\newcommand{\demph}[1]{\textbf{#1}}
143−\newcommand{\remph}[1]{\emph{#1}}
144−
145−%%%% Keywords for meta operations
146−\newcommand{\IF}{\;\RW{if}\;\;}
147−\newcommand{\THEN}{\RW{then}}
148−\newcommand{\ELSE}{\RW{else}}
149−\newcommand{\AND}{\RW{and}}
150−\newcommand{\Otherwise}{\RW{otherwise}}
151−\newcommand{\Do}{\RW{do}}
152−\newcommand{\Return}{\RW{return}}
153−
154−\newcommand{\CASE}{\RW{case}}
155−\newcommand{\LET}{\RW{let}}
156−\newcommand{\IN}{\RW{in}}
157−\newcommand{\of}{\RW{of}}
158−
159−\newcommand{\CLASS}{\mathtt{class}}
160−\newcommand{\INSTANCE}{\mathtt{instance}}
161−
162−%%%%%%%%%%%% GROUPING
163−
164−\newcommand{\G}{
165−\setlength{\unitlength}{1pt}
166−\begin{picture}(4,10)(0,0)
167−\path(2,10)(2,-10)
168−\end{picture}
169−}
170−
171−\newcommand{\E}{
172−\setlength{\unitlength}{1pt}
173−\begin{picture}(4,10)(0,0)
174−\path(2,10)(2,-2)(4,-2)
175−\end{picture}
176−}
177−
178−%\newcommand{\C}{
179−%\setlength{\unitlength}{1pt}
180−%\begin{picture}(4,10)(0,0)
181−%\path(4,8)(2,8)(2,-2)(4,-2)
182−%\end{picture}
183−%}
184−
185−\newcommand{\M}{
186−\setlength{\unitlength}{1pt}
187−\begin{picture}(4,10)(0,0)
188−\path(2,10)(2,-2)(6,-2)
189−\end{picture}
190−}
191−
192−\newcommand{\F}{
193−\setlength{\unitlength}{1pt}
194−\begin{picture}(4,10)(0,0)
195−\path(4,8)(2,8)(2,-6)
196−\end{picture}
197−}
198−
199−\newcommand{\K}{
200−\setlength{\unitlength}{1pt}
201−\begin{picture}(4,10)(0,0)
202−\path(0,8)(4,8)
203−\end{picture}
204−}
205−
206−\newcommand{\J}{
207−\setlength{\unitlength}{1pt}
208−\begin{picture}(4,10)(0,0)
209−\path(0,-2)(4,-2)
210−\end{picture}
211−}
212−
213−\newcommand{\W}{
214−\setlength{\unitlength}{1pt}
215−\begin{picture}(4,10)(0,0)
216−\end{picture}
217−}
218−
219−
220−
221−%%%%%%%%%%%% GUBBINS
222−
223−\newcommand{\mathskip}{\medskip}
224−
225−\newcommand{\fbx}[1]{\fbox{$#1$}}
226−\newcommand{\stk}[1]{\begin{array}{c}#1\end{array}}
227−%\newcommand{\DM}[1]{\hg\mbox{$#1$}}
228−\newcommand{\DM}[1]{\mathskip\par\(#1\)\mathskip}
229−\newcommand{\mbx}[1]{\mathskip\par\noindent\(#1\)\mathskip}
230−\newcommand{\AR}[1]{\begin{array}[t]{@{}l}#1\end{array}}
231−\newcommand{\ARt}[1]{\begin{array}[t]{@{}l@{}cl}#1\end{array}}
232−\newcommand{\ARc}[1]{\begin{array}{@{}l}#1\end{array}}
233−\newcommand{\ARd}[1]{\begin{array}[t]{cl}#1\end{array}}
234−\newcommand{\DAR}[1]{\begin{array}{ll}\hg & #1\end{array}}
235−\newcommand{\Dor}{\\ \hg\mid & }
236−\newcommand{\EA}[1]{\begin{array}[t]{r@{}c@{}l}#1\end{array}}
237−\newcommand{\A}{@{\:}c}
238−%\newcommand{\R}{@{\:}r}
239−\newcommand{\CA}{c}
240−\newcommand{\LA}{l}
241−\newcommand{\PAc}[2]{\begin{array}{l#1@{}r@{}l}#2\end{array}}
242−\newcommand{\PA}[2]{\begin{array}[t]{l@{\:}l#1@{}r@{\:}l}#2\end{array}}
243−\newcommand{\DTREE}[3]{\begin{array}[t]{l#1@{}r@{\:}l#2}#3\end{array}}
244−\newcommand{\IDTREE}[2]{%
245− \begin{array}[t]{l@{\:}c@{\:}l@{\:}r@{\:}l#1}#2\end{array}}
246−\newcommand{\IA}[2]
247− {\begin{array}[t]{l@{\:}r@{\:}c@{\:}l@{\:}#1@{\:}r@{\:}l}#2\end{array}}
248−\newcommand{\IAc}[2]
249− {\begin{array}[c]{r@{\:}c@{\:}l@{\:}#1@{}r@{}l}#2\end{array}}
250−\newcommand{\CS}[1]{\left\lfloor\begin{array}{@{}l}#1\end{array}\right.}
251−\newcommand{\BY}[3]{\multicolumn{2}{l}{\;\RW{by}\; #1} \\ %
252− \multicolumn{#2}{l}{\CS{#3}} }
253−\newcommand{\WITH}[3]{\multicolumn{2}{l}{\;\RW{with}\; #1} \\ %
254− \multicolumn{#2}{l}{\CS{#3}} }
255−\newcommand{\WithBy}{\RW{with-by}}
256−\newcommand{\Wb}[1]{\WithBy& #1}
257−\newcommand{\By}[1]{\multicolumn{2}{l}{\Leftarrow #1}}
258−\newcommand{\andby}{\Leftarrow}
259−\newcommand{\MyWith}[1]{\multicolumn{2}{l}{|\;#1}}
260−\newcommand{\Byr}[1]{\;\RW{by}\; #1}
261−
262−\newcommand{\Bar}{|}
263−\newcommand{\Bart}{\settowidth{\GapLength}{$\Bar$}%
264− \raisebox{6pt}[0pt][0pt]{$\Bar$}%
265− \hspace*{-1\GapLength}%
266− \Bar}
267−\newcommand{\With}[1]{\Bar & #1}
268−\newcommand{\Witt}[1]{\Bart & #1}
269−
270−\newcommand{\B}{@{\:}r@{\:}c}
271−\newcommand{\Ret}[1]{\multicolumn{2}{l}{\cq #1}}
272−\newcommand{\MRet}[2]{\multicolumn{#1}{l}{\cq #2}}
273−\newcommand{\HRet}[1]{\multicolumn{2}{l}{\hq #1}}
274−\newcommand{\MHRet}[2]{\multicolumn{#1}{l}{\hq #2}}
275−\newcommand{\IRet}[1]{\multicolumn{2}{l}{\iq #1}}
276−\newcommand{\IMRet}[2]{\multicolumn{#1}{l}{\iq #2}}
277−\newcommand{\MoRet}[1]{\multicolumn{2}{l}{\mq #1}}
278−\newcommand{\MMoRet}[2]{\multicolumn{#1}{l}{\mq #2}}
279−\newcommand{\Data}{\RW{data}}
280−\newcommand{\Codata}{\RW{codata}}
281−\newcommand{\Where}{\RW{where}}
282−\newcommand{\Let}{\RW{let}}
283−\newcommand{\Fact}{\RW{fact}}
284−\newcommand{\Rec}[1]{#1\textbf{-Rec}}
285−\newcommand{\Memo}[1]{#1\textbf{-Memo}}
286−\newcommand{\Elim}[1]{#1\textbf{-Elim}}
287−\newcommand{\Cases}[1]{#1\textbf{-Case}}
288−\newcommand{\View}[1]{#1\textbf{-View}}
289−\newcommand{\As}[2]{#1 \:\RW{as}\: #2}
290−\newcommand{\nhole}{\Box}
291−\newcommand{\turq}{\:\vdash_?\:}
292−\newcommand{\split}{\;\lhd\;}
293−\newcommand{\CType}[2]{\{#1 \split\; #2\}}
294−\newcommand{\CC}[2]{(#1)\:#2}
295−\newcommand{\UP}[2]{#1 | \{#2\}}
296−\newcommand{\Ured}{\:\Downarrow\:}
297−\newcommand{\gdd}{\prec}
298−\newcommand{\HC}[1]{\left<#1\right>}
299−\newcommand{\HT}[2]{\left<#1 \hab #2\right>}
300−
301−\newcommand{\view}{\RW{view}}
302−\newcommand{\ecase}{\RW{case}}
303−\newcommand{\rec}{\RW{rec}}
304−
305−\newcommand{\If}{\mathsf{if}}
306−\newcommand{\Then}{\mathsf{then}}
307−\newcommand{\Else}{\mathsf{else}}
308−\newcommand{\elim}{\RW{elim}}
309−
310−\newcommand{\Payload}{\mathsf{type}}
311−\newcommand{\Any}{\mathsf{Some}}
312−
313−\newcommand{\lbl}[2]{\langle #1 \Hab #2 \rangle}
314−\newcommand{\call}[2]{\RW{call}\:\langle#1\rangle\:#2}
315−\newcommand{\return}[1]{\RW{return}\:#1}
316−
317−\newcommand{\Remark}[1]{\noindent\textbf{Remark:} #1}
318−
319−\newcommand{\DBOX}[2]{\fbox{\parbox{#1}{\textbf{Definition:}#2}}}
320−
321−\ifthenelse{\boolean{useverb}}{%
322− \newcommand{\useverbtb}[1]{\begin{tiny}\BUseVerbatim{#1}\end{tiny}}
323− \newcommand{\useverb}[1]{\BUseVerbatim{#1}}
324− \newcommand{\useverbs}[1]{\begin{small}\BUseVerbatim{#1}\end{small}}
325− \newcommand{\useverbb}[1]{\begin{small}\BUseVerbatim{#1}\end{small}}
326− \newcommand{\codefig}[2]{\begin{figure}[h]\useverb{#1}\caption{#2}\label{#1}\end{figure}}
327− \newcommand{\codefigs}[2]{\begin{figure}[h]\useverbs{#1}\caption{#2}\label{#1}\end{figure}}
328− \newcommand{\codefigt}[2]{\begin{figure}[t]\useverb{#1}\caption{#2}\label{#1}\end{figure}}
329− \newcommand{\codefigb}[2]{\begin{figure}[b]\useverb{#1}\caption{#2}\label{#1}\end{figure}}
330− \newcommand{\codefigtc}[2]{\begin{figure*}[t]\useverb{#1}\caption{#2}\label{#1}\end{figure}}
331−}{}
332−
333−\newcommand{\diagfig}[3]{\begin{figure}[h]\begin{center}\includegraphics[width=#1]{#2}\end{center}
334−\caption{#3}\label{#2}\end{figure}}
335−\newcommand{\diagfigtc}[3]{\begin{figure*}[t]\begin{center}\includegraphics[width=#1]{#2}\end{center}
336−\caption{#3}\label{#2}\end{figure*}}
337−
338−\newcommand{\FIG}[3]{\begin{figure}[h]\DM{#1}\caption{#2}\label{#3}\end{figure}}
339−\newcommand{\FFIG}[3]{\begin{figure}\begin{center}\DM{#1}\end{center}\caption{#2}\label{#3}\end{figure}}
340−\newcommand{\FFIGB}[3]{\begin{figure}[b]\begin{center}\DM{#1}\end{center}\caption{#2}\label{#3}\end{figure}}
341−\newcommand{\FFIGTC}[3]{\begin{figure*}[t]\begin{center}\DM{#1}\end{center}\caption{#2}\label{#3}\end{figure*}}
342−\newcommand{\PFIG}[3]{\begin{figure}[p]\begin{center}\fbox{\DM{#1}}\end{center}\caption{#2}\label{#3}\end{figure}}
343−\newcommand{\CFIG}[3]{\begin{figure}[h]\begin{center}\DM{#1}\end{center}\caption{#2}\label{#3}\end{figure}}
344−
345−\ifthenelse{\boolean{useverb}}{%
346− \newcommand{\VFIG}[3]{\begin{figure}[h]\begin{boxedverbatim}#1\end{boxedverbatim}\caption{#2}\label{#3}\end{figure}}
347−}{}
348−
349−\newcommand{\TFIG}[4]{\begin{figure}[h]\begin{center}\begin{tabular}{#1}#2\end{tabular}\end{center}\caption{#3}\label{#4}\end{figure}}
350−\newcommand{\TFIGTC}[4]{\begin{figure*}[t]\begin{center}\begin{tabular}{#1}#2\end{tabular}\end{center}\caption{#3}\label{#4}\end{figure*}}
351−
352−\newcommand{\RESFIG}[3]{
353−\TFIG{|l|c|c|c|c|c|c|c|c|}{
354−\hline
355− & \multicolumn{4}{c|}{\Naive{} compilation} &
356− \multicolumn{4}{|c|}{Optimised compilation} \\
357−\cline{2-9}
358−\raisebox{1.5ex}[0pt]{Program} & Instrs & Thunks & Cells &
359−Accesses & Instructions & Thunks & Cells & Accesses \\
360−%\raisebox{1.5ex}[0pt]{Program} & I & T & C & M & I & T & C & M \\
361−\hline
362−#1
363−\hline
364−}{#2}{#3}}
365−
366−\newcommand{\NEWRESFIG}[3]{
367−\TFIG{|l|l|c|c|c|c|}{
368−\hline
369−% & \multicolumn{4}{c|}{\Naive{} compilation} &
370−% \multicolumn{4}{|c|}{Optimised compilation} \\
371−%\cline{2-9}
372−Program & Version & Instructions & Thunks & Memory Accesses & Cells \\
373−%\raisebox{1.5ex}[0pt]{Program} & I & T & C & M & I & T & C & M \\
374−\hline
375−#1
376−}{#2}{#3}}
377−
378−\newcommand{\NEWRESFIGTC}[3]{
379−\TFIGTC{|l|l|c|c|c|c|}{
380−\hline
381−% & \multicolumn{4}{c|}{\Naive{} compilation} &
382−% \multicolumn{4}{|c|}{Optimised compilation} \\
383−%\cline{2-9}
384−Program & Version & Instructions & Thunks & Memory Accesses & Cells \\
385−%\raisebox{1.5ex}[0pt]{Program} & I & T & C & M & I & T & C & M \\
386−\hline
387−#1
388−}{#2}{#3}}
389−
390−\newcommand{\RESLINE}[9]{
391−& \Naive{} & #2 & #3 & #5 & #4 \\
392−#1
393−& Optimised & #6 & #7 & #9 & #8 \\
394−}
395−\newcommand{\RESCHANGE}[4]{
396−& Change & \textbf{#1} & \textbf{#2} & \textbf{#4} & \textbf{#3} \\
397−\hline
398−}
399−\newcommand{\RESCHANGEa}[5]{
400−#5 & Change & \textbf{#1} & \textbf{#2} & \textbf{#4} & \textbf{#3} \\
401−\hline
402−}
403−
404−%%%%%%%%%%%% PUNCTUATION
405−
406−\newcommand{\pad}[2]{#1#2#1}
407−
408−\newcommand{\hab}{\pad{\,}{:}}
409−\newcommand{\Hab}{\pad{\;}{:}}
410−\newcommand{\HHab}{\pad{\;}{::}}
411−
412−%%%%%%%%%%%% TYPE
413−
414−\newcommand{\Type}{\mbox{\texttt{\#}}} %\star}
415−
416−
417−%%%%%%%%%%%%% ARROWS
418−
419−\newcommand{\To}{\pad{\:}{\rightarrow}}
420−\newcommand{\Gets}{\leftarrow}
421−%\newcommand{\car}{\vartriangleright}
422−
423−%%%%%%%%%%%%% QUANTIFIERS
424−
425−\newcommand{\lam}[2]{\lambda#1\pad{\!}{:}#2}
426−\newcommand{\fbind}[3]{(#1\Hab#2)\to#3}
427−\newcommand{\all}[2]{\forall#1\pad{\!}{:}#2}
428−\newcommand{\hole}[2]{?#1\pad{\!}{:}#2}
429−\newcommand{\guess}[3]{?#1\pad{\!}{:}#2\approx#3}
430−\newcommand{\remlam}[2]{\lambda\{#1\pad{\!}{:}#2\}}
431−\newcommand{\remall}[2]{\forall\{#1\pad{\!}{:}#2\}}
432−\newcommand{\allpi}[2]{\Pi#1\pad{\!}{:}#2}
433−\newcommand{\ali}[2]{\forall#1|#2}
434−\newcommand{\exi}[2]{\exists#1\pad{\!}{:}#2}
435−\newcommand{\wit}[2]{\ang{#1,#2}}
436−\newcommand{\X}{\times}
437−\newcommand{\sig}[2]{\Sigma#1\pad{\!}{:}#2}
438−
439−\newcommand{\SC}{.\:}
440−
441−\newcommand{\letbind}[3]{\mathsf{let}\:#1{:}#2\:=\:#3\:\mathsf{in}}
442−\newcommand{\ifthen}[3]{\mathsf{if}\:#1\:\mathsf{then}\:#2\:\mathsf{else}\:#3}
443−
444−%%%%%%%%%%%%% EQUALITIES
445−
446−\newcommand{\cq}{\pad{\:}{\mapsto}}
447−\newcommand{\xq}{\pad{}{\doteq}}
448−\newcommand{\pq}{\pad{\:}{=}}
449−\newcommand{\dq}{\pad{\:}{:=}}
450−\newcommand{\iq}{\pad{\:}{\leadsto}}
451−\newcommand{\mq}{\Longrightarrow}
452−\newcommand{\retq}{\Rightarrow}
453−\newcommand{\hq}{\pad{\:}{=}}
454−\newcommand{\defq}{\mapsto}
455−
456−\newcommand{\refl}{\TC{refl}}
457−
458−
459−
460−
461−%%%%%%%%%%%%% CATSTUFF
462−
463−\newlength{\Lwibrs}
464−\newlength{\Lwobrs}
465−\newsavebox{\Bwibrs}
466−\newsavebox{\Bwobrs}
467−\newcommand{\Db}[5]{%
468− \savebox{\Bwobrs}[\width][b]{$#5$}%
469− \savebox{\Bwibrs}[\width][b]{$\left#2\usebox{\Bwobrs}\right#3$}%
470− \settowidth{\Lwobrs}{\usebox{\Bwobrs}}%
471− \settowidth{\Lwibrs}{\usebox{\Bwibrs}}%
472− \addtolength{\Lwibrs}{-\Lwobrs}%
473− \left#1\pad{\hspace*{-0.25\Lwibrs}}{\usebox{\Bwibrs}}\right#4}
474−\newcommand{\LDb}[3]{%
475− \savebox{\Bwobrs}[\width][b]{$#3$}%
476− \savebox{\Bwibrs}[\width][b]{$\left#2\usebox{\Bwobrs}\right.$}%
477− \settowidth{\Lwobrs}{\usebox{\Bwobrs}}%
478− \settowidth{\Lwibrs}{\usebox{\Bwibrs}}%
479− \addtolength{\Lwibrs}{-\Lwobrs}%
480− \left#1\hspace*{-0.4\Lwibrs}\usebox{\Bwibrs}\right.}
481−\newcommand{\RDb}[3]{%
482− \savebox{\Bwobrs}[\width][b]{$#3$}%
483− \savebox{\Bwibrs}[\width][b]{$\left.\usebox{\Bwobrs}\right#1$}%
484− \settowidth{\Lwobrs}{\usebox{\Bwobrs}}%
485− \settowidth{\Lwibrs}{\usebox{\Bwibrs}}%
486− \addtolength{\Lwibrs}{-\Lwobrs}%
487− \left.\usebox{\Bwibrs}\hspace*{-0.4\Lwibrs}\right#2}
488−\newcommand{\Sc}{\Db{[}{[}{]}{]}}
489−\newcommand{\Mo}{\Db{|}{>}{<}{|}}
490−\newcommand{\MoL}{\LDb{|}{>}}
491−\newcommand{\MoR}{\RDb{<}{|}}
492−
493−\newcommand{\car}{\mbox{$-\!\triangleright$}}
494−\newcommand{\io}[1]{\iota_{#1}}
495−\newcommand{\cc}{\diamond}
496−
497−
498−%%%%%%%%%%%%% FNS
499−
500−\newcommand{\Wk}{\Uparrow}
501−
502−%%%%%%%%%%%%% Transformation
503−
504−\newcommand{\Transform}[3]{\textsc{Trans}\:_{\Name{#1}}
505− \interp{#2}\:\mq\:#3}
506−%\:[\:#2\:\Longrightarrow\:#3\:]}
507−\newcommand{\Morphism}[2]{\textsc{Morphism}\:#1\:\Longrightarrow\:#2}
508−\newcommand{\MI}[1]{\begin{array}{ll} #1 \end{array}\\}
509−\newcommand{\MorphItem}[2]{& #1 \:\Longrightarrow\: #2}
510−
511−%%%%%%%%%%%%% Stuff
512−
513−% Motive and methods
514−
515−\newcommand{\motive}{\vP}
516−\newcommand{\meth}[1]{\vm_{#1}}
517−
518−% Tuples
519−\newcommand{\tuple}[1]{\langle#1\rangle}
520−\newcommand{\Tuple}[1]{\mathsf{Tuple}}
521−\newcommand{\proj}{\mathsf{proj}}
522−\newcommand{\app}{\mathrm{+\!+}}
523−
524−% Commenting out
525−\newcommand{\ig}[1]{[#1]}
526−\newcommand{\rem}[1]{\{\!#1\!\}}
527−\newcommand{\igc}[1]{[#1]}
528−\newcommand{\remc}[1]{\{\!#1\!\}}
529−
530−
531−\newcommand{\ind}{\hspace*{0.1cm}}
532−
533−% Content free type
534−\newcommand{\CF}{\TC{CF}}
535−\newcommand{\cf}{\DC{cf}}
536−
537−% Error token
538−\newcommand{\error}{\DC{error}}
539−\newcommand{\fail}{\perp}
540−
541−% Constructor stripping
542−\newcommand{\conarg}[2]{#1!#2}
543−
544−\newcommand{\Vect}{\TC{Vect}}
545−\newcommand{\VectM}{\TC{Vect^-}}
546−\newcommand{\Vnil}{\DC{\epsilon}}
547−\newcommand{\Vcons}{\DC{::}}
548−
549−\newcommand{\Vsnoc}{\DC{::}}
550−
551−\newcommand{\VnilM}{\DC{\epsilon^-}}
552−\newcommand{\VconsM}{\DC{::^-}}
553−
554−\newcommand{\Vnilcase}{\VV{vNilCase}}
555−\newcommand{\Vconscase}{\VV{vConsCase}}
556−
557−\newcommand{\DSigma}{\TC{Sigma}}
558−\newcommand{\Exists}{\DC{Exists}}
559−
560−\newcommand{\ListPair}[2]{\sig{#1}{\List\:\vA}.#2 = \FN{length}\:#1}
561−\newcommand{\lpNilDef}{\lpNil{\FN{refl}\:\Z}}
562−\newcommand{\lpNil}[1]{(\nil\:\vA,#1)}
563−\newcommand{\lpConsDef}[3]{\lpCons{#1}{(\FN{fst\:#2})}{\FN{resp}\:(\FN{snd}\:#2)}}
564−\newcommand{\lpCons}[3]{(\cons\:#1\:#2,#3)}
565−\newcommand{\lp}[2]{(#1, #2)}
566−
567−\newcommand{\VnilTop}{\DC{vNil}^\ast}
568−\newcommand{\VconsTop}{\DC{vCons}^\ast}
569−
570−\newcommand{\VnilBot}{\DC{\epsilon}^-}
571−\newcommand{\VconsBot}{\DC{::}^-}
572−
573−\newcommand{\VectTop}{\TC{Vect}^\ast}
574−\newcommand{\VectBot}{\TC{Vect}^-}
575−
576−\newcommand{\VectDrop}{\FN{vectDropIdx}}
577−\newcommand{\VectRebuild}{\FN{vectRebuild}}
578−
579−\newcommand{\Prop}{\TC{Prop}}
580−\newcommand{\Set}{\TC{Set}}
581−\newcommand{\CoqType}{\TC{Type}}
582−
583−\newcommand{\List}{\TC{List}}
584−\newcommand{\nil}{\DC{nil}}
585−\newcommand{\cons}{\DC{cons}}
586−
587−\newcommand{\Zip}{\TC{Tsil}}
588−\newcommand{\zip}{\FN{tsil}}
589−\newcommand{\zipcons}{\FN{tsilcons}}
590−\newcommand{\snoc}{\DC{Snoc}}
591−\newcommand{\lin}{\DC{Empty}}
592−
593−\newcommand{\BigInt}{\TC{BigInt}}
594−\newcommand{\False}{\TC{False}}
595−\newcommand{\Unit}{\TC{Unit}}
596−\newcommand{\UnitI}{\DC{unit}}
597−
598−\newcommand{\genType}{\TC{X}}
599−\newcommand{\genIndicesDec}{\tb\Hab\tB}
600−\newcommand{\genIndices}{\tb}
601−\newcommand{\genConArgsDec}[1]{\vec{\VV{a_#1}}\Hab\vec{\VV{A_#1}}}
602−\newcommand{\genConArgs}[1]{\vec{\VV{a_#1}}}
603−\newcommand{\genConIndicesDec}[1]{\vec{\VV{b_#1}}\Hab\vec{\VV{B_#1}}}
604−\newcommand{\genConIndices}[1]{\vec{\VV{b_#1}}}
605−\newcommand{\genCon}[1]{\DC{x}_#1}
606−
607−\newcommand{\genTypeTop}{\TC{X^\ast}}
608−\newcommand{\genTypeBot}{\TC{X^-}}
609−
610−\newcommand{\genTypeDrop}{\FN{XDropIdx}}
611−\newcommand{\genTypeRebuild}{\FN{XRebuild}}
612−
613−\newcommand{\HTerm}{\texttt{Term}}
614−\newcommand{\Term}{\TC{Term}}
615−\newcommand{\Var}{\DC{var}}
616−\newcommand{\Lam}{\DC{lam}}
617−\newcommand{\App}{\DC{app}}
618−\newcommand{\TermM}{\TC{Term^-}}
619−\newcommand{\VarM}{\DC{var^-}}
620−\newcommand{\LamM}{\DC{lam^-}}
621−\newcommand{\AppM}{\DC{app^-}}
622−\newcommand{\Env}{\TC{Env}}
623−\newcommand{\SType}{\TC{STy}}
624−\newcommand{\farrow}{\Rightarrow}
625−\newcommand{\lookup}{\FN{lookup}}
626−
627−% \newcommand{\source}{\Lang{TT}}
628−\newcommand{\source}{\textbf{DT-Res}}
629−\newcommand{\target}{\Lang{ExTT}}
630−\newcommand{\runtime}{\Lang{RunTT}}
631−
632−\newcommand{\lt}{\TC{<}}
633−\newcommand{\ltO}{\DC{ltO}}
634−\newcommand{\ltS}{\DC{ltS}}
635−
636−\newcommand{\interp}[1]{\llbracket #1 \rrbracket}
637−\newcommand{\inferrable}[2]{\FN{inferrable}(#1,#2)}
638−\newcommand{\mkPat}{\FN{mkPat}}
639−
640−\newcommand{\FinM}{\TC{Fin^-}}
641−\newcommand{\fzM}{\DC{f0^-}}
642−\newcommand{\fsM}{\DC{fs^-}}
643−
644−\newcommand{\concat}{\mathrm{++}}
645−
646−%\newcommand{\bottom}{\perp}
647−
648−% Reductions
649−
650−\newcommand{\reduces}{\mapsto}
651−\newcommand{\translation}{\Rightarrow}
652−%\newcommand{\reducesn}[1]{\reduces\hspace*{-0.15cm}_{#1}}
653−%\newcommand{\reducesto}{\reduces\hspace*{-0.15cm}^{*}}
654−\newcommand{\reducesn}[1]{\reduces_{#1}}
655−\newcommand{\reducesto}{\reduces^{*}}
656−
657−% Equality
658−
659−\newcommand{\Refl}{\DC{refl}}
660−\newcommand{\leZ}{\DC{O_{\le}}}
661−\newcommand{\leS}{\DC{S_{\le}}}
662−
663−% Random elimination things
664−
665−\newcommand{\lte}{\TC{\leq}}
666−\newcommand{\lten}{\DC{leN}}
667−\newcommand{\lteO}{\DC{leO}}
668−\newcommand{\lteS}{\DC{leS}}
669−
670−\newcommand{\ltelim}{\Elim{\lt}}
671−\newcommand{\leelim}{\Elim{\lte}}
672−
673−\newcommand{\dD}{\TC{D}}
674−\newcommand{\delim}{\Elim{\TC{D}}}
675−\newcommand{\drec}{\Rec{\TC{D}}}
676−\newcommand{\dcase}{\Cases{\TC{D}}}
677−\newcommand{\dview}{\View{\TC{D}}}
678−\newcommand{\dmemo}{\Memo{\TC{D}}}
679−\newcommand{\natrec}{\Rec{\Nat}}
680−\newcommand{\natmemo}{\Memo{\Nat}}
681−\newcommand{\natmemogen}{\Nat\textbf{-MemoGen}}
682−\newcommand{\natelim}{\Elim{\Nat}}
683−\newcommand{\boolcase}{\Cases{\Bool}}
684−\newcommand{\vectrec}{\Rec{\Vect}}
685−\newcommand{\vectelim}{\Elim{\Vect}}
686−\newcommand{\listrec}{\Rec{\List}}
687−\newcommand{\listelim}{\Elim{\List}}
688−\newcommand{\finrec}{\Rec{\Fin}}
689−\newcommand{\finelim}{\Elim{\Fin}}
690−\newcommand{\natcase}{\Cases{\Nat}}
691−\newcommand{\vectcase}{\Cases{\Vect}}
692−\newcommand{\natdoublerec}{\Nat\textbf{-double-elim}}
693−\newcommand{\eqelim}{=\textbf{-elim}}
694−\newcommand{\falsecase}{\Cases{\False}}
695−
696−% Code
697−\ifthenelse{\boolean{useverb}}{%
698− \newcommand{\Haskell}[1]{\begin{quotation}\begin{verbatim}#1\end{verbatim}\end{quotation}}
699−}{}
700−% Quicksort
701−
702−\newcommand{\QSView}{\TC{QuickSort}}
703−\newcommand{\qsempty}{\DC{empty}}
704−\newcommand{\partition}{\DC{partition}}
705−\newcommand{\qsview}{\FN{mkQuickSort}}
706−
707−% More gubbins
708−
709−\newcommand{\converts}{\simeq}
710−\newcommand{\cumul}{\preceq}
711−\newcommand{\whnf}{\Downarrow}
712−\newcommand{\elem}{\in}
713−\newcommand{\proves}{\vdash}
714−\newcommand{\biimplies}{\Longleftrightarrow}
715−
716−\newcommand{\lc}{\lambda_{\mathsf{AC}}}
717−\newcommand{\zed}{\mathbb{Z}}
718−
719−% Haskell keywords
720−
721−\newcommand{\hdata}{\mathtt{data}}
722−\newcommand{\newtype}{\mathtt{newtype}}
723−%\newcommand{\htype}{\mathtt{type}}
724−
725−\newcommand{\HTC}[1]{\mathtt{#1}}
726−\newcommand{\HDC}[1]{\mathtt{#1}}
727−
728−% Nobby
729−
730−\newcommand{\Value}{\HTC{Value}}
731−\newcommand{\VGamma}{\HTC{Env}}
732−\newcommand{\Ctxt}{\HTC{Ctxt}}
733−\newcommand{\Defs}{\HTC{Defs}}
734−\newcommand{\ECtxt}{\HTC{ECtxt}}
735−\newcommand{\TCtxt}{\HTC{TCtxt}}
736−\newcommand{\VG}{\HDC{Env}}
737−\newcommand{\Model}{\HTC{Model}}
738−\newcommand{\Const}{\HTC{Const}}
739−\newcommand{\Normal}{\HTC{Normal}}
740−\newcommand{\Scope}{\HTC{Scope}}
741−\newcommand{\Kripke}{\HTC{Kripke}}
742−\newcommand{\Weakening}{\HTC{Weakening}}
743−\newcommand{\Ready}{\HTC{Ready}}
744−\newcommand{\Blocked}{\HTC{Blocked}}
745−\newcommand{\Spine}{\HTC{Spine}}
746−
747−\newcommand{\BV}{\HDC{BV}}
748−\newcommand{\BCon}{\HDC{BCon}}
749−\newcommand{\BTyCon}{\HDC{BTyCon}}
750−\newcommand{\RCon}{\HDC{RCon}}
751−\newcommand{\RTyCon}{\HDC{RTyCon}}
752−\newcommand{\BElim}{\HDC{BElim}}
753−\newcommand{\DV}{\HDC{V}}
754−\newcommand{\DP}{\HDC{P}}
755−
756−\newcommand{\MR}{\HDC{R}}
757−\newcommand{\MB}{\HDC{B}}
758−\newcommand{\DSc}{\HDC{Sc}}
759−\newcommand{\DKr}{\HDC{Kr}}
760−\newcommand{\DWk}{\HDC{Wk}}
761−\newcommand{\DSnoc}{\HDC{;}}
762−\newcommand{\DType}{\HDC{Type}}
763−\newcommand{\DName}{\HDC{Name}}
764−\newcommand{\DInt}{\HDC{Int}}
765−\newcommand{\DString}{\HDC{String}}
766−\newcommand{\DElim}{\HDC{Elim}}
767−\newcommand{\Empty}{\HDC{\emptyset}}
768−
769−\newcommand{\ConCode}{\HTC{ConCode}}
770−\newcommand{\ElimRule}{\HTC{ElimRule}}
771−
772−\newcommand{\DConst}{\HDC{Const}}
773−\newcommand{\DCon}{\HDC{Con}}
774−\newcommand{\DTyCon}{\HDC{TyCon}}
775−\newcommand{\RConst}{\HDC{RConst}}
776−\newcommand{\RLam}{\HDC{RLam}}
777−\newcommand{\RPi}{\HDC{RPi}}
778−\newcommand{\DLam}{\HDC{Lam}}
779−\newcommand{\DLet}{\HDC{Let}}
780−\newcommand{\DPi}{\HDC{Pi}}
781−\newcommand{\DApp}{\HDC{App}}
782−
783−\newcommand{\TMaybe}{\HTC{Maybe}}
784−\newcommand{\DNothing}{\HDC{Nothing}}
785−\newcommand{\DJust}{\HDC{Just}}
786−
787−
788−% G-machine and heap
789−
790−\newcommand{\PUSH}{\mathsf{PUSH}}
791−\newcommand{\PUSHNAME}{\mathsf{PUSHNAME}}
792−\newcommand{\POP}{\mathsf{DISCARD}}
793−\newcommand{\PUSHFUN}{\mathsf{PUSHFUN}}
794−\newcommand{\APPLY}{\mathsf{MKAP}}
795−\newcommand{\EVAL}{\mathsf{EVAL}}
796−\newcommand{\GCON}{\mathsf{MKCON}}
797−\newcommand{\GTUP}{\mathsf{MKTUP}}
798−\newcommand{\GTYPE}{\mathsf{MKTYPE}}
799−\newcommand{\UPDATE}{\mathsf{UPDATE}}
800−\newcommand{\RET}{\mathsf{RET}}
801−\newcommand{\UNWIND}{\mathsf{UNWIND}}
802−\newcommand{\CASEJUMP}{\mathsf{CASEJUMP}}
803−\newcommand{\LABEL}{\mathsf{LABEL}}
804−\newcommand{\MOVE}{\mathsf{MOVE}}
805−\newcommand{\JUMP}{\mathsf{JUMP}}
806−\newcommand{\SPLIT}{\mathsf{SPLIT}}
807−\newcommand{\SQUEEZE}{\mathsf{SQUEEZE}}
808−\newcommand{\JFUN}{\mathsf{JFUN}}
809−\newcommand{\PROJ}{\mathsf{PROJ}}
810−\newcommand{\ERROR}{\mathsf{ERROR}}
811−\newcommand{\SLIDE}{\mathsf{SLIDE}}
812−\newcommand{\ALLOC}{\mathsf{ALLOC}}
813−
814−\newcommand{\PUSHBIG}{\mathsf{PUSHBIG}}
815−\newcommand{\PUSHBASIC}{\mathsf{PUSHBASIC}}
816−\newcommand{\PUSHINT}{\mathsf{PUSHINT}}
817−\newcommand{\PUSHBOOL}{\mathsf{PUSHBOOL}}
818−\newcommand{\GET}{\mathsf{GET}}
819−\newcommand{\MKINT}{\mathsf{MKINT}}
820−\newcommand{\MKBOOL}{\mathsf{MKBOOL}}
821−\newcommand{\ADD}{\mathsf{ADD}}
822−\newcommand{\SUB}{\mathsf{SUB}}
823−\newcommand{\MULT}{\mathsf{MULT}}
824−\newcommand{\LT}{\mathsf{LT}}
825−\newcommand{\EQ}{\mathsf{EQ}}
826−\newcommand{\GT}{\mathsf{GT}}
827−\newcommand{\JTRUE}{\mathsf{JTRUE}}
828−
829−\newcommand{\APP}{\mathsf{APP}}
830−\newcommand{\FUN}{\mathsf{FUN}}
831−\newcommand{\CON}{\mathsf{CON}}
832−\newcommand{\TYCON}{\mathsf{TYCON}}
833−\newcommand{\TUP}{\mathsf{TUP}}
834−\newcommand{\TYPE}{\mathsf{TYPE}}
835−\newcommand{\INT}{\mathsf{INT}}
836−\newcommand{\BIGINT}{\mathsf{BIGINT}}
837−\newcommand{\BOOL}{\mathsf{BOOL}}
838−\newcommand{\HOLE}{\mathsf{HOLE}}
839−
840−% G machine translation scheme
841−
842−\newcommand{\sinterp}[1]{\mathcal{S}\interp{#1}}
843−\newcommand{\sinterpm}[1]{\mathcal{S}\AR{\interp{#1}}}
844−\newcommand{\einterp}[3]{\mathcal{E}\interp{#1}\:#2\:#3}
845−\newcommand{\cinterp}[3]{\mathcal{C}\interp{#1}\:#2\:#3}
846−\newcommand{\binterp}[3]{\mathcal{B}\interp{#1}\:#2\:#3}
847−\newcommand{\rinterp}[3]{\mathcal{R}\interp{#1}\:#2\:#3}
848−\newcommand{\iinterp}[3]{\mathcal{I}\interp{#1}\:#2\:#3}
849−\newcommand{\len}[1]{\MO{length}(#1)}
850−
851−\newcommand{\casecomp}[2]{\mathcal{I}(#1,\left\{\ARc{#2}\right\})}
852−\newcommand{\casecompA}[3]{\mathcal{I}(#1,\left\{\ARc{#2}\right\}[#3])}
853−\newcommand{\ischeme}{\mathcal{I}}
854−
855−% tail call markup
856−
857−\newcommand{\tailcall}{\mathsf{tail}}
858−
859−% Trees
860−
861−\newcommand{\Tree}{\TC{Tree}}
862−\newcommand{\Leaf}{\DC{Leaf}}
863−\newcommand{\Node}{\DC{Node}}
864−\newcommand{\treecase}{\Cases{\Tree}}
865−
866−% Languages
867−
868−\newcommand{\Coq}{\textsc{Coq}}
869−\newcommand{\Lego}{\textsc{Lego}}
870−\newcommand{\Oleg}{\textsc{Oleg}}
871−\newcommand{\Alf}{\textsc{Alf}}
872−\newcommand{\Epigram}{\textsc{Epigram}}
873−\newcommand{\SystemF}{System $\mathcal{F}$}
874−\newcommand{\Iswim}{\textsc{Iswim}}
875−\newcommand{\Cynthia}{\textit{C$^Y$\hspace*{-0.1cm}NTHIA}}
876−
877−% Accessibility
878−
879−\newcommand{\Acc}{\TC{Acc}}
880−\newcommand{\acc}{\DC{acc}}
881−\newcommand{\qsAcc}{\TC{qsAcc}}
882−\newcommand{\qsNil}{\DC{qsNil}}
883−\newcommand{\qsCons}{\DC{qsCons}}
884−\newcommand{\allQsAcc}{\FN{allQsAcc}}
885−
886−% Lazy shortcuts
887−
888−\newcommand{\naive}{na\"{\i}ve}
889−\newcommand{\Naive}{Na\"{\i}ve}
890−
891−% Conor's bits
892−
893−\newcommand{\remem}[1]{\left|#1\right|}
894−\newcommand{\idsb}{\MO{id}}
895−\newcommand{\ang}[1]{\langle#1\rangle}
896−
897−\newcommand{\vePm}[1]{\vP #1 \vm_{\Vnil} #1 \vm_{\Vcons}}%
898−\newcommand{\vcrhs}{\vm_{\Vcons}\:\vk\:\va\:\vv\:%
899− (\vectelim\:\vA\:\vk\:\vv\:\vePm{\:})}%
900−
901−\newcommand{\igV}[2]{#1^{\ig{#2}}}
902−\newcommand{\remV}[2]{#1^{\rem{#2}}}
903−
904−% More gubbins
905−
906−\newcommand{\Between}{\TC{between}}
907−\newcommand{\bZ}{\DC{bO}}
908−\newcommand{\bZZS}{\DC{bOOs}}
909−\newcommand{\bZSS}{\DC{b0ss}}
910−\newcommand{\bSSS}{\DC{bsss}}
911−\newcommand{\betelim}{\Elim{\Between}}
912−\newcommand{\betrhs}[1]{\motive#1\meth{\bZ}#1\meth{\bZZS}#1\meth{\bZSS}#1\meth{\bSSS}}
913−
914−
915−\newcommand{\valenv}{\TC{ValEnv}}
916−\newcommand{\vempty}{\DC{empty}}
917−\newcommand{\vextend}{\DC{extend}}
918−
919−\newcommand{\EpiVal}{\TC{Epigram}}
920−\newcommand{\unsafeCoerce}{\HF{unsafeCoerce\mbox{\texttt{\#}}}}
921−
922−\newcommand{\qq}{\mbox{\texttt{"}}}
923−\newcommand{\impossible}{\RW{Impossible}}
924−
925−\newcommand{\Real}{\mathbb{R}}
926−
927−\newcommand{\DoubleRec}{\TC{DoubleElim}}
928−\newcommand{\DoubleOn}{\DC{Double_{\Z\vn}}}
929−\newcommand{\DoubleSO}{\DC{Double_{\suc\Z}}}
930−\newcommand{\DoubleSS}{\DC{Double_{\suc\suc}}}
931−
932−\newcommand{\doublerec}{\textbf{double-elim}}
933−
934−\newcommand{\set}{\TC{DList}}
935−\newcommand{\setuser}{\TC{DListTop}}
936−\newcommand{\setempty}{\emptyset}
937−\newcommand{\setinsert}{\DC{insert}}
938−
939−
940−%%%% Type systems
941−
942−\newcommand{\stlc}{\lambda\hspace*{-0.15cm}\to}
943−\newcommand{\plc}{\lambda2}
944−\newcommand{\dlc}{\lambda{}P}
945−
946−\newcommand{\EC}{\mathcal{E}}
947−
948−%%%% reductions
949−
950−\newcommand{\betared}{\iq\hspace*{-0.15cm}_{\beta}}
951−\newcommand{\deltared}{\iq\hspace*{-0.15cm}_{\delta}}
952−\newcommand{\gammared}{\iq\hspace*{-0.15cm}_{\gamma}}
953−\newcommand{\etared}{\iq\hspace*{-0.15cm}_{\eta}}
954−\newcommand{\iotared}{\iq\hspace*{-0.15cm}_{\iota}}
955−\newcommand{\rhored}{\iq\hspace*{-0.15cm}_{\rho}}
956−
957−%%%% ExTT rules
958−
959−\newcommand{\exconverts}{\stackrel{\mathsf{Ex}}{\converts}}
960−\newcommand{\excumul}{\stackrel{\mathsf{Ex}}{\cumul}}
961−\newcommand{\exequiv}{\stackrel{\mathsf{Ex}}{\equiv}}
962−\newcommand{\exreduces}{\stackrel{\mathsf{Ex}}\reduces}
963−\newcommand{\exreducesto}{\stackrel{\mathsf{Ex}}{\reducesto}}
964−\newcommand{\exreducesn}[1]{\exreduces_{#1}}
965−
966−\newcommand{\ttequiv}{\stackrel{\mathsf{TT}}{\equiv}}
967−\newcommand{\ttreduces}{\stackrel{\mathsf{TT}}\reduces}
968−\newcommand{\ttreducesn}[1]{\ttreduces_{#1}}
969−
970−%%% Type synthesis
971−
972−\newcommand{\hastype}{\Longrightarrow}
973−\newcommand{\whnfs}{\twoheadrightarrow}
974−\newcommand{\conv}{\converts}
975−
976−\newcommand{\exhastype}{\stackrel{\mathsf{Ex}}{\hastype}}
977−\newcommand{\exwhnfs}{\stackrel{\mathsf{Ex}}{\whnfs}}
978−\newcommand{\exconv}{\stackrel{\mathsf{Ex}}{\conv}}
979−\newcommand{\exproves}{\stackrel{\mathsf{Ex}}{\proves}}
980−
981−\newcommand{\tthastype}{\stackrel{\mathsf{TT}}{\hastype}}
982−\newcommand{\ttwhnfs}{\stackrel{\mathsf{TT}}{\whnfs}}
983−\newcommand{\ttconv}{\stackrel{\mathsf{TT}}{\conv}}
984−\newcommand{\ttproves}{\stackrel{\mathsf{TT}}{\proves}}
985−
986−%%% Lightning
987−
988−\newcommand{\light}[1]{\lightning^{#1}}
989−\newcommand{\LHab}[1]{\pad{\;}{:^{#1}}}
990−\newcommand{\llam}[3]{\lambda#1\pad{\!}{:}^{#2}#3}
991−\newcommand{\lall}[3]{\forall#1\pad{\!}{:}^{#2}#3}
992−\newcommand{\lapp}[3]{#1(#2)^{#3}}
993−\newcommand{\larg}[2]{(#1)^{#2}}
994−
995−\newcommand{\RName}[1]{\hspace*{0.1in}\mathsf{#1}}
996−
997−%%% LOcal macros
998−
999−\newcommand{\ResState}{\TC{ResourceState}}
1000−\newcommand{\Locked}{\DC{Locked}}
1001−\newcommand{\ResHandle}{\TC{ResourceHandle}}
1002−\newcommand{\Res}{\DC{Resource}}
1003−\newcommand{\CLang}{\TC{CLang}}
1004−\newcommand{\CFLang}{\TC{CFLang}}
1005−\newcommand{\CFType}{\TC{CFType}}
1006−\newcommand{\CLType}{\TC{CType}}
1007−\newcommand{\RHandle}{\DC{RHandle}}
1008−\newcommand{\RType}{\DC{RType}}
1009−\newcommand{\RUnit}{\DC{RUnit}}
1010−\newcommand{\LOCK}{\DC{LOCK}}
1011−\newcommand{\UNLOCK}{\DC{UNLOCK}}
1012−\newcommand{\ACTION}{\DC{ACTION}}
1013−\newcommand{\FORK}{\DC{FORK}}
1014−
1015−\newcommand{\FSLang}{\TC{FSLang}}
1016−\newcommand{\OPEN}{\DC{OPEN}}
1017−\newcommand{\CLOSE}{\DC{CLOSE}}
1018−\newcommand{\READ}{\DC{READ}}
1019−\newcommand{\WRITE}{\DC{WRITE}}
1020−\newcommand{\PRINT}{\DC{PRINT}}
1021−\newcommand{\BIND}{\DC{BIND}}
1022−
1023−\newcommand{\FSType}{\TC{FSType}}
1024−\newcommand{\FHandle}{\DC{FHandle}}
1025−\newcommand{\FString}{\DC{FString}}
1026−\newcommand{\FUnit}{\DC{FUnit}}
1027−\newcommand{\ElemIs}{\TC{ElemIs}}
1028−\newcommand{\elemHd}{\TC{atHead}}
1029−\newcommand{\elemTl}{\TC{inTail}}
1030−
1031−\newcommand{\emptyEnv}{\DC{empty}}
1032−\newcommand{\extendEnv}{\DC{extend}}
1033−
1034−\newcommand{\usera}{\FN{Alice}}
1035−\newcommand{\userb}{\FN{Bob}}
1036−\newcommand{\userc}{\FN{Charlie}}
1037−
1038−\newcommand{\FAcc}{\TC{FAcc}}
1039−\newcommand{\UserA}{\DC{UserAcc}}
1040−\newcommand{\GroupA}{\DC{GroupAcc}}
1041−\newcommand{\GlobalA}{\DC{GlobalAcc}}
1042−
1043−\newcommand{\Perm}{\TC{Perm}}
1044−\newcommand{\Username}{\TC{Username}}
1045−\newcommand{\GroupData}{\TC{GroupData}}
1046−\newcommand{\File}{\TC{File}}
1047−\newcommand{\FS}{\DC{file}}
1048−\newcommand{\Filepath}{\TC{Filepath}}
1049−
1050−\newcommand{\Read}{\DC{Read}}
1051−\newcommand{\Write}{\DC{Write}}
1052−\newcommand{\Execute}{\DC{Execute}}
1053−
1054−\newcommand{\Purpose}{\TC{Mode}}
1055−\newcommand{\Reading}{\DC{Reading}}
1056−\newcommand{\Writing}{\DC{Writing}}
1057−
1058−\newcommand{\FileState}{\TC{FileState}}
1059−\newcommand{\FileHandle}{\TC{FileHandle}}
1060−\newcommand{\OpenH}{\DC{OpenH}}
1061−\newcommand{\ClosedH}{\DC{ClosedH}}
1062−\newcommand{\Handle}{\TC{Handle}}
1063−\newcommand{\Open}{\DC{Open}}
1064−\newcommand{\Closed}{\DC{Closed}}
1065−
1066−\newcommand{\UserIO}{\TC{UserIO}}
1067−\newcommand{\uio}{\DC{uio}}
1068−
1069−\newcommand{\CFS}{\TC{C_{fs}}}
1070−\newcommand{\RFS}{\FN{R_{fs}}}
1071−
1072−\newcommand{\String}{\TC{String}}
1073−
1074−% inline idris code
1075−
1076−\newcommand{\Tcon}[1]{\texttt{#1}}
1077−\newcommand{\Dcon}[1]{\texttt{#1}}
1078−\newcommand{\Fname}[1]{\texttt{#1}}
1079−\newcommand{\Vv}[1]{\texttt{#1}}
1080−\newcommand{\TyTy}{\texttt{\#}}
1081−
1082−\newcommand{\direct}[1]{\texttt{\%#1}}
1083−
1084−\newcommand{\Feature}[1]{\textbf{Remark:}}
1085−
1086−\endinput
tutorial/idris-tutorial.texdeleted−56
@@ -1,56 +0,0 @@
1−\documentclass[british, final]{article}
2−
3−\usepackage[l2tabu,orthodox]{nag}
4−\usepackage{fixltx2e}
5−\usepackage{babel}
6−\usepackage[iso]{isodate}
7−\usepackage[utf8]{inputenc}
8−\usepackage[T1]{fontenc}
9−\usepackage[protrusion=true, expansion=true]{microtype}
10−\usepackage[strict=true]{csquotes}
11−\usepackage{xspace}
12−
13−\usepackage{mathpazo}
14−\usepackage[scaled=0.95]{helvet}
15−\usepackage{courier}
16−
17−\usepackage{fullpage}
18−\usepackage{hyperref}
19−\usepackage[missing=0.9.10]{gitinfo}
20−
21−\usepackage{fpmacros}
22−\usepackage[numbers]{idrislang}
23−
24−\input{conf.ltx}
25−\input{library.ltx}
26−
27−\newcommand{\version}{\gitVtagn}
28−
29−\title{Programming in \Idris{}: a tutorial}
30−\author{The \Idris{} Community}
31−\date{\origdate\today}
32−
33−\begin{document}
34−
35−\maketitle
36−
37−\tableofcontents
38−\newpage
39−
40−\input{./content/intro}
41−\input{./content/starting}
42−\input{./content/typesfuns}
43−\input{./content/classes}
44−\input{./content/modules}
45−\input{./content/interp}
46−\input{./content/views}
47−\input{./content/theorems}
48−\input{./content/provisional}
49−\input{./content/syntax}
50−\input{./content/miscellany}
51−\input{./content/conclusions}
52−
53−\bibliographystyle{abbrv}
54−\bibliography{literature.bib}
55−
56−\end{document}
tutorial/idrislang.stydeleted−190
@@ -1,190 +0,0 @@
1−%% --------------------------------------------------- [ Idris Styling Package ]
2−%%
3−%% A set of LaTeX macros and styling for working with Idris in LaTeX
4−%%
5−%% + Provides a listings bindings:
6−%% + idris :: default ascii
7−%% + literateidris :: convert ascii maths to math symbols.
8−%% + Defines a `numbers' and `default' listings style.
9−%% + Defines a `code' environment for typesetting idris.
10−%% + \begin{code}[...] ... \end{code}
11−%% + Defines commands typesetting the name Idris.
12−%% + \Idris{}
13−%% + \idris{}
14−%%
15−%% Options:
16−%% - literate :: turn on literate idris for code environments.
17−%% - numbers :: turn on numbers for code environments.
18−%%
19−%% ----------------------------------------------------------- [ Begin Package ]
20−\ProvidesPackage{idrislang}
21−
22−\RequirePackage{ifthen}
23−\RequirePackage{listings}
24−\RequirePackage{xspace}
25−%% ----------------------------------------------------------------- [ Options ]
26−\newboolean{literate}
27−\setboolean{literate}{false}
28−\newboolean{numbers}
29−\setboolean{numbers}{false}
30−
31−\DeclareOption{literate}{%
32− \setboolean{literate}{true}
33−}
34−
35−\DeclareOption{numbers}{%
36− \setboolean{numbers}{true}
37−}
38−
39−\ProcessOptions\relax
40−
41−%% ---------------------------------------------------------------- [ Commands ]
42−\newcommand{\Idris}{\textsc{Idris}\xspace}
43−\newcommand{\idris}{\textsc{Idris}\xspace}
44−
45−%% --------------------------------------------------- [ Define Idris Listings ]
46−\lstdefinelanguage{idris}{%
47− sensitive,%
48−%% ----------------------------------------------------------- [ Default Style ]
49− basicstyle=\ttfamily,
50− flexiblecolumns=false,
51− commentstyle=\footnotesize\sffamily,
52−%% ---------------------------------------------------------------- [ Keywords ]
53−%% From Idris Parser and idris-mode and vimscript
54− keywords={%
55− abstract, attack, case, compute, do, dsl, else, exact, focus, if,
56− import, in, infix, infixl, infixr, instance, intros, module,
57− mutual, namespace, of, let, parameters, partial, pattern, prefix,
58− private, public, refine, rewrite, solve, syntax, term, then,
59− total, trivial, try, using, where, with
60−},
61−%% ------------------------------------------------------- [ Prelude Functions ]
62−%% Generated using
63−%% find lib/ -name "*.idr" | xargs grep -e "^[a-zA-Z0-9]* :" | awk -F : '{printf $2", "}'
64− morekeywords={%
65− class, data, instance, record, dsl, postulate, default, assert_total,
66− lambda, variable, index_first, index_next
67− % trace, unsafePerformPrimIO, FInt, FChar, FByte, FShort, FLong,
68− % FBits8, FBits16, FBits32, FBits64, FBits8x16, FBits16x8,
69− % FBits32x4, FBits64x2, interpFTy, ForeignTy, mkForeignPrim,
70− % mkLazyForeignPrim, liftPrimIO, fork, unsafePerformIO, listens,
71− % censor, Writer, liftReaderT, asks, Reader, modify, gets, State,
72− % RWS, nGTSm, decideNatLTE, lte, vectInjective1, vectInjective2,
73− % run, myID, send, msgWaiting, recv, recvWithSender, create,
74− % sendToThread, checkMsgs, getMsg, viewB8x16, viewB16x8, viewB32x4,
75− % viewB64x2, pow, exp, log, pi, sin, cos, tan, asin, acos, atan,
76− % atan2, sinh, cosh, tanh, sqrt, floor, ceiling, count, countFrom,
77− % curry, uncurry, uniformB8x16, uniformB16x8, uniformB32x4,
78− % uniformB64x2, putStr, putStrLn, print, getLine, putChar, getChar,
79− % fopen, openFile, closeFile, fread, fwrite, feof, ferror, nullPtr,
80− % nullStr, validFile, while, readFile, userSuppliedName, seq, try,
81− % mkPair, getUName, unApply, mkApp, binderTy, divCeil, nextPow2,
82− % nextBytes, machineTy, bitsUsed, natToBits, getPad, pad8, pad16,
83− % pad32, pad64, shiftLeft, shiftRightLogical, shiftRightArithmetic,
84− % and, or, xor, plus, minus, times, sdiv, udiv, srem, urem, lt, lte,
85− % eq, gte, gt, complement, zeroExtend, intToBits, bitsToInt, bitAt,
86− % getBit, setBit, unsetBit, bitsToStr, findElem, replaceElem,
87− % replaceByElem, mapElem, anyNilAbsurd, anyElim, any, negAnyAll,
88− % notAllHere, notAllThere, all, length, index, weaken, take, toList,
89− % fromList, replicate, foldl, foldr, map, pad, zeroBoundIsEmpty,
90− % empty, insert, delete, contains, fromList, toList, applyKleisli,
91− % applyMor, applyEndo, absZ, negZ, negNat, minusNatZ, plusZ, subZ,
92− % multZ, fromInt, natPlusZPlus, natMultZMult, doubleNegElim,
93− % posInjective, negSInjective, posNotNeg, plusZeroLeftNeutralZ,
94− % plusZeroRightNeutralZ, plusCommutativeZ, modBin, modComp, div,
95− % rem, intToMod, modToStr, branch4, branch5, branch6, branch7,
96− % merge1, merge2, merge3, treeLookup, treeInsert, delType,
97− % treeDelete, treeToList, empty, lookup, insert, delete, fromList,
98− % toList, getWitness, getProof, FalseElim, replace, sym, trans,
99− % lazy, par, malloc, Not, id, the, const, fst, snd, flip, cong,
100− % boolElim, not, intToBool, boolOp, div, mod, strHead, strTail,
101− % strCons, strIndex, reverse, null, getArgs, getEnv, setEnv,
102− % unsetEnv, getEnvironment, exit, usleep, sequence, toHexDigit,
103− % b8ToString, b16ToString, b32ToString, b64ToString, tail, head,
104− % last, init, index, deleteAt, replaceAt, take, drop, fromList,
105− % replicate, zipWith, zip, unzip, concat, elemBy, elem, lookupBy,
106− % lookup, hasAnyBy, hasAny, find, findIndex, elemIndexBy, elemIndex,
107− % nubBy, nub, isPrefixOfBy, isPrefixOf, isSuffixOfBy, isSuffixOf,
108− % catMaybes, diag, range, isLeft, isRight, choose, either, lefts,
109− % rights, partitionEithers, fromEither, maybeToEither, strM, unpack,
110− % pack, span, break, split, ltrim, trim, words, lines, foldr1,
111− % unwords, length, realPart, imagPart, mkPolar, cis, magnitude,
112− % phase, conjugate, isNothing, isJust, maybe, fromMaybe, toMaybe,
113− % justInjective, lowerMaybe, raiseToMaybe, isNil, isCons, head,
114− % tail, last, init, take, drop, takeWhile, dropWhile, list, length,
115− % repeat, replicate, zipWith, zipWith3, zip, zip3, unzip, unzip3,
116− % mapMaybe, toList, reverse, intersperse, intercalate, elemBy, elem,
117− % lookupBy, lookup, hasAnyBy, hasAny, find, findIndex, findIndices,
118− % elemIndexBy, elemIndex, elemIndicesBy, elemIndices, filter, nubBy,
119− % nub, span, break, split, partition, isPrefixOfBy, isPrefixOf,
120− % isSuffixOfBy, isSuffixOf, sorted, mergeBy, merge, sort,
121− % maybeToList, listToMaybe, catMaybes, appendNilRightNeutral,
122− % appendAssociative, lengthAppend, mapPreservesLength,
123− % mapDistributesOverAppend, mapFusion, hasAnyByNilFalse,
124− % hasAnyNilFalse, fromIntegerNat, toIntegerNat, hyper, log2, gcd,
125− % liftA, liftA2, liftA3, guard, when, finToNat, finToInt, weaken,
126− % strengthen, last, natToFin, integerToFin, fromInteger, flatten,
127− % return, isUpper, isLower, isAlpha, isDigit, isAlphaNum, isSpace,
128− % isNL, toUpper, toLower, isHexDigit, isValidHeap, merge, insert,
129− % findMinimum, deleteMinimum, toList, fromList, sort, main, foldl,
130− % concat, concatMap, and, or, any, all, sum, product, Vars,
131− % getAction, setInfo, getInfo, lift, output, queryVars, postVars,
132− % cookieVars, queryVar, getOutput, getHeaders, flushHeaders, flush,
133− % getVars, getContent, getCgiEnv, runCGI, mult
134− },
135−%% ---------------------------------------------------------------- [ Comments ]
136− morecomment=[l]--,%
137− morecomment=[n]{\{-}{-\}}
138−}[keywords,comments,strings]%
139−
140−%% ---------------------------------------- [ Define Idris with Literate Stuff ]
141−\lstdefinelanguage{literateidris}[]{idris}{
142− literate= {+}{{$+$}}1
143− {/}{{$/$}}1
144− {*}{{$*$}}1
145− {=}{{$=$}}1
146− {>}{{$>$}}1
147− {<}{{$<$}}1
148− {\\}{{$\lambda$}}1
149− {\\\\}{{\char`\\\char`\\}}1
150− {->}{{$\rightarrow$}}2
151− {>=}{{$\geq$}}2
152− {<-}{{$\leftarrow$}}2
153− {<=}{{$\leq$}}2
154− {=>}{{$\Rightarrow$}}2
155− {==}{{$\equiv$}}2
156− {\ .}{{$\circ$}}2
157− {\ .\ }{{$\circ$}}2
158− {>>}{{>>}}2
159− {>>=}{{>>=}}2
160− {|}{{$\mid$}}1,
161−}
162−%% -------------------------------------------------- [ Default Listings Style ]
163−
164−\lstdefinestyle{default}{%
165− xleftmargin=\parindent,
166− tabsize=2
167−}
168−\lstdefinestyle{numbers}{%
169− xleftmargin=\parindent,
170− tabsize=2,
171− numbers=left,
172− numbersep=10pt,
173− numberstyle=\footnotesize\sffamily,
174− frame=leftline
175−}
176−
177−%% ------------------------------------------------------ [ A Code Environment ]
178−%% Replicate the existence of literate haskell code environments,
179−%% option to make pretty with numbers.
180−\lstnewenvironment{code}[1][]
181− {\ifthenelse{\boolean{literate}}{%
182− \lstset{language=literateidris}}{%
183− \lstset{language=idris}}
184− \ifthenelse{\boolean{numbers}}{%
185− \lstset{style=numbers, #1}}{%
186− \lstset{style=default, #1}}
187− }
188− {}
189−\endinput
190−%% --------------------------------------------------------------------- [ EOF ]
tutorial/library.ltxdeleted−325
@@ -1,325 +0,0 @@
1−%%%%%%%%%%%%%%% library file for datatypes etc.
2−
3−%%% Identifiers
4−
5−\newcommand{\va}{\VV{a}}
6−\newcommand{\vb}{\VV{b}}
7−\newcommand{\vc}{\VV{c}}
8−\newcommand{\vd}{\VV{d}}
9−\newcommand{\ve}{\VV{e}}
10−\newcommand{\vf}{\VV{f}}
11−\newcommand{\vg}{\VV{g}}
12−\newcommand{\vh}{\VV{h}}
13−\newcommand{\vi}{\VV{i}}
14−\newcommand{\vj}{\VV{j}}
15−\newcommand{\vk}{\VV{k}}
16−\newcommand{\vl}{\VV{l}}
17−\newcommand{\vm}{\VV{m}}
18−\newcommand{\vn}{\VV{n}}
19−\newcommand{\vo}{\VV{o}}
20−\newcommand{\vp}{\VV{p}}
21−\newcommand{\vq}{\VV{q}}
22−\newcommand{\vr}{\VV{r}}
23−\newcommand{\vs}{\VV{s}}
24−\newcommand{\vt}{\VV{t}}
25−\newcommand{\vu}{\VV{u}}
26−\newcommand{\vv}{\VV{v}}
27−\newcommand{\vw}{\VV{w}}
28−\newcommand{\vx}{\VV{x}}
29−\newcommand{\vy}{\VV{y}}
30−\newcommand{\vz}{\VV{z}}
31−\newcommand{\vA}{\VV{A}}
32−\newcommand{\vB}{\VV{B}}
33−\newcommand{\vC}{\VV{C}}
34−\newcommand{\vD}{\VV{D}}
35−\newcommand{\vE}{\VV{E}}
36−\newcommand{\vF}{\VV{F}}
37−\newcommand{\vG}{\VV{G}}
38−\newcommand{\vH}{\VV{H}}
39−\newcommand{\vI}{\VV{I}}
40−\newcommand{\vJ}{\VV{J}}
41−\newcommand{\vK}{\VV{K}}
42−\newcommand{\vL}{\VV{L}}
43−\newcommand{\vM}{\VV{M}}
44−\newcommand{\vN}{\VV{N}}
45−\newcommand{\vO}{\VV{O}}
46−\newcommand{\vP}{\VV{P}}
47−\newcommand{\vQ}{\VV{Q}}
48−\newcommand{\vR}{\VV{R}}
49−\newcommand{\vS}{\VV{S}}
50−\newcommand{\vT}{\VV{T}}
51−\newcommand{\vU}{\VV{U}}
52−\newcommand{\vV}{\VV{V}}
53−\newcommand{\vW}{\VV{W}}
54−\newcommand{\vX}{\VV{X}}
55−\newcommand{\vY}{\VV{Y}}
56−\newcommand{\vZ}{\VV{Z}}
57−\newcommand{\vas}{\VV{as}}
58−\newcommand{\vbs}{\VV{bs}}
59−\newcommand{\vcs}{\VV{cs}}
60−\newcommand{\vds}{\VV{ds}}
61−\newcommand{\ves}{\VV{es}}
62−\newcommand{\vfs}{\VV{fs}}
63−\newcommand{\vgs}{\VV{gs}}
64−\newcommand{\vhs}{\VV{hs}}
65−\newcommand{\vis}{\VV{is}}
66−\newcommand{\vjs}{\VV{js}}
67−\newcommand{\vks}{\VV{ks}}
68−\newcommand{\vls}{\VV{ls}}
69−\newcommand{\vms}{\VV{ms}}
70−\newcommand{\vns}{\VV{ns}}
71−\newcommand{\vos}{\VV{os}}
72−\newcommand{\vps}{\VV{ps}}
73−\newcommand{\vqs}{\VV{qs}}
74−\newcommand{\vrs}{\VV{rs}}
75−%\newcommand{\vss}{\VV{ss}}
76−\newcommand{\vts}{\VV{ts}}
77−\newcommand{\vus}{\VV{us}}
78−\newcommand{\vvs}{\VV{vs}}
79−\newcommand{\vws}{\VV{ws}}
80−\newcommand{\vxs}{\VV{xs}}
81−\newcommand{\vys}{\VV{ys}}
82−\newcommand{\vzs}{\VV{zs}}
83−
84−%%% Telescope Identifiers
85−
86−\newcommand{\ta}{\vec{\VV{a}}}
87−\newcommand{\tb}{\vec{\VV{b}}}
88−\newcommand{\tc}{\vec{\VV{c}}}
89−\newcommand{\td}{\vec{\VV{d}}}
90−\newcommand{\te}{\vec{\VV{e}}}
91−\newcommand{\tf}{\vec{\VV{f}}}
92−\newcommand{\tg}{\vec{\VV{g}}}
93−%\newcommand{\th}{\vec{\VV{h}}}
94−\newcommand{\ti}{\vec{\VV{i}}}
95−\newcommand{\tj}{\vec{\VV{j}}}
96−\newcommand{\tk}{\vec{\VV{k}}}
97−\newcommand{\tl}{\vec{\VV{l}}}
98−\newcommand{\tm}{\vec{\VV{m}}}
99−\newcommand{\tn}{\vec{\VV{n}}}
100−%\newcommand{\to}{\vec{\VV{o}}}
101−\newcommand{\tp}{\vec{\VV{p}}}
102−\newcommand{\tq}{\vec{\VV{q}}}
103−\newcommand{\tr}{\vec{\VV{r}}}
104−\newcommand{\tts}{\vec{\VV{s}}}
105−\newcommand{\ttt}{\vec{\VV{t}}}
106−\newcommand{\tu}{\vec{\VV{u}}}
107−%\newcommand{\tv}{\vec{\VV{v}}}
108−\newcommand{\tw}{\vec{\VV{w}}}
109−\newcommand{\tx}{\vec{\VV{x}}}
110−\newcommand{\ty}{\vec{\VV{y}}}
111−\newcommand{\tz}{\vec{\VV{z}}}
112−\newcommand{\tA}{\vec{\VV{A}}}
113−\newcommand{\tB}{\vec{\VV{B}}}
114−\newcommand{\tC}{\vec{\VV{C}}}
115−\newcommand{\tD}{\vec{\VV{D}}}
116−\newcommand{\tE}{\vec{\VV{E}}}
117−\newcommand{\tF}{\vec{\VV{F}}}
118−\newcommand{\tG}{\vec{\VV{G}}}
119−\newcommand{\tH}{\vec{\VV{H}}}
120−\newcommand{\tI}{\vec{\VV{I}}}
121−\newcommand{\tJ}{\vec{\VV{J}}}
122−\newcommand{\tK}{\vec{\VV{K}}}
123−\newcommand{\tL}{\vec{\VV{L}}}
124−\newcommand{\tM}{\vec{\VV{M}}}
125−\newcommand{\tN}{\vec{\VV{N}}}
126−\newcommand{\tO}{\vec{\VV{O}}}
127−\newcommand{\tP}{\vec{\VV{P}}}
128−\newcommand{\tQ}{\vec{\VV{Q}}}
129−\newcommand{\tR}{\vec{\VV{R}}}
130−\newcommand{\tS}{\vec{\VV{S}}}
131−\newcommand{\tT}{\vec{\VV{T}}}
132−\newcommand{\tU}{\vec{\VV{U}}}
133−\newcommand{\tV}{\vec{\VV{V}}}
134−\newcommand{\tW}{\vec{\VV{W}}}
135−\newcommand{\tX}{\vec{\VV{X}}}
136−\newcommand{\tY}{\vec{\VV{Y}}}
137−\newcommand{\tZ}{\vec{\VV{Z}}}
138−
139−
140−
141−%%% Nat
142−
143−\newcommand{\NatPackage}{
144− \newcommand{\Nat}{\TC{\mathbb{N}}}
145− \newcommand{\Z}{\DC{0}}
146− \newcommand{\suc}{\DC{s}}
147− \newcommand{\NatDecl}{
148− \Data \hg
149− \Axiom{\Nat\Hab\Type} \hg
150− \Where \hg
151− \Axiom{\Z\Hab\Nat} \hg
152− \Rule{\vn\Hab\Nat}
153− {\suc\:\vn\Hab\Nat}
154−}}
155−
156−%%% Bool
157−
158−\newcommand{\BoolPackage}{
159− \newcommand{\Bool}{\TC{Bool}}
160− \newcommand{\true}{\DC{true}}
161− \newcommand{\false}{\DC{false}}
162− \newcommand{\BoolDecl}{
163− \Data \hg
164− \Axiom{\Bool\Hab\Type} \hg
165− \Where \hg
166− \Axiom{\true\Hab\Bool} \hg
167− \Axiom{\false\Hab\Bool}
168−}}
169−
170−%%% So
171−
172−\newcommand{\SoPackage}{
173− \newcommand{\So}{\TC{So}}
174− \newcommand{\oh}{\DC{oh}}
175− \newcommand{\SoDecl}{
176− \Data \hg
177− \Rule{\vb\Hab\Bool}
178− {\So\:\vb\Hab\Type} \hg
179− \Where \hg
180− \Axiom{\oh\Hab\So\:\true}
181−}}
182−
183−%%% Unit
184−
185−\newcommand{\UnitPackage}{
186− \newcommand{\Unit}{\TC{Unit}}
187− \newcommand{\void}{\DC{void}}
188− \newcommand{\UnitDecl}{
189− \Data \hg
190− \Axiom{\Unit\Hab\Type} \hg
191− \Where \hg
192− \Axiom{\void\Hab\Unit}
193−}}
194−
195−%%% Maybe
196−
197−\newcommand{\MaybePackage}{
198− \newcommand{\Maybe}{\TC{Maybe}}
199− \newcommand{\yes}{\DC{yes}}
200− \newcommand{\no}{\DC{no}}
201− \newcommand{\MaybeDecl}{
202− \Data \hg
203− \Rule{\vA\Hab\Type}
204− {\Maybe\:\vA\Hab\Type} \hg
205− \Where \hg
206− \Rule{\va \Hab \vA}
207− {\yes\:\va\Hab\Maybe\:\vA} \hg
208− \Axiom{\no\Hab\Maybe\:\vA}
209−}}
210−
211−%%% Cross
212−
213−\newcommand{\pr}[2]{(#1\DC{,}#2)} %grrrr
214−\newcommand{\CrossPackage}{
215− \newcommand{\Cross}{\times}
216− \newcommand{\CrossDecl}{
217− \Data \hg
218− \Rule{\vA,\vB\Hab\Type}
219− {\vA\Cross\vB\Hab\Type} \hg
220− \Where \hg
221− \Rule{\va \Hab \vA \hg \vb\Hab\vB}
222− {\pr{\va}{\vb}\Hab\vA\Cross\vB}
223−}}
224−
225−%%% Fin
226−
227−\newcommand{\FinPackage}{
228− \newcommand{\Fin}{\TC{Fin}}
229− \newcommand{\fz}{\DC{f0}}
230− \newcommand{\fs}{\DC{fs}}
231− \newcommand{\FinDecl}{
232− \AR{
233− \Data \hg
234− \Rule{\vn\Hab\Nat}
235− {\Fin\:\vn\Hab\Type} \hg \\
236− \Where \hg
237− \begin{array}[t]{c}
238− \Axiom{\fz\Hab\Fin\:(\suc\:\vn)} \hg
239− \Rule{\vi\Hab\Fin\:\vn}
240− {\fs\:\vi\Hab\Fin\:(\suc\:\vn)}
241− \end{array}
242− }
243−}}
244−
245−%%% Vect
246−
247−\newcommand{\VectPackage}{
248− \newcommand{\Vect}{\TC{Vect}}
249− \newcommand{\vnil}{\varepsilon}
250− \newcommand{\vcons}{\,\dcolon\,}
251− \newcommand{\vsnoc}{\,\dcolon\,}
252− \newcommand{\VectConsDecl}{
253− \Data \hg
254− \Rule{\vA \Hab \Type \hg \vn\Hab\Nat}
255− {\Vect\:\vA\:\vn\Hab\Type} \hg
256− \Where \hg \begin{array}[t]{c}
257− \Axiom{\vnil \Hab \Vect\:\vA\:\Z} \\
258− \Rule{\vx\Hab\vA \hg \vxs\Hab \Vect\:\vA\:\vn }
259− {\vx\vcons\vxs\Hab\Vect\:\vA\:(\suc\vn)}
260− \end{array}
261−}
262− \newcommand{\VectSnocDecl}{
263− \Data \hg
264− \Rule{\vA \Hab \Type \hg \vn\Hab\Nat}
265− {\Vect\:\vA\:\vn\Hab\Type} \hg
266− \Where \hg \begin{array}[t]{c}
267− \Axiom{\vnil \Hab \Vect\:\vA\:\Z} \\
268− \Rule{\vxs\Hab \Vect\:\vA\:\vn \hg \vx\Hab\vA}
269− {\vxs\vsnoc\vx\Hab\Vect\:\vA\:(\suc\vn)}
270− \end{array}
271−}
272−}
273−
274−%%% Compare
275−
276−%Data Compare : (x:nat)(y:nat)Type
277−% = lt : (x:nat)(y:nat)(Compare x (plus (S y) x))
278−% | eq : (x:nat)(Compare x x)
279−% | gt : (x:nat)(y:nat)(Compare (plus (S x) y) y);
280−
281−
282−\newcommand{\ComparePackage}{
283− \newcommand{\Compare}{\TC{Compare}}
284− \newcommand{\ltComp}{\DC{lt}}
285− \newcommand{\eqComp}{\DC{eq}}
286− \newcommand{\gtComp}{\DC{gt}}
287− \newcommand{\CompareDecl}{
288− \Data \hg
289− \Rule{\vm\Hab\Nat\hg\vn\Hab\Nat}
290− {\Compare\:\vm\:\vn\Hab\Type} \\
291− \Where \hg\begin{array}[t]{c}
292− \Rule{\vx\Hab\Nat\hg\vy\Hab\Nat}
293− {\ltComp_{\vx}\:\vy\Hab\Compare\:\vx\:(\FN{plus}\:\vx\:(\suc\:\vy))} \\
294− \Rule{\vx\Hab\Nat}
295− {\eqComp_{\vx}\Hab\Compare\:\vx\:\vx}\\
296− \Rule{\vx\Hab\Nat\hg\vy\Hab\Nat}
297− {\gtComp_{\vy}\:\vx\Hab\Compare\:(\FN{plus}\:\vy\:(\suc\:\vx))\:\vy} \\
298− \end{array}
299− }
300−
301−%Data CompareM : Type
302−% = ltM : (ydiff:nat)CompareM
303−% | eqM : CompareM
304−% | gtM : (xdiff:nat)CompareM;
305−
306− \newcommand{\CompareM}{\TC{Compare^-}}
307− \newcommand{\ltCompM}{\DC{lt^-}}
308− \newcommand{\eqCompM}{\DC{eq^-}}
309− \newcommand{\gtCompM}{\DC{gt^-}}
310− \newcommand{\CompareMDecl}{
311−
312− \Data \hg
313− \Axiom{\CompareM\Hab\Type} \\
314− \Where \hg\begin{array}[t]{c}
315− \Rule{\vy\Hab\Nat}
316− {\ltCompM\:\vy\Hab\CompareM} \\
317− \Axiom{\eqCompM\Hab\CompareM}\\
318− \Rule{\vx\Hab\Nat}
319− {\gtCompM\:\vx\Hab\CompareM} \\
320− \end{array}
321− }
322− \newcommand{\CompareRec}{\FN{CompareRec}}
323− \newcommand{\CompareRecM}{\FN{CompareRec^-}}
324−
325−}
tutorial/literature.bibdeleted−3856
@@ -1,3856 +0,0 @@
1−@inproceedings{res-dsl-padl12,
2− title = {Resource-safe Systems Programming with Embedded Domain Specific Languages},
3− year = {2012},
4− booktitle = {Practical Applications of Declarative Languages 2012},
5− author = {Edwin Brady and Kevin Hammond},
6− series = {LNCS},
7− publisher = {Springer},
8− note = {To appear}
9−}
10−
11−@article{lambdapi,
12− author = {Andres L\"{o}h and Conor McBride and Wouter Swierstra},
13− title = {A tutorial implementation of a dependently typed lambda calculus},
14− year = 2010,
15− journal = {Fundamenta Informaticae},
16− volume = 102,
17− number = 2
18−}
19−
20−@article{idioms,
21− author = {McBride, Conor and Paterson, Ross},
22− title = {Applicative programming with effects},
23− journal = {J. Funct. Program.},
24− volume = {18},
25− issue = {1},
26− month = {January},
27− year = {2008},
28− issn = {0956-7968},
29− pages = {1--13},
30− numpages = {13},
31− url = {http://portal.acm.org/citation.cfm?id=1348940.1348941},
32− doi = {10.1017/S0956796807006326},
33− acmid = {1348941},
34− publisher = {Cambridge University Press},
35− address = {New York, NY, USA},
36−}
37−
38−@inproceedings{lava,
39− author = {Bjesse, Per and Claessen, Koen and Sheeran, Mary and Singh, Satnam},
40− title = {Lava: hardware design in {Haskell}},
41− booktitle = {Proceedings of the third ACM SIGPLAN international conference on Functional programming},
42− series = {ICFP '98},
43− year = {1998},
44− isbn = {1-58113-024-4},
45− location = {Baltimore, Maryland, United States},
46− pages = {174--184},
47− numpages = {11},
48− url = {http://doi.acm.org/10.1145/289423.289440},
49− doi = {http://doi.acm.org/10.1145/289423.289440},
50− acmid = {289440},
51− publisher = {ACM},
52− address = {New York, NY, USA},
53−}
54−
55−@inproceedings{plpv11,
56− author = {Edwin Brady},
57− title = {Idris --- Systems programming meets full dependent types},
58− booktitle = {Programming Languages meets Program Verification {(PLPV 2011)}},
59− year = {2011},
60− pages = {43--54},
61− ee = {http://doi.acm.org/10.1145/1929529.1929536},
62− bibsource = {DBLP, http://dblp.uni-trier.de}
63−}
64−
65−@inproceedings{epic-tfp,
66− author = {Edwin Brady},
67− title = {Epic --- a library for generating compilers},
68− year = 2011,
69− booktitle = {{Trends in Functional Programming} ({TFP} '11)},
70− note = {To appear}
71−}
72−
73−@inproceedings{ynot08,
74− author = {Nanevski,, Aleksandar and Morrisett,, Greg and
75− Shinnar,, Avraham and Govereau,, Paul and Birkedal,,
76− Lars},
77− title = {Ynot: reasoning with the awkward squad},
78− booktitle = {{ICFP} '08: Proceeding of the 13th {ACM SIGPLAN}
79− international conference on Functional programming},
80− year = {2008},
81− isbn = {978-1-59593-919-7},
82− pages = {229--240},
83− location = {Victoria, BC, Canada},
84− doi = {http://doi.acm.org/10.1145/1411204.1411237},
85− publisher = {ACM},
86− address = {New York, NY, USA},
87−}
88−
89−@article{cbconc-fi,
90− author = {Edwin Brady and Kevin Hammond},
91− title = {Correct-by-Construction Concurrency: Using Dependent Types to Verify Implementations of Effectful Resource Usage Protocols},
92− year = 2010,
93− journal = {Fundamenta Informaticae},
94− volume = 102,
95− number = 2,
96− pages = {145--176}
97−}
98−
99−@inproceedings{devil-osdi00,
100− author = {Fabrice M{\'e}rillon and
101− Laurent R{\'e}veill{\`e}re and
102− Charles Consel and
103− Renaud Marlet and
104− Gilles Muller},
105− title = {Devil: An IDL for Hardware Programming},
106− booktitle = {4th USENIX Symposium on Operating Systems Design and Implementation (OSDI 2000)},
107− year = {2000}
108−}
109−
110−
111−@INPROCEEDINGS{device-osdi08,
112− author = {Dan Williams and Patrick Reynolds and Kevin Walsh and Emin Gün Sirer and Fred B. Schneider},
113− title = {Device driver safety through a reference validation mechanism},
114− booktitle = {8th USENIX Symposium on Operating Systems Design and Implementation (OSDI 2008)},
115− year = {2008}
116−}
117−
118−@inproceedings{sozeau-equations,
119− author = {Matthieu Sozeau},
120− title = {Equations: A Dependent Pattern-Matching Compiler},
121− booktitle = {First International Conference on Interactive Theorem Proving (ITP 2010)},
122− year = {2010},
123− pages = {419--434},
124− ee = {http://dx.doi.org/10.1007/978-3-642-14052-5_29},
125− crossref = {DBLP:conf/itp/2010},
126− bibsource = {DBLP, http://dblp.uni-trier.de}
127−}
128−
129−
130−@inproceedings{packet-type,
131− author = "Peter J. McCann and Satish Chandra",
132− title = "Packet Types: Abstract Specification of Network Protocol Messages",
133− year = 2000,
134− booktitle = "SIGCOMM '00",
135− publisher = {{ACM}}
136−}
137−
138−@inproceedings{qs-types,
139− author = {Eelis {van der Weegen} and James McKinna},
140−
141− title={A Machine-checked Proof of the Average-case Complexity of Quicksort in Coq},
142− year={2009},
143− pages={256--271},
144− series = {Lecture Notes in Computer Science},
145− publisher = {Springer}
146−
147−}
148−
149−@inproceedings{totalparser,
150− author = {Nils Anders Danielsson},
151− title = {Total Parser Combinators},
152− booktitle = {{ICFP} '10: Proceedings of the 15th {ACM} {SIGPLAN} International Conference on Functional Programming},
153− year = {2010},
154− isbn = {978-1-60558-794-3},
155− pages = {285--296},
156− location = {Baltimore, Maryland, USA},
157− doi = {http://doi.{ACM}.org/10.1145/1863543.1863587},
158− publisher = {{ACM}},
159− address = {New York, NY, USA},
160− }
161−
162−@misc{rfc791,
163− author="J. Postel",
164− title="{Internet Protocol}",
165− series="Request for Comments",
166− number="791",
167− howpublished="RFC 791 (Standard)",
168− publisher="IETF",
169− organization="Internet Engineering Task Force",
170− year=1981,
171− month=sep,
172− note="Updated by RFC 1349",
173− url="http://www.ietf.org/rfc/rfc791.txt",
174−}
175−
176−
177−@misc{rfc792,
178− author="J. Postel",
179− title="{Internet Control Message Protocol}",
180− series="Request for Comments",
181− number="792",
182− howpublished="RFC 792 (Standard)",
183− publisher="IETF",
184− organization="Internet Engineering Task Force",
185− year=1981,
186− month=sep,
187− note="Updated by RFCs 950, 4884",
188− url="http://www.ietf.org/rfc/rfc792.txt",
189−}
190−
191−@INPROCEEDINGS{Dybjer-indrec,
192− author = {Peter Dybjer and Anton Setzer},
193− title = {A Finite Axiomatization of Inductive-Recursive Definitions},
194− booktitle = {Tyed Lambda Calculi and Applications},
195− volume = {1581},
196− series = {Lecture Notes in Computer Science},
197− year = {1998},
198− pages = {129--146},
199− publisher = {Springer}
200−}
201−
202−@book{stevenstcpip,
203− author = {W. Richard Stevens},
204− title = {{TCP/IP} Illustrated Volume 1: The Protocols},
205− year = 1994,
206− publisher = {Addison Wesley},
207− isbn = {0-201-63346-9}
208−}
209−
210−@inproceedings{coqtypeclasses,
211− author = {Sozeau, Matthieu and Oury, Nicolas},
212− title = {First-Class Type Classes},
213− booktitle = {TPHOLs '08: Proceedings of the 21st International Conference on Theorem Proving in Higher Order Logics},
214− year = {2008},
215− isbn = {978-3-540-71065-3},
216− pages = {278--293},
217− location = {Montreal, P.Q., Canada},
218− doi = {http://dx.doi.org/10.1007/978-3-540-71067-7_23},
219− publisher = {Springer-Verlag},
220− address = {Berlin, Heidelberg},
221− }
222−
223−
224−@inproceedings{kipling,
225− author = {McBride, Conor},
226− title = {Outrageous but meaningful coincidences: dependent type-safe syntax and evaluation},
227− booktitle = {WGP '10: Proceedings of the 6th {ACM} {SIGPLAN} workshop on Generic programming},
228− year = {2010},
229− isbn = {978-1-4503-0251-7},
230− pages = {1--12},
231− location = {Baltimore, Maryland, USA},
232− doi = {http://doi.{ACM}.org/10.1145/1863495.1863497},
233− publisher = {{ACM}},
234− address = {New York, NY, USA},
235− }
236−
237−@inproceedings{padsml,
238− author = {Yitzhak Mandelbaum and
239− Kathleen Fisher and
240− David Walker and
241− Mary F. Fern{\'a}ndez and
242− Artem Gleyzer},
243− title = {{PADS/ML}: a functional data description language},
244− booktitle = {POPL '07: Proceedings of the 34th {ACM} {SIGPLAN}-SIGACT Symposium on
245− Principles of Programming Languages, POPL 2007, Nice, France,
246− January 17-19, 2007},
247− year = {2007},
248− pages = {77-83},
249− ee = {http://doi.{ACM}.org/10.1145/1190216.1190231},
250− crossref = {DBLP:conf/popl/2007},
251− bibsource = {DBLP, http://dblp.uni-trier.de}
252−}
253−
254−@proceedings{DBLP:conf/popl/2007,
255− editor = {Martin Hofmann and
256− Matthias Felleisen},
257− title = {Proceedings of the 34th {ACM} {SIGPLAN}-SIGACT Symposium on
258− Principles of Programming Languages, POPL 2007, Nice, France,
259− January 17-19, 2007},
260− booktitle = {POPL},
261− publisher = {{ACM}},
262− year = {2007},
263− isbn = {1-59593-575-4},
264− bibsource = {DBLP, http://dblp.uni-trier.de}
265−}
266−
267−@inproceedings{melange,
268− author = {Madhavapeddy, Anil and Ho, Alex and Deegan, Tim and Scott, David and Sohan, Ripduman},
269− title = {Melange: creating a "functional" internet},
270− booktitle = {EuroSys '07: Proceedings of the 2nd {ACM} SIGOPS/EuroSys European Conference on Computer Systems 2007},
271− year = {2007},
272− isbn = {978-1-59593-636-3},
273− location = {Lisbon, Portugal},
274− doi = {http://doi.{ACM}.org/10.1145/1272996.1273009},
275− publisher = {{ACM}},
276− address = {New York, NY, USA},
277− }
278−
279−
280−
281−@article{next700data,
282− author = {Fisher, Kathleen and Mandelbaum, Yitzhak and Walker, David},
283− title = {The next 700 data description languages},
284− journal = {{SIGPLAN} Not.},
285− volume = {41},
286− number = {1},
287− year = {2006},
288− issn = {0362-1340},
289− pages = {2--15},
290− doi = {http://doi.{ACM}.org/10.1145/1111320.1111039},
291− publisher = {{ACM}},
292− address = {New York, NY, USA},
293− }
294−
295−
296−@INPROCEEDINGS{xi-ats,
297− author = {Hongwei Xi},
298− title = {{Applied Type System} (extended abstract)},
299− booktitle = {Types for Proofs and Programs 2003},
300− editor = {Stefano Berardi and Mario Coppo and Ferruccio Damiani},
301− publisher = {Springer},
302− series = {Lecture Notes in Computer Science},
303− volume = {3085},
304− year = {2004},
305− pages = {394--408}
306−}
307−
308−@inproceedings{powerpi,
309− author = {Nicolas Oury and
310− Wouter Swierstra},
311− title = {The power of {Pi}},
312− booktitle = {{ICFP} '08: Proceedings of the 13th {ACM} {SIGPLAN} International Conference
313− on Functional Programming, {ICFP} 2008, Victoria, BC, Canada,
314− September 20-28, 2008},
315− year = {2008},
316− pages = {39--50},
317− ee = {http://doi.{ACM}.org/10.1145/1411204.1411213},
318− crossref = {DBLP:conf/{ICFP}/2008},
319− bibsource = {DBLP, http://dblp.uni-trier.de}
320−}
321−
322−@proceedings{DBLP:conf/{ICFP}/2008,
323− editor = {James Hook and
324− Peter Thiemann},
325− title = {Proceeding of the 13th {ACM} {SIGPLAN} international conference
326− on Functional programming, {ICFP} 2008, Victoria, BC, Canada,
327− September 20-28, 2008},
328− booktitle = {{ICFP}},
329− publisher = {{ACM}},
330− year = {2008},
331− isbn = {978-1-59593-919-7},
332− bibsource = {DBLP, http://dblp.uni-trier.de}
333−}
334−
335−
336−@inproceedings{security-types,
337− author = {Morgenstern, Jamie and Licata, Daniel R.},
338− title = {Security-typed programming within dependently typed programming},
339− booktitle = {{ICFP} '10: Proceedings of the 15th {ACM} {SIGPLAN} International Conference on Functional Programming},
340− year = {2010},
341− isbn = {978-1-60558-794-3},
342− pages = {169--180},
343− location = {Baltimore, Maryland, USA},
344− doi = {http://doi.{ACM}.org/10.1145/1863543.1863569},
345− publisher = {{ACM}},
346− address = {New York, NY, USA},
347− }
348−
349−@inproceedings{levitation,
350− author = {Chapman, James and Dagand, Pierre-\'{E}variste and McBride, Conor and Morris, Peter},
351− title = {The gentle art of levitation},
352− booktitle = {{ICFP} '10: Proceedings of the 15th {ACM} {SIGPLAN} International Conference on Functional Programming},
353− year = {2010},
354− isbn = {978-1-60558-794-3},
355− pages = {3--14},
356− location = {Baltimore, Maryland, USA},
357− doi = {http://doi.{ACM}.org/10.1145/1863543.1863547},
358− publisher = {{ACM}},
359− address = {New York, NY, USA},
360− }
361−
362−
363−
364−@INPROCEEDINGS{awkward,
365− author = {Simon {Peyton Jones}},
366− title = {Tackling the awkward squad: monadic input/output, concurrency, exceptions, and foreign-language calls in {Haskell}},
367− booktitle = {Engineering theories of software construction},
368− year = {2001},
369− pages = {47--96}
370−}
371−
372−@inproceedings{scrap-engine,
373− author = {Brady, Edwin and Hammond, Kevin},
374− title = {Scrapping your inefficient engine: using partial evaluation to improve domain-specific language implementation},
375− booktitle = {{ICFP} '10: Proceedings of the 15th {ACM} {SIGPLAN} International Conference on Functional Programming},
376− year = {2010},
377− isbn = {978-1-60558-794-3},
378− pages = {297--308},
379− location = {Baltimore, Maryland, USA},
380− doi = {http://doi.{ACM}.org/10.1145/1863543.1863587},
381− publisher = {{ACM}},
382− address = {New York, NY, USA},
383− }
384−
385−@article{urweb,
386− author = {Chlipala, Adam},
387− title = {Ur: statically-typed metaprogramming with type-level record computation},
388− journal = {{SIGPLAN} Not.},
389− volume = {45},
390− number = {6},
391− year = {2010},
392− issn = {0362-1340},
393− pages = {122--133},
394− doi = {http://doi.{ACM}.org/10.1145/1809028.1806612},
395− publisher = {{ACM}},
396− address = {New York, NY, USA},
397− }
398−
399−
400−
401−@phdthesis{norell-thesis,
402− author = {Ulf Norell},
403− title = {Towards a practical programming language based on dependent type
404− theory},
405− school = {Chalmers University of Technology},
406− year = 2007,
407− month = {September},
408−}
409−
410−@inproceedings{open-type,
411− author = {Schrijvers, Tom and Peyton Jones, Simon and Chakravarty, Manuel and Sulzmann, Martin},
412− title = {Type checking with open type functions},
413− booktitle = {International Conf. on Functional Programming ({ICFP} 2008)},
414− year = {2008},
415− pages = {51--62},
416− doi = {http://doi.{ACM}.org/10.1145/1411203.1411215},
417− publisher = {{ACM}},
418− address = {New York, NY, USA},
419− }
420−
421−@inproceedings{ngna-dsl,
422− title = {Domain Specific Languages ({DSL}s) for Network Protocols},
423− author = {Saleem Bhatti and Edwin Brady and Kevin Hammond and James McKinna},
424− year = {2009},
425− booktitle = {International Workshop on Next Generation Network Architecture ({NGNA} 2009)}
426−}
427−
428−@phdthesis{gill-thesis,
429− title = {Cheap deforestation for non-strict functional languages},
430− author = {A Gill},
431− institution = {University of Glasgow},
432− month = {January},
433− year = 1996
434−}
435−
436−@misc{llvm-haskell,
437− title = {Low Level Virtual Machine for {Glasgow Haskell Compiler}},
438− author = {David Terei},
439− year = 2009,
440− howpublished = {Bachelor's Thesis, Computer Science and Engineering Dept., The University of New South Wales, Sydney, Australia}
441−}
442−
443−@mastersthesis{llvm,
444− title = {{LLVM}: An Infrastructure for Multi-Stage Optimization},
445− author = {Chris Lattner},
446− year = 2002,
447− month = {December},
448− institution = {Computer Science Dept., University of Illinois at Urbana-Champaign}
449−}
450−
451−@inproceedings{gpu-arrays,
452− title = {GPU Kernels as Data-Parallel Array Computations in Haskell},
453− author = {Sean Lee and Manuel M. T. Chakravarty and Vinod Grover and Gabriele Keller.},
454− year = 2009,
455− booktitle = {Workshop on Exploiting Parallelism using GPUs and other Hardware-Assisted Methods (EPAHM 2009)}
456−}
457−
458−@misc{cryptol,
459− author = {Galois, Inc.},
460− title = {Cryptol},
461− year = {2009},
462− howpublished = {\url{http://cryptol.net/}}
463−}
464−
465−@inproceedings{paradise-dsl,
466− author = {Lennart Augustsson and Howard Mansell and Ganesh Sittampalam},
467− title = {{Paradise: a two-stage DSL embedded in Haskell}},
468− booktitle = {International Conf. on Functional Programming ({ICFP} 2008)},
469− year = {2008},
470− publisher = {{ACM}},
471− pages = {225--228}
472− }
473−
474−@misc{dsl-bib,
475− author = {Arie {van Deursen} and Paul Klint and Joost Visser},
476− title = {Domain-Specific Languages --- an annotated bibliography},
477− year = 2000,
478− howpublished = {\url{http://homepages.cwi.nl/~arie/papers/dslbib/}}
479−}
480−
481−@inproceedings{imperative-pe,
482− author = {Debois, S{\o}ren},
483− title = {Imperative program optimization by partial evaluation},
484− booktitle = {PEPM '04: Proceedings of the 2004 {ACM} {SIGPLAN} symposium on Partial evaluation and semantics-based program manipulation},
485− year = {2004},
486− isbn = {1-58113-835-0},
487− pages = {113--122},
488− location = {Verona, Italy},
489− doi = {http://doi.{ACM}.org/10.1145/1014007.1014019},
490− publisher = {{ACM}},
491− address = {New York, NY, USA},
492− }
493−
494−
495−@inproceedings{offline-pe-termination,
496− author = {Andersen, Peter Holst and Holst, Carsten Kehler},
497− title = {Termination Analysis for Offline Partial Evaluation of a Higher Order Functional Language},
498− booktitle = {Proc. SAS '96: Intl. Symp. on Static Analysis},
499− year = {1996},
500− isbn = {3-540-61739-6},
501− pages = {67--82},
502− publisher = {Springer},
503− notaddress = {London, UK},
504− }
505−
506−
507−@inproceedings{stage-duplication,
508− author = {Swadi, Kedar and Taha, Walid and Kiselyov, Oleg and Pasalic, Emir},
509− title = {A monadic approach for avoiding code duplication when staging memoized functions},
510− notbooktitle = {PEPM '06: Proceedings of the 2006 {ACM} {SIGPLAN} symposium on Partial evaluation and semantics-based program manipulation},
511− booktitle = {Proc. PEPM '06:{ACM} Symp. on Partial Evaluation and Semantics-based Program Manipulation},
512− year = {2006},
513− isbn = {1-59593-196-1},
514− pages = {160--169},
515− location = {Charleston, South Carolina},
516− doi = {http://doi.{ACM}.org/10.1145/1111542.1111570},
517− notpublisher = {{ACM}},
518− notaddress = {New York, NY, USA},
519− }
520−
521−
522−@inproceedings{concoqtion,
523− author = {Fogarty, Seth and Pasalic, Emir and Siek, Jeremy and Taha, Walid},
524− title = {Concoqtion: indexed types now!},
525− booktitle = {PEPM '07: Proceedings of the 2007 {ACM} {SIGPLAN} symposium on Partial evaluation and semantics-based program manipulation},
526− year = {2007},
527− isbn = {978-1-59593-620-2},
528− pages = {112--121},
529− location = {Nice, France},
530− doi = {http://doi.{ACM}.org/10.1145/1244381.1244400},
531− publisher = {{ACM}},
532− address = {New York, NY, USA},
533− }
534−
535−@inproceedings{metahaskell,
536− author = "Tim Sheard and Simon {Peyton Jones}",
537− title = "Template metaprogramming for {Haskell}",
538− booktitle = "{ACM} Haskell Workshop",
539− year = 2002,
540− month = oct,
541− pages = "1-16",
542− noteditor = "Manuel M. T. Chakravarty",
543− notpublisher = "{ACM} Press"
544−}
545−
546−@misc{shark-profiler,
547− title = {Optimizing your application with {Shark 4}},
548− year = 2009,
549− howpublished = {\url{http://developer.apple.com/tools/sharkoptimize.html}}
550−}
551−
552−@misc{shootout,
553− title = {The Computer Language Benchmark Game},
554− year = {2009},
555− howpublished = {\url{http://shootout.alioth.debian.org/}}
556−}
557−
558−@article{futamura,
559− author = {Yoshihiko Futamura},
560− year = 1971,
561− title = "Partial Evaluation of Computation Process --– An Approach to a Compiler-Compiler",
562− journal = {Systems, Comps., Controls},
563− volume = 2,
564− number = 5,
565− pages = {45-–50}
566−}
567−
568−@book{pebook,
569− title = {Partial Evaluation and Automatic Program Generation},
570− author = {N.D. Jones and C.K. Gomard and P. Sestoft},
571− year = 1993,
572− publisher = {Prentice Hall International}
573−}
574−
575−@inproceedings{pantheon,
576− author = {Sean Seefried and Manuel Chakravarty and Gabriele Keller},
577− title = {Optimising Embedded {DSLs} using {Template Haskell}},
578− year = {2004},
579− booktitle = {{Proc. GPCE~'04: Conf. Generative Prog. and Component Eng.}},
580− publisher = {Springer},
581− series = {LNCS}
582−}
583−
584−@article{pan,
585− author = {Elliott, Conal and Finne, Sigbj\orn and De Moor, Oege},
586− title = {Compiling embedded languages},
587− journal = {J. Funct. Program.},
588− volume = {13},
589− number = {3},
590− year = {2003},
591− issn = {0956-7968},
592− pages = {455--481},
593− doi = {http://dx.doi.org/10.1017/S0956796802004574},
594− publisher = {Cambridge University Press},
595− address = {New York, NY, USA},
596− }
597−
598−
599−@inproceedings{russell,
600− author = {Sozeau, Matthieu},
601− title = {Program-ing finger trees in Coq},
602− booktitle = {{ICFP} '07: Proceedings of the 12th {ACM} {SIGPLAN} international conference on Functional programming},
603− year = {2007},
604− isbn = {978-1-59593-815-2},
605− pages = {13--24},
606− location = {Freiburg, Germany},
607− doi = {http://doi.{ACM}.org/10.1145/1291151.1291156},
608− publisher = {{ACM}},
609− address = {New York, NY, USA},
610− }
611−
612−@inproceedings{turner-total,
613− author = {D. A. Turner},
614− title = {Elementary Strong Functional Programming},
615− year = 1995,
616− booktitle = "First International Symposium on Functional Programming Languages in Education",
617− publisher = {Springer},
618− series = {LNCS},
619− volume = {1022},
620− pages = {1--13}
621−}
622−
623−@incollection{free-theorems,
624− author = "P. Wadler",
625− title = "Theorems for Free!",
626− booktitle = "{Proc. 4th Int.\ Conf.\ on Funct.\ Prog.\ Languages and Computer Arch., {FPCA}'89, London, {UK}, 11--13 Sept 1989}",
627− publisher = "{ACM} Press",
628− address = "New York",
629− pages = "347--359",
630− year = "1989",
631− url = "citeseer.ist.psu.edu/wadler89theorems.html"
632−}
633−
634−@inproceedings{TrulyConcurrent,
635− author = {Naiyong Jin and Jifeng He},
636− title = {Towards A Truly Concurrent Model for Processes Sharing Resources},
637− booktitle = {Proc. 3rd {IEEE} International Conf. on Soft. Eng. and Formal Methods},
638− year = {2005},
639− isbn = {0-7695-2435-4},
640− pages = {231--239},
641− doi = {http://dx.doi.org/10.1109/SEFM.2005.50},
642− publisher = {{IEEE} Computer Society},
643− address = {Washington, DC, USA},
644− }
645−
646−@misc{GPCE2006,
647− note = {Omitted to preserve anonymity, contact PC chair for details}
648−}
649−
650−@misc{IFL2006,
651− note = {Omitted to preserve anonymity, contact PC chair for details}
652−}
653−
654−@misc{ivor-anon,
655− note = {Omitted to preserve anonymity, contact PC chair for details}
656−}
657−
658−@inproceedings{HaskellIO,
659− author = {Simon L. {Peyton Jones} and Philip Wadler},
660− title = {Imperative functional programming},
661− booktitle = {Proc. 20th {ACM} Symposium on Principles of programming languages},
662− year = {1993},
663− isbn = {0-89791-560-7},
664− pages = {71--84},
665− location = {Charleston, South Carolina, United States},
666− doi = {http://doi.{ACM}.org/10.1145/158511.158524},
667− publisher = {{ACM}},
668− address = {New York, NY, USA},
669− }
670−
671−@article{CorrectnessConstruction,
672−author = "P. Amey",
673−title = "{Correctness by Construction: Better can also be Cheaper}",
674−journal = "{CrossTalk: the Journal of Defense Software Engineering}",
675−month = mar,
676−year = 2002,
677−pages = "24--28"
678−}
679−
680−
681−
682−@INPROCEEDINGS{hj:popl03,
683− AUTHOR = {M. Hofmann and S. Jost},
684− TITLE = {Static Prediction of Heap Space Usage for First-Order Function
685−al Programs},
686−booktitle = "Proc. {POPL 2003 --- 2003 {ACM} Symp. on Principles of Programming La
687−nguages}",
688− KEY = {HJ_POPL03},
689− PAGES = {185--197},
690− YEAR = {2003},
691− ORGANIZATION = {{ACM}}
692−}
693−
694−
695−@article{kobayashi-lock,
696− author = {Naoki Kobayashi},
697− title = {A type system for lock-free processes},
698− journal = {Inf. Comput.},
699− volume = {177},
700− number = {2},
701− year = {2002},
702− issn = {0890-5401},
703− pages = {122--159},
704− doi = {http://dx.doi.org/10.1016/S0890-5401(02)93171-8},
705− publisher = {Academic Press, Inc.},
706− address = {Duluth, MN, USA},
707− }
708−
709−@techreport{linear-alias,
710− title = {Linear types for aliased resources},
711− author = {Chris Hawblitzel},
712− year = {2005},
713− institution = {Microsoft Research},
714− number = {MSR-TR-2005-141}
715−}
716−
717−@article{kobayashi-esop,
718− title = {Type-Based Analysis of Deadlock fora Concurrent Calculus with Interrupts},
719− author = {Kohei Suenaga and Naoki Kobayashi},
720− year = {2007},
721− booktitle = {ESOP}
722−}
723−
724−@inproceedings{res-c,
725− title = {A Path Sensitive Type System for Resource Usage Verification of C Like Languages},
726− author = {Hyun-Goo Kang and Youil Kim and Taisook Han and Hwansoo Han},
727− year = 2005,
728− publisher = {Springer-Verlag},
729− booktitle = {Programming Languages and Systems},
730− pages = {264--280},
731− series = {LNCS},
732− volume = {3780}
733−}
734−
735−@miscs{lsr,
736− title = {Lightweight static resources: Sexy types for embedded and systems programming},
737− author = {Oleg Kiselyov and Chung-Chieh Shan},
738− year = 2007,
739− note = {Draft}
740−}
741−
742−@inproceedings{scoped-res,
743− title = {Resource Usage Analysis Via Scoped Methods},
744− author = {Gang Tan and Xinming Ou and David Walker},
745− booktitle = {Foundations of Object-Oriented Languages},
746− year = {2003}
747−}
748−
749−@article{igarashi-res,
750− author = {Igarashi, Atsushi and Kobayashi, Naoki},
751− title = {Resource usage analysis},
752− journal = {ACM Trans. Program. Lang. Syst.},
753− volume = {27},
754− issue = {2},
755− month = {March},
756− year = {2005},
757− issn = {0164-0925},
758− pages = {264--313},
759− numpages = {50},
760− url = {http://doi.acm.org/10.1145/1057387.1057390},
761− doi = {http://doi.acm.org/10.1145/1057387.1057390},
762− acmid = {1057390},
763− publisher = {ACM},
764− address = {New York, NY, USA},
765− keywords = {Resource usage, type inference},
766−}
767−
768−@phdthesis{monitoring,
769− title = {Policy Enforcement via Program Monitoring},
770− author = {Jarred Adam Ligatti},
771− year = 2006,
772− month = {May}
773−}
774−
775−@inproceedings{sec-policy,
776− title = {A Type System for Expressive Security Policies},
777− author = {David Walker},
778− booktitle = {Twenty-Seventh {ACM} {SIGPLAN} Symposium on Principles of Programming Languages},
779− pages = {254--267},
780− year = 2000}
781−
782−@inproceedings{res-dfa,
783− author = {K. Marriott and P.J. Stuckey and M. Sulzmann},
784− title = {Resource Usage Verification},
785− year = 2003,
786− booktitle = {In Proc. of First Asian Symposium, APLAS 2003},
787− pages = {212--229},
788− publisher = {Springer-Verlag}
789−}
790−
791−@incollection{ hancock-interactive,
792− author = "Peter Hancock and Anton Setzer",
793− title = "Interactive Programs in Dependent Type Theory",
794− booktitle = "Proc.\ of 14th Ann.\ Conf.\ of {EACSL}, {CSL}'00, Fischbau, Germany, 21--26 Aug 2000",
795− volume = "1862",
796− publisher = "Springer-Verlag",
797− address = "Berlin",
798− editor = "P. Clote and H. Schwichtenberg",
799− pages = "317--331",
800− year = "2000",
801− url = "citeseer.ist.psu.edu/hancock00interactive.html" }
802−
803−@inproceedings{popeea-resources,
804− author = {Corneliu Popeea and Wei-Ngan Chin},
805− title = {A type system for resource protocol verification and its correctness proof},
806− booktitle = {PEPM '04: Proceedings of the 2004 {ACM} {SIGPLAN} symposium on Partial evaluation and semantics-based program manipulation},
807− year = {2004},
808− isbn = {1-58113-835-0},
809− pages = {135--146},
810− location = {Verona, Italy},
811− doi = {http://doi.{ACM}.org/10.1145/1014007.1014021},
812− publisher = {{ACM} Press},
813− address = {New York, NY, USA},
814− }
815−
816−@inproceedings{sheard-langfuture,
817− author = {Tim Sheard},
818− title = "Languages of the future",
819− booktitle = "{ACM} Conference on Object Orientated Programming Systems, Languages and Applicatioons (OOPSLA'04)",
820− year = "2004"
821−}
822−
823−@inproceedings{ivor,
824− author = {Edwin Brady},
825− title = {{Ivor}, a proof engine},
826− year = {2007},
827− publisher = {Springer-Verlag},
828− series = {LNCS},
829− booktitle = {Implementation and Application of Functional Languages 2006}
830−}
831−
832−@misc{coq-in-coq,
833− author = {Bruno Barras and Benjamin Werner},
834− year = 1997,
835− title = {{Coq} in {Coq}}
836−}
837−
838−@article{hudak-edsl,
839− author = {Paul Hudak},
840− title = {Building Domain-Specific Embedded Languages},
841− year = {1996},
842− month = {December},
843− journal = {{ACM} Computing Surveys},
844− volume = {28A},
845− number = {4}
846−}
847−
848−@inproceedings{concon,
849− author = {Conor McBride and Healfdene Goguen and James McKinna},
850− title = {Some Constructions On Constructors},
851− year = 2005,
852− booktitle = {TYPES 2004},
853− publisher = {Springer},
854− series = {LNCS},
855− volume = {3839}
856−}
857−
858−@InProceedings{Hume-GPCE,
859−author = {K. Hammond and G.J. Michaelson},
860−title = {{Hume: a Domain-Specific Language for Real-Time Embedded Systems}},
861−booktitle = {{Proc. Conf. Generative Programming and Component Engineering (GPCE~'03)}},
862−publisher = {Springer-Verlag},
863−series = {Lecture Notes in Computer Science},
864−year = {2003},
865−}
866−
867−@inproceedings{lcf-milner,
868− author = {Robin Milner},
869− title = {{LCF}: A Way of Doing Proofs with a Machine},
870− booktitle = {Mathematical Foundations of Computer Science 1978},
871− pages = {146-159},
872− year = 1979,
873− series = {LNCS},
874− volume = {64}
875−}
876−
877−
878−@inproceedings{epireloaded,
879− title = {Epigram Reloaded: A Standalone Typechecker for {ETT}},
880− author = {James Chapman and Thorsten Altenkirch and Conor McBride},
881− year = 2006,
882− booktitle = {Trends in Functional Programming 2005},
883− note = {To appear}
884−}
885−
886−@TECHREPORT{why-tool,
887− AUTHOR = {J.-C. Filli\^atre},
888− TITLE = {{Why: a multi-language multi-prover verification tool}},
889− INSTITUTION = {{LRI, Universit\'e Paris Sud}},
890− TYPE = {{Research Report}},
891− NUMBER = {1366},
892− MONTH = {March},
893− YEAR = 2003,
894− URL = {http://www.lri.fr/~filliatr/ftp/publis/why-tool.ps.gz}
895−}
896−
897−@misc{ large-extraction,
898− author = "Lu\'iz Cruz-Filipe and Bas Spitters",
899− title = "Program Extraction from Large Proof Developments",
900− year = 2003,
901− url = "citeseer.ist.psu.edu/cruz-filipe03program.html" }
902−
903−@inproceedings{ fta,
904− author = "Herman Geuvers and Freek Wiedijk and Jan Zwanenburg",
905− title = "A Constructive Proof of the Fundamental Theorem of Algebra without Using the Rationals",
906− booktitle = "{TYPES 2000}",
907− pages = "96--111",
908− year = "2000",
909− url = "citeseer.ist.psu.edu/geuvers01constructive.html" }
910−
911−@article{mckinna-expr,
912− title = {A type-correct, stack-safe, provably correct, expression compiler in {Epigram}},
913− author = {James McKinna and Joel Wright},
914− year = 2007,
915− journal = {Journal of Functional Programming},
916− note = {To appear}
917−}
918−
919−@article{pugh-omega,
920− title = "The {Omega} {Test}: a fast and practical integer programming algorithm for dependence analysis",
921− author = "William Pugh",
922− journal = "Communication of the {ACM}",
923− year = 1992,
924− pages = {102--114}
925−}
926−
927−@misc{four-colour,
928− author = "Georges Gonthier",
929− title = "A computer-checked proof of the {Four Colour Theorem}",
930− year = 2005,
931− howpublished = {\url{http://research.microsoft.com/~gonthier/4colproof.pdf}}}
932−
933−@inproceedings{sparkle,
934− author = "Maarten {de Mol} and Marko {van Eekelen} and Rinus Plasmeijer",
935− title = "Theorem Proving for Functional Programmers",
936− url = "citeseer.ist.psu.edu/654423.html",
937− BOOKTITLE = {Proc. Implementation of Functional Languages (IFL 2002)},
938− publisher = {Springer},
939− series = {LNCS},
940− volume = {2312},
941− year = 2002
942− }
943−
944−@misc{agda,
945− title = {Agda},
946− author = {Catarina Coquand},
947− howpublished= {\url{http://agda.sourceforge.net/}},
948− year = 2005
949−}
950−
951−@misc{cover,
952− title = {Cover Translator},
953− howpublished = {\url{http://coverproject.org/CoverTranslator/}}
954−}
955−
956−@misc{parsec,
957− title = {Parsec, a fast combinator parser},
958− author = {Daan Leijen},
959− year = {2001},
960− howpublished = {\url{http://www.cs.uu.nl/~daan/parsec.html}}
961−}
962−
963−@inproceedings{dtpmsp-gpce,
964− author = {Edwin Brady and Kevin Hammond},
965− title = {A Verified Staged Interpreter is a Verified Compiler},
966− booktitle = {{Proc. Conf. Generative Programming and Component Engineering (GPCE~'06)}},
967− year = 2006
968−}
969−
970−@misc{haddock,
971− title = {Haddock: A {Haskell} Documentation Tool},
972− howpublished = {\url{http://www.haskell.org/haddock/}}
973−}
974−
975−@inproceedings{offshoring,
976− title = {Implicitly Heterogeneous Multi-Stage Programming},
977− author = {Jason Eckhardt and Roumen Kaibachev and Emir Pa\v{s}al\'{i}c and Kedar Swadi and Walid Taha},
978− booktitle = {Proc. 2005 Conf. on Generative Programming and Component Engineering (GPCE 2005)},
979− publisher = {Springer},
980− series = {LNCS},
981− volume = {3676},
982− year = 2005
983−}
984−
985−@misc{alti-partial,
986− title = {Stop thinking about bottoms when writing programs},
987− author = {Thorsten Altenkirch},
988− year = 2006,
989− note = {Talk at BCTCS 2006}
990−}
991−
992−@misc{tarmo-partial,
993− title = {Partiality is an Effect},
994− author = {Tarmo Uustalu},
995− year = 2004,
996− note = {Talk at Dagstuhl workshop on Dependently Typed Progamming}
997−}
998−
999−@inproceedings{McKinnaPOPL06,
1000− author = {James McKinna},
1001− title = {Why dependent types matter},
1002− booktitle = {Proc. {ACM} Symp. on Principles of Programming Languages (POPL 2006)},
1003− year = {2006},
1004− issn = {0362-1340},
1005− pages = {1--1},
1006− doi = {http://doi.{ACM}.org/10.1145/1111320.1111038},
1007−}
1008−
1009−
1010−@inproceedings{leroy-compiler,
1011− title = {Formal Certification of a Compiler Back-end},
1012− author = {Xavier Leroy},
1013− year = 2006,
1014− booktitle = {Principles of Programming Languages 2006},
1015− pages = {42--54},
1016− publisher = {{ACM} Press}
1017−}
1018−
1019−@inproceedings{hutton-exceptions,
1020− title = {Compiling Exceptions Correctly},
1021− year = 2004,
1022− author = {Graham Hutton and Joel Wright},
1023− booktitle = {Mathematics of Program Construction},
1024− publisher = {Springer},
1025− series = {LNCS},
1026− volume = {3125}
1027−}
1028−
1029−@inproceedings{tagless-staged,
1030− title = {Tagless Staged Interpreters for Typed Languages},
1031− year = {2002},
1032− booktitle = {Proc. 2002 International Conf. on Functional Programming ({ICFP} 2002)},
1033− author = {Emir Pa\v{s}al\'{i}c and Walid Taha and Tim Sheard},
1034− publisher = {{ACM}}
1035−}
1036−
1037−@inproceedings{env-classifiers,
1038− title = {Environment Classifiers},
1039− year = 2003,
1040− author = {Walid Taha},
1041− booktitle = {Proc. {ACM} Symp. on Principles of Programming Languages (POPL 2003)},
1042− pages = {26--37},
1043−}
1044−
1045−@inproceedings{dsl-msp,
1046− title = {{DSL} Implementation in {MetaOCaml}, {Template Haskell}, {and C++}},
1047− booktitle = {Domain Specific Program Genearation 2004},
1048− author = {Krzysztof Czarnecki and John O'Donnell and J\"{o}rg Striegnitz and Walid Taha},
1049− publisher = {Springer},
1050− series = {LNCS},
1051− volume = {3016},
1052− year = 2004
1053−}
1054−
1055−@misc{ gadt-extk,
1056− author = {Tim Sheard and James Hook and Nathan Linger},
1057− title = {{GADTs} + Extensible Kinds = Dependent Programming},
1058− year = 2005,
1059− misc = {Submitted to {ICFP} '05}
1060−}
1061−
1062−@INPROCEEDINGS{dt-framework,
1063− TITLE = {A Dependently Typed Framework for Static Analysis of Program Execution Costs},
1064− YEAR = {2006},
1065− BOOKTITLE = {Proc. Implementation of Functional Languages (IFL 2005)},
1066− AUTHOR = {Edwin Brady and Kevin Hammond},
1067− VOLUME = {4015},
1068− SERIES = {LNCS},
1069− PAGES = {74--90},
1070− PUBLISHER = {Springer}
1071−}
1072−
1073−@INPROCEEDINGS{step-counting,
1074− TITLE = {Accurate Step Counting},
1075− YEAR = {2006},
1076− BOOKTITLE = {Proc. Implementation of Functional Languages (IFL 2005)},
1077− AUTHOR = {Catherine Hope and Graham Hutton},
1078− PUBLISHER = {Springer}
1079−}
1080−
1081−@misc{multi-taha,
1082− author = {Walid Taha},
1083− title = {{A Gentle Introduction to Multi-stage Programming}},
1084− year = {2003},
1085− note = {Available from \url{http://www.cs.rice.edu/~taha}},
1086− notnote = {Available from \url{http://www.cs.rice.edu/~taha/publications/journal/dspg04a.pdf}}
1087−}
1088−
1089−@misc{mckinnabrady-phase,
1090− title = {Phase Distinctions in the Compilation of {Epigram}},
1091− year = 2005,
1092− author = {James McKinna and Edwin Brady},
1093− note = {Draft}
1094−}
1095−
1096−@phdthesis{ brady-thesis,
1097− author = {Edwin Brady},
1098− title = {Practical Implementation of a Dependently Typed Functional Programming Language},
1099− year = 2005,
1100− school = {University of Durham}
1101−}
1102−
1103−@phdthesis{ taha-thesis,
1104− author = {Walid Taha},
1105− title = {Multi-stage Programming: Its Theory and Applications},
1106− year = 1999,
1107− school = {Oregon Graduate Inst. of Science and Technology}
1108−}
1109−
1110−@phdthesis{ pasalic-thesis,
1111− author = {Emir Pa\v{s}al\'{i}c},
1112− title = {The Role of Type-Equality in Meta-programming},
1113− year = 2004,
1114− school = {OGI School of Science and Engineering}
1115−}
1116−
1117−@misc{ydtm,
1118− author = {Thorsten Altenkirch and Conor McBride and James McKinna},
1119− title = {Why Dependent Types Matter},
1120− note = {Draft},
1121− year = 2005}
1122−
1123−
1124−@inproceedings { wadler-listless,
1125− author = {Philip Wadler},
1126− title = {Listlessness is better than laziness: {Lazy} evaluation and garbage collection at compile-time},
1127− booktitle = {Proceedings of the 1984 {ACM} Symposium on LISP and functional programming},
1128− year = 1984,
1129− pages = {45--52}
1130−}
1131−
1132−@techreport { gofer-impl,
1133− author = {Mark P. Jones},
1134− title = {The implementation of the Gofer functional programming system},
1135− month = {May},
1136− year = {1994},
1137− number = {YALEU/DCS/RR-1030},
1138− institution = {Yale University}
1139−}
1140−
1141−@techreport { pm-opt1,
1142− author = {Kevin Scott and Norman Ramsey},
1143− title = {When do match-compilation heuristics matter?},
1144− month = {May},
1145− year = {2000},
1146− number = {CS-2000-13},
1147− institution = {Department of Computer Science, University of Virginia}
1148−}
1149−
1150−@inproceedings{ pm-opt2,
1151− author = "Fabrice Le Fessant and Luc Maranget",
1152− title = "Optimizing Pattern Matching",
1153− booktitle = "International Conference on Functional Programming",
1154− pages = "26-37",
1155− year = "2001",
1156− url = "citeseer.ist.psu.edu/lefessant01optimizing.html" }
1157−
1158−@incollection{con-engine,
1159− author = {G\'{e}rard Huet},
1160− title = {The constructive engine},
1161− booktitle = {A Perspective in Theoreticak Computer Science},
1162− publisher = {World Scientific Publishing},
1163− year = {1989},
1164− editor = {R. Narasimhan},
1165− note = {Commemorative Volume for Gift Siromoney},
1166− pages = {38--69}
1167−}
1168−
1169−@inproceedings{gadts,
1170− title = {Simple unification-based type inference for {GADTs}},
1171− author = {Simon {Peyton Jones} and Dimitrios Vytiniotis and Stephanie Weirich and Geoffrey Washburn},
1172− year = {2006},
1173− booktitle = {Proc. 2006 International Conf. on Functional Programming ({ICFP} 2006)}
1174−}
1175−
1176−@misc{wobbly,
1177− author = {Simon {Peyton Jones} and Geoffrey Washburn and Stephanie Weirich},
1178− title = {Wobbly types: type inference for generalised algebraic data types},
1179− year = {2004},
1180− note = {Submitted to POPL 2005}
1181−}
1182−
1183−@misc{epigram-afp,
1184− author = {Conor McBride},
1185− title = {Epigram: Practical Programming with Dependent Types},
1186− year = {2004},
1187− howpublished = {Lecture Notes, International Summer School on Advanced Functional Programming}
1188−}
1189−
1190−@book{ml85,
1191− author = {Per Martin-L\"{o}f},
1192− title = "Intuitionistic Type Theory",
1193− year = "1985",
1194− publisher = "Bibliopolis"
1195−}
1196−
1197−@article{modular-fulllazy,
1198− title = {A Modular Fully Lazy Lambda Lifter in {Haskell}},
1199− author = {Simon {Peyton Jones} and David Lester},
1200− year = {1991},
1201− month = {May},
1202− journal = {Software Practice and Experience},
1203− volume = {21},
1204− number = {5},
1205− pages = {479--506}
1206−}
1207−
1208−@article{ghani-jay95,
1209− author = {Barry Jay and Neil Ghani},
1210− title = {The Virtues of Eta-Expansion},
1211− journal = {Journal of Functional Programming},
1212− year = {1995},
1213− volume = {5},
1214− number = {2},
1215− pages = {135-154},
1216−}
1217−
1218−@misc{nkpat,
1219− author = {Lennart Augustsson},
1220− title = {n+k patterns},
1221− year = {1993},
1222− howpublished = {Message to the haskell mailing list, Mon, 17 May 93}
1223−}
1224−
1225−@article{ danvy98functional,
1226− author = "Olivier Danvy",
1227− title = "Functional Unparsing",
1228− journal = "Journal of Functional Programming",
1229− volume = "8",
1230− number = "6",
1231− pages = "621-625",
1232− year = "1998",
1233− url = "citeseer.ist.psu.edu/danvy98functional.html" }
1234−
1235−@inproceedings{SeveriPoll94,
1236− author = {Paula Severi and Erik Poll},
1237− booktitle = {Logical Foundations of Computing Science, LFCS'94},
1238− editor = {A. Nerode and Yu. V. Matiyasevich},
1239− number = {813},
1240− pages = {316--328},
1241− publisher = {Springer},
1242− series = {LNCS},
1243− title = {{P}ure {T}ype {S}ystems with {D}efinitions},
1244− year = {1994}
1245−}
1246−
1247−@inproceedings{coinductive,
1248− title = {An Application of Co-Inductive Types in Coq: Verification of the Alternating Bit Protocol},
1249− booktitle = {Proceedings of the 1995 Workshop on Types for Proofs and Programs},
1250− series = {LNCS},
1251− year = {1995},
1252− volume = {1158},
1253− pages = {135-152},
1254− publisher = {Springer-Verlag},
1255− author = {Eduardo Gim\'{e}nez}
1256−}
1257−
1258−@book{erlang,
1259− author = "Joe Armstrong and Robert Virding and Claes Wikstr{\"o}m and Mike Williams",
1260− title = "Concurrent Programming in Erlang",
1261− edition = "Second",
1262− publisher = "Prentice-Hall",
1263− year = "1996",
1264− url = "citeseer.ist.psu.edu/armstrong93concurrent.html"
1265−}
1266−
1267−@PhdThesis{alti:phd93,
1268− author = "Thorsten Altenkirch",
1269− title = "Constructions, Inductive Types and Strong Normalization",
1270− school = "University of Edinburgh",
1271− year = "1993",
1272− month = "November",
1273−}
1274−
1275−@inproceedings{coq-modules,
1276− author = "Jacek Chrzaszcz",
1277− title = "Modules in {Coq} Are and Will Be Correct",
1278− year = {2004},
1279− booktitle = {Types for Proofs and Programs 2003},
1280− editor = {Stefano Berardi and Mario Coppo and Ferruccio Damiani},
1281− publisher = {Springer},
1282− volume = {3085}
1283−}
1284−
1285−@inproceedings{comp-polymorphism,
1286− author = "Robert Harper and Greg Morrisett",
1287− title = "Compiling Polymorphism Using Intensional Type Analysis",
1288− year = "1995",
1289− booktitle = "Proceedings of the 22nd {ACM} {SIGPLAN}-SIGACT symposium on Principles of programming languages",
1290− pages = "130 -- 141"
1291−}
1292−
1293−@misc{runtime-loader,
1294− author = "Andre Pang",
1295− title = "{GHC} Runtime Loading",
1296− year = "2004",
1297− howpublished = {Available from \verb+http://www.algorithm.com.au/wiki/hacking/haskell.ghc_runtime_loading+}
1298−}
1299−
1300−@article{mccarthy-lisp,
1301− author = "John McCarthy",
1302− title = "Recursive Functions of Symbolic Expressions and Their Computation By Machine",
1303− year = "1960",
1304− journal = "Communications of the {ACM}",
1305− volume = "3",
1306− number = "4",
1307− pages = "184--195"
1308−}
1309−
1310−@book{stl,
1311− author = " David R. Musser and Atul Saini and Gillmer J. Derge",
1312− title= "The {STL} Tutorial and Reference Guide: {C++} Programming with the Standard Template Library",
1313− year = "2001",
1314− publisher = "Addison Wesley"
1315−}
1316−
1317−@misc{ phase-distinction,
1318− author = "Luca Cardelli",
1319− title = "Phase Distinctions in Type Theory",
1320− howpublished = "Manuscript",
1321− year = "1988",
1322− url = "citeseer.ist.psu.edu/cardelli88phase.html" }
1323−
1324−@book {pierce-types,
1325− author = "Benjamin C. Pierce",
1326− title = "Type and Programming Languages",
1327− year = "2002",
1328− publisher = "MIT Press"
1329−}
1330−
1331−@article{ coqcc,
1332− Author = "Thierry Coquand and G\'{e}rard Huet",
1333− title = "The calculus of constructions",
1334− year = "1988",
1335− journal = "Information and Computation",
1336− volume = "76",
1337− pages = "95--120"
1338−}
1339−
1340−@article{ miller91jlc,
1341− Author = "Dale Miller",
1342− Title = "A Logic Programming Language with Lambda-Abstraction,
1343− Function Variables, and Simple Unification",
1344− Journal = "Journal of Logic and Computation",
1345− Volume = "1",
1346− Number = "4",
1347− Pages = "497-536",
1348− Year = "1991",
1349− URL = "citeseer.ist.psu.edu/miller91logic.html",
1350− URL = "file://ftp.cis.upenn.edu/pub/papers/miller/jlc91.dvi.Z" }
1351−
1352−@article{miller-unity,
1353− author = "Dale Miller",
1354− title = "Unification Under a Mixed Prefix",
1355− journal = "Journal of Symbolic Computation",
1356− volume = "14",
1357− pages = "321--358",
1358− year = 1992
1359−}
1360−
1361−@inproceedings{ cynthia,
1362− author = "Jon Whittle and Alan Bundy and Richard J. Boulton and Helen Lowe",
1363− title = "An {ML} Editor Based on Proofs-As-Programs",
1364− booktitle = "Automated Software Engineering",
1365− pages = "166-173",
1366− year = "1999",
1367− url = "citeseer.ist.psu.edu/whittle99ml.html" }
1368−
1369−
1370−@misc{ewd340,
1371− title={The Humble Programmer},
1372− author={Edsger Dijkstra},
1373− year={1972},
1374− note={Turing Award Lecture, EWD 340}
1375−}
1376−
1377−@misc{fortran,
1378− title={Specifications for the {IBM} Mathematical FORmula TRANslating System, {FORTRAN}},
1379− author={{IBM Applied Science Division}},
1380− key={IBM},
1381− year={1954},
1382− month={November}
1383−}
1384−
1385−@inproceedings{quickcheck,
1386− title = {{QuickCheck}: A Lightweight Tool For Random Testing Of {Haskell} Programs},
1387− author = {Koen Claessen and John Hughes},
1388− year = {2000},
1389− booktitle = {International Conference on Functional Programming}
1390−}
1391−
1392−@inproceedings{currylam,
1393− title = {Functionality in Combinatory Logic},
1394− author = {Haskell Curry},
1395− year = {1934},
1396− booktitle = {Proc. Nat. Acad. Sci, USA},
1397− volume = {20},
1398− pages = {584--590}
1399−}
1400−
1401−@article{churchsimplelam1,
1402− title = {A set of postulates for the foundation of logic},
1403− author = {Alonzo Church},
1404− year = {1932},
1405− journal = {Annals of Mathematics},
1406− volume = {2},
1407− number = {33},
1408− pages = {346--366}
1409−}
1410−
1411−@article{churchsimplelam2,
1412− title = {A set of postulates for the foundation of logic},
1413− author = {Alonzo Church},
1414− year = {1933},
1415− journal = {Annals of Mathematics},
1416− volume = {2},
1417− number = {34},
1418− pages = {839--864}
1419−}
1420−
1421−@article{churchlam,
1422− title = {A Formulation of the Simple Theory of Types},
1423− author = {Alonzo Church},
1424− year = {1940},
1425− journal = {Journal of Symbolic Logic},
1426− volume = {5},
1427− pages = {56--58}
1428−}
1429−
1430−@book{mitchell,
1431− title = {Concepts in Programming Languages},
1432− author = {John C. Mitchell},
1433− year = {2003},
1434− publisher = {Cambridge University Press}
1435−}
1436−
1437−@inproceedings{harrison-hol99,
1438− title = {A Machine-Checked Theory of Floating Point Arithmetic},
1439− year = {1999},
1440− booktitle = {Theorem Proving in Higher Order Logics: 12th International Conference, TP},
1441− pages = {113--130},
1442− author = {John Harrison},
1443− crossref = {hol99}
1444−}
1445−
1446−@inproceedings{c--,
1447− title = {C--: A portable assembly language},
1448− year = {1997},
1449− booktitle = {Workshop on Implementing Functional Languages, St Andrews},
1450− author = {Simon {Peyton Jones} and Thomas Nordin and Dino Oliva},
1451− crossref = {func-imp97}
1452−}
1453−
1454−@proceedings{func-imp97,
1455− title = {Workshop on Implementing Functional Languages, St Andrews},
1456− year = {1997},
1457− editor = {C Clack},
1458− publisher = {Springer-Verlag}
1459−}
1460−
1461−@proceedings{hol99,
1462− volume = {1690},
1463− title = {Theorem Proving in Higher Order Logics: 12th International Conference, TPHOLs'99},
1464− year = {1999},
1465− editor = {Yves Bertot and Gilles Dowek and Andr{\'e} Hirschowitz and Christine Paul},
1466− publisher = {Springer-Verlag},
1467− address = {Nice, France},
1468− series = {LNCS}
1469−}
1470−
1471−@book{mathlogic,
1472− title = {Mathematical Logic and Programming Languages},
1473− year = {1985},
1474− editor = {C.A.R. Hoare and J.C. Shepherdson},
1475− publisher = {Prentice-Hall}
1476−}
1477−
1478−@book{automath,
1479− title = {Selected Papers on Automath},
1480− year = {1994},
1481− editor = {S. Abramsky and J. Barwise and K. Fine and H.J. Keisler and A.S. Troelstr},
1482− publisher = {North-Holland}
1483−}
1484−
1485−@misc{gimps,
1486− howpublished = {http://www.mersenne.org/prime.htm},
1487− title = {Great Internet Mersenne Prime Search}
1488−}
1489−
1490−@misc{haskell-report,
1491− title = {Haskell 98 Language and Libraries --- The Revised Report},
1492− year = {2002},
1493− month = {December},
1494− author = {Simon {Peyton Jones} and others},
1495− howpublished = {Available from \verb+http://www.haskell.org/+}
1496−}
1497−
1498−@inproceedings{cayenne-{ICFP},
1499− author = "Lennart Augustsson",
1500− title = "Cayenne - a Language with Dependent Types",
1501− booktitle = "Proc. 1998 International Conf. on Functional Programming ({ICFP} '98)",
1502− pages = "239--250",
1503− year = "1998",
1504− url = "citeseer.nj.nec.com/augustsson98cayenne.html"
1505−}
1506−
1507−
1508−@misc{equality-cayenne,
1509− howpublished = {\verb+http://www.cs.chalmers.se/~augustss/cayenne/+},
1510− title = {Equality Proofs in Cayenne},
1511− year = {1999},
1512− author = {Lennart Augustsson}
1513−}
1514−
1515−@misc{interp-cayenne,
1516− title = {An exercise in dependent types: A well-typed interpreter},
1517− year = {1999},
1518− author = {Lennart Augustsson and Magnus Carlsson}
1519−}
1520−
1521−@inproceedings{balaa00fixpoint,
1522− title = {Fix-Point Equations for Well-Founded Recursion in Type Theory},
1523− year = {2000},
1524− booktitle = {Theorem Proving in Higher Order Logics},
1525− pages = {1-16},
1526− author = {Antonia Balaa and Yves Bertot}
1527−}
1528−
1529−@inproceedings{isabelle-maple,
1530− title = {Theorems and algorithms: An interface between Isabelle and Maple},
1531− year = {1995},
1532− booktitle = {International Symposium on Symbolic and Algebraic Computation},
1533− author = {Ballarin, C. and Homann, K., and Calmet, J.}
1534−}
1535−
1536−@book{barendregt-num,
1537− title = {The Lambda Calculus, Its Syntax and Semantics},
1538− year = {1984},
1539− publisher = {North-Holland},
1540− author = {Henk Barendregt}
1541−}
1542−
1543−@book{beiler,
1544− title = {Recreations in the Theory of Numbers},
1545− year = {1964},
1546− publisher = {Dover},
1547− author = {Albert H. Beiler}
1548−}
1549−
1550−@article{multidigit,
1551− journal = {Advances in Applied Mathematics},
1552− title = {Multidigit Multiplication for Mathematicians},
1553− year = {1998},
1554− author = {Daniel J. Bernstein}
1555−}
1556−
1557−@article{buhler-fox,
1558− journal = {{ACM} Crossroads 2.1.},
1559− month = {September},
1560− title = {The Fox project: A language-structured approach to networking software.},
1561− year = {1995},
1562− author = {Buhler, J.},
1563− note = {Available at http://www.{ACM}.org/crossroads/xrds2-1/foxnet.html}
1564−}
1565−
1566−@techreport{burstall91,
1567− title = {Computer Assisted Proof for Mathematics: an Introduction Using the \textsc{Lego} Proof System},
1568− year = {1991},
1569− institution = {University of Edinburgh},
1570− author = {Rod Burstall}
1571−}
1572−
1573−@article{plastic,
1574− title = {An Implementation of {LF} with Coercive Subtyping and Universes},
1575− author = {Paul Callaghan and Zhaohui Luo},
1576− journal = {Journal of Automated Reasoning},
1577− volume = {27},
1578− number = {1},
1579− pages = {3--27},
1580− year = {2001}
1581−}
1582−
1583−@article{coercive,
1584− title = {Coercive subtyping},
1585− author = {Zhaohui Luo},
1586− journal = {J. Logic Comput.},
1587− volume = {9},
1588− number = {1},
1589− year = {1991},
1590− pages = {105--130}
1591−}
1592−
1593−@inproceedings{calmet-homann,
1594− title = {Classification of communication and cooperation mechanisms for logical and symbolic computation systems},
1595− year = {1996},
1596− booktitle = {Proceedings of the First International Workshop 'Frontiers of Combining S},
1597− pages = {133-146},
1598− publisher = {Kluwer},
1599− author = {J. Calmet and K. Homann}
1600−}
1601−
1602−@techreport{comm-proofs,
1603− title = {On Communicating Proofs in Interactive Mathematical Documents},
1604− year = {2000},
1605− institution = {Eindhoven University of Technology},
1606− author = {Olga Caprotti and Martijn Oostdijk}
1607−}
1608−
1609−@article{prime2999,
1610− title = {How to formally and efficiently prove Prime(2999)},
1611− year = {2001},
1612− author = {Olga Caprotti and Martijn Oostdijk},
1613− journal = {Symbolic Computation and Automated Reasoning},
1614− pages = {114--125}
1615−}
1616−
1617−@book{church-num,
1618− title = {The Calculi of Lambda-Conversion},
1619− year = {1941},
1620− publisher = {Princeton University Press},
1621− author = {Alonzo Church}
1622−}
1623−
1624−@book{nuprl86,
1625− title = {Implementing Mathematics with the NuPrl Proof Development System},
1626− year = {1986},
1627− publisher = {Prentice-Hall},
1628− address = {NJ},
1629− author = {Constable, Robert L. and others}
1630−}
1631−
1632−@book{conway,
1633− title = {On Numbers and Games},
1634− year = {1976},
1635− publisher = {Academic Press},
1636− author = {J.H. Conway}
1637−}
1638−
1639−@misc{coq-manual,
1640− howpublished = {\verb+http://coq.inria.fr/+},
1641− title = {The {Coq} Proof Assistant --- Reference Manual},
1642− year = {2009},
1643− author = {{Coq Development Team}}
1644−}
1645−
1646−@misc{tt-prog,
1647− month = {June},
1648− title = {Type Theory and Programming},
1649− year = {1994},
1650− author = {Thierry Coquand and Bengt Nordstr\"{o}m and Jan M. Smith and Bj\"{o}rn von Sydow}
1651−}
1652−
1653−@book{func-appr,
1654− title = {The Functional Approach to Programming},
1655− year = {1998},
1656− publisher = {Cambridge University Press},
1657− author = {Guy Cousineau and Michel Mauny}
1658−}
1659−
1660−@misc{ibmspec,
1661− howpublished = {http://www2.hursley.ibm.com/decimal/},
1662− month = {January},
1663− title = {Standard Decimal Arithmetic Specification},
1664− year = {2001},
1665− author = {Mike Cowlishaw},
1666− note = {\copyright IBM Corporation 2001}
1667−}
1668−
1669−@book{dummett,
1670− title = {Elements of Intuitionism},
1671− year = {2000},
1672− edition = {2nd},
1673− publisher = {Oxford: Clarendon},
1674− author = {Michael A.E. Dummet}
1675−}
1676−
1677−@article{dybjer94,
1678− title = {Inductive Families},
1679− year = {1994},
1680− author = {Peter Dybjer},
1681− journal = {Formal Aspects Of Computing},
1682− volume = {6},
1683− pages = {440--465}
1684−}
1685−
1686−@misc{octave,
1687− howpublished = {http://www.octave.org/},
1688− month = {February},
1689− title = {GNU Octave -- A high-level interactive language for numerical computations},
1690− year = {1997},
1691− author = {John W. Eaton}
1692−}
1693−
1694−@book{comp-methods,
1695− title = {Computing methods for scientists and engineers},
1696− year = {1968},
1697− publisher = {Oxford : Clarendon Press},
1698− author = {L. Fox and D.F. Mayers}
1699−}
1700−
1701−@misc{guile,
1702− howpublished = {http://www.gnu.org/software/guile/guile.html},
1703− title = {Guile -- Project GNU's extension language},
1704− year = {2001},
1705− author = {{Free Software Foundation}}
1706−}
1707−
1708−@article{need-dep,
1709− journal = {Journal of Functional Programming},
1710− number = {4},
1711− volume = {10},
1712− title = {Do we need dependent types?},
1713− year = {2000},
1714− pages = {409-415},
1715− author = {Daniel Fridlender and Mia Indrika}
1716−}
1717−
1718−@book{primes-programming,
1719− title = {Primes and Programming -- An Introduction to Number Theory with Computing},
1720− year = {1993},
1721− publisher = {Cambridge University Press},
1722− author = {Peter Giblin}
1723−}
1724−
1725−@misc{rec-coq,
1726− month = {May},
1727− title = {A Tutorial on Recursive Types in \textsc{Coq}},
1728− year = {1998},
1729− author = {Eduardo Gim\'{e}nez}
1730−}
1731−
1732−@article{goldberg91,
1733− journal = {{ACM} Computing Surveys},
1734− number = {1},
1735− volume = {23},
1736− title = {What every computer scientist should know about floating point arithmetic},
1737− year = {1991},
1738− pages = {5-48},
1739− author = {D. Goldberg}
1740−}
1741−
1742−@article{binary-lambda,
1743− journal = {Journal of Functional Programming},
1744− number = {6},
1745− volume = {10},
1746− title = {An adequate and efficient left associated binary numeral system in the $\lambda$-calculus},
1747− year = {2000},
1748− author = {Mayer Goldberg}
1749−}
1750−
1751−@book{hol,
1752− title = {Introduction to HOL},
1753− year = {1993},
1754− publisher = {Cambridge University Press},
1755− author = {M. Gordon and T. Melham}
1756−}
1757−
1758−@misc{gmp,
1759− howpublished = {Available from \verb+http://www.swox.com/gmp/manual/+},
1760− title = {The {GNU Multiple Precision} Arithmetic Library 4.1.3 --- Manual},
1761− year = {2004},
1762− author = {Torbj\"{o}rn Granlund and others}
1763−}
1764−
1765−@article{harrison-fmsd94,
1766− journal = {Formal Methods in System Design},
1767− volume = {5},
1768− title = {Constructing the Real Numbers in {HOL}},
1769− year = {1994},
1770− pages = {35--59},
1771− author = {John Harrison}
1772−}
1773−
1774−@book{harrison-thesis,
1775− title = {Theorem Proving with the Real Numbers},
1776− year = {1998},
1777− publisher = {Springer-Verlag},
1778− author = {John Harrison}
1779−}
1780−
1781−@techreport{hol-maple,
1782− title = {Reasing about the Reals: the marriage of HOL and Maple},
1783− year = {1993},
1784− institution = {University of Cambridge Computer Laboratory},
1785− author = {John Harrison and Laurent Th\'{e}ry}
1786−}
1787−
1788−@misc{coq-tutorial,
1789− howpublished = {http://pauillac.inria.fr/coq},
1790− title = {The \textsc{Coq} Proof Assistant - A Tutorial},
1791− author = {G\'{e}rard Huet and Gilles Kahn and Christine Paulin-Mohring}
1792−}
1793−
1794−@misc{restr-haskell,
1795− howpublished = {http://citeseer.nj.nec.com/253599.html},
1796− month = {September},
1797− title = {Restricted Data Types in Haskell},
1798− year = {1999},
1799− author = {John Hughes}
1800−}
1801−
1802−@misc{javadec,
1803− howpublished = {http://www2.hursley.ibm.com/decimalj/decimald.html},
1804− month = {September},
1805− title = {Decimal Arithmetic for Java -- a Proposal},
1806− year = {2000},
1807− author = {{IBM Corporation}}
1808−}
1809−
1810−@misc{ieee754,
1811− title = {{IEEE} Standard for Binary Floating Point Arithmetic},
1812− year = {1985},
1813− author = {{IEEE Standard 754}}
1814−}
1815−
1816−@misc{ieee854,
1817− title = {IEEE Standard for Radix-Independent Floating-Point Arithmetic},
1818− year = {1987},
1819− author = {{IEEE Standard 854}}
1820−}
1821−
1822−@inproceedings{jon91,
1823− title = {Completing the Rational and Metric Spaces in \textsc{Lego}},
1824− year = {1991},
1825− booktitle = {Proceedings of the Second Workshop on Logical Frameworks},
1826− author = {Claire Jones}
1827−}
1828−
1829−@misc{ typinghaskell,
1830− author = "Mark Jones",
1831− title = "Typing {Haskell} in {Haskell}",
1832− howpublished = "In Haskell Workshop, September 1999.",
1833− year = "1999",
1834− url = "citeseer.ist.psu.edu/article/jones99typing.html" }
1835−
1836−@article{karatsuba,
1837− journal = {Soviet Physics-Doklady},
1838− volume = {7},
1839− title = {Multiplication of multidigit numbers by automata},
1840− year = {1963},
1841− pages = {595--596},
1842− author = {A. Karatsuba and Y. Ofman}
1843−}
1844−
1845−@book{knuth2,
1846− volume = {2},
1847− title = {The Art of Computer Programming - Seminumerical Algorithms},
1848− year = {1969},
1849− publisher = {Addison Wesley},
1850− author = {Donald E. Knuth}
1851−}
1852−
1853−@article{next700,
1854− journal = {Communications of the {ACM}},
1855− number = {3},
1856− month = {March},
1857− volume = {9},
1858− title = {The next 700 programming languages},
1859− year = {1966},
1860− author = {P.J. Landin}
1861−}
1862−
1863−@techreport{luo-spec,
1864− month = {January},
1865− title = {Program Specification and Data Refinement in Type Theory},
1866− year = {1993},
1867− institution = {Department of Computer Science, University of Edinburgh},
1868− author = {Zhaohui Luo}
1869−}
1870−
1871−@phdthesis{luo90,
1872− school = {University of Edinburgh},
1873− title = {An Extended Calculus Of Constructions},
1874− year = {1990},
1875− author = {Zhaohui Luo}
1876−}
1877−
1878−@techreport{lego-manual,
1879− title = {\textsc{Lego} Proof Development System: User's Manual},
1880− year = {1992},
1881− institution = {Department of Computer Science, University of Edinburgh},
1882− author = {Zhaohui Luo and Robert Pollack}
1883−}
1884−
1885−@inproceedings{alf,
1886− title = {The {ALF} proof editor and its proof engine},
1887− year = {1994},
1888− booktitle = {Formal Proceeding of the 1993 Workshop on Types for Proofs and Programs},
1889− author = {Lena Magnusson and Bengt N\"{o}rdstrom}
1890−}
1891−
1892−@misc{happy,
1893− howpublished = {http://www.haskell.org/happy/},
1894− title = {Happy User Guide},
1895− year = {2001},
1896− author = {Simon Marlow and Andy Gill}
1897−}
1898−
1899−@inproceedings{generic-haskell,
1900− title = {Generic Haskell, Specifically},
1901− author = {Dave Clarke and Andres L\"{o}h},
1902− editor = {Jeremy Gibbons and Johan Jeuring},
1903− booktitle = {Proceedings of the IFIP TC2 Working Conference on Generic Programming},
1904− year = {2002},
1905− publisher = {Kluwer Academic Publishers},
1906− pages = {21--48}
1907−}
1908−
1909−@article{faking-it,
1910− title = {Faking It -- Simulating Dependent Types in {Haskell}},
1911− year = {2002},
1912− author = {Conor McBride},
1913− journal = {Journal of Functional Programming},
1914− volume = {12},
1915− number = {4+5},
1916− pages = {375--392}
1917−}
1918−
1919−@misc{mcbride-inverting,
1920− title = {Inverting Inductively Defined Relations in \textsc{Lego}},
1921− year = {1996},
1922− author = {Conor McBride}
1923−}
1924−
1925−@phdthesis{mcbride-thesis,
1926− month = {May},
1927− school = {University of Edinburgh},
1928− title = {Dependently Typed Functional Programs and their proofs},
1929− year = {2000},
1930− author = {Conor McBride}
1931−}
1932−
1933−@article{mcbride-unification,
1934− title = {First-Order Unification by Structural Recursion},
1935− year = {2003},
1936− author = {Conor McBride},
1937− journal = {Journal of Functional Programming},
1938− volume = {13},
1939− number = {6},
1940− pages = {1061--1075}
1941−}
1942−
1943−@misc{mckinna-pollack,
1944− howpublished = {Kluwer Academic Publishers},
1945− title = {Some Lambda Calculus and Type Theory formalized},
1946− year = {1998},
1947− author = {James McKinna and Robert Pollack}
1948−}
1949−
1950−@book{num-theory,
1951− title = {An Introduction to the Theory of Numbers},
1952− year = {1980},
1953− publisher = {John Wiley and Sons},
1954− author = {Ivan Niven and Herbert S. Zuckerman}
1955−}
1956−
1957−@book{prog-mltt,
1958− title = {Programming in Martin-L\"{o}f's Type Theory -- An Introduction},
1959− year = {1990},
1960− publisher = {Oxford University Press},
1961− author = {Bengt Nordstr\"{o}m and Kent Petersson and Jan M. Smith},
1962− note = {Out of print. Available from http://www.cs.chalmers.se/Cs/Research/Logic}
1963−}
1964−
1965−@book{okasaki,
1966− title = {Purely Functional Data Structures},
1967− year = {1998},
1968− publisher = {Cambridge University Press},
1969− author = {Chris Okasaki}
1970−}
1971−
1972−@book{arith-systems,
1973− title = {Computer Arithmetic Systems},
1974− year = {1994},
1975− publisher = {Prentice-Hall},
1976− author = {Amos R. Omondi}
1977−}
1978−
1979−@book{pj-imp,
1980− title = {The Implementation of Functional Programming Languages},
1981− year = {1987},
1982− publisher = {Prentice-Hall},
1983− author = {Simon {Peyton Jones}}
1984−}
1985−
1986−@book{cp-bjc,
1987− title = {Computational Numerical Methods},
1988− year = {1986},
1989− publisher = {John Wiley and Sons},
1990− author = {C. Phillips and B. Cornelius}
1991−}
1992−
1993−@book{nag,
1994− title = {The NAG Library: a beginner's guide},
1995− year = {1986},
1996− publisher = {Oxford : Clarendon Press},
1997− author = {Jen Phillips}
1998−}
1999−
2000−@misc{believe,
2001− month = {September},
2002− title = {How to Believe a Machine-Checked Proof},
2003− year = {1996},
2004− author = {Robert Pollack}
2005−}
2006−
2007−@phdthesis{pollack94,
2008− school = {University of Edinburgh},
2009− title = {The Theory of LEGO -- A Proof Checker for the Extended Calculus of Constructions},
2010− year = {1994},
2011− author = {Robert Pollack}
2012−}
2013−
2014−@inproceedings{intel-bug,
2015− series = {LNCS},
2016− volume = {915},
2017− title = {Anatomy of the Pentium Bug},
2018− publisher = {Springer-Verlag},
2019− year = {1995},
2020− pages = {97--107},
2021− author = {V.R. Pratt}
2022−}
2023−
2024−@book{maple,
2025− title = {The Maple Handbook: Maple V Release 4},
2026− year = {1996},
2027− publisher = {Springer},
2028− author = {Darren Redfern}
2029−}
2030−
2031−@book{crypto,
2032− title = {Applied Cryptography: protocols, algorithms and source code in C.},
2033− year = {1996},
2034− publisher = {Wiley},
2035− author = {Bruce Schneier}
2036−}
2037−
2038−@article{adts,
2039− journal = {Mathematical Structures in Computer Science},
2040− number = {2},
2041− volume = {10},
2042− title = {On lists and other abstract data types in the calculus of construction},
2043− year = {2000},
2044− pages = {261-276},
2045− author = {Jonathan P. Seldin}
2046−}
2047−
2048−@article{seldin97,
2049− journal = {Annals of Pure and Applied Logic},
2050− number = {1},
2051− month = {January},
2052− volume = {83},
2053− title = {On the proof theory of Coquand's calculus of constructions},
2054− year = {1997},
2055− pages = {23--101},
2056− author = {Jonathan P. Seldin}
2057−}
2058−
2059−@article{wichmann,
2060− journal = {The Computer Journal},
2061− volume = {32},
2062− title = {Towards a Formal Specification of Floating Point},
2063− year = {1989},
2064− pages = {432-436},
2065− author = {B.A. Wichmann}
2066−}
2067−
2068−@book{mathematica,
2069− title = {Mathematica : a system for doing mathematics by computer},
2070− year = {1991},
2071− publisher = {Addison Wesley},
2072− author = {Stephen Wolfram}
2073−}
2074−
2075−@inproceedings{xi-imp,
2076−author = "Hongwei Xi",
2077−title = {{Imperative Programming with Dependent Types}},
2078−booktitle = "Proceedings of 15th {IEEE} Symposium on Logic in Computer Science",
2079−year = 2000,
2080−month = "June",
2081−address = "Santa Barbara",
2082−pages = "375--387"
2083−}
2084−
2085−@phdthesis{xi-thesis,
2086− month = {December},
2087− school = {Department of Mathematical Sciences, Carnegie Mellon University},
2088− title = {Dependent Types in Practical Programming},
2089− year = {1998},
2090− author = {Hongwei Xi}
2091−}
2092−
2093−
2094−@techreport{dtal,
2095−author = {Hongwei Xi and Robert Harper},
2096−title = {A Dependently Typed Assembly Language},
2097−institution = {Computer Science and Engineering Department, Oregon Graduate Institute},
2098−year = 1999,
2099−number = {OGI-CSE-99-008},
2100−month = {July},
2101−}
2102−
2103−@misc{bignum-cmp,
2104− month = {February},
2105− title = {Comparison of three public-domain multiprecision libraries: BigNum, Gmp and Pari},
2106− year = {1998},
2107− author = {Paul Zimmerman}
2108−}
2109−
2110−@book{perl,
2111− title = {Programming Perl},
2112− author = {Larry Wall and Tom Christiansen and Jon Orwant},
2113− year = {2000},
2114− edition = {3rd},
2115− publisher = {O'Reilly}
2116−}
2117−
2118−@misc{python,
2119− howpublished = {http://www.python.org/doc/current/tut/tut.html},
2120− month = {April},
2121− title = {Python Tutorial},
2122− year = {2001},
2123− author = {Guido van {Rossum} and Fred L. {Drake, Jr}}
2124−}
2125−
2126−@book{logic,
2127− title = {The Language of First Order Logic},
2128− year = {1992},
2129− publisher = {CSLI Lecture Notes},
2130− author = {Jon Barwise and John Etchemendy}
2131−}
2132−
2133−@book{haskell,
2134− title = {Haskell -- The Craft of Functional Programming},
2135− year = {1999},
2136− publisher = {Addison Wesley},
2137− author = {Simon Thompson}
2138−}
2139−
2140−@inproceedings{coq-hol,
2141− title = {A Comparative Study of Coq and HOL},
2142− year = {1997},
2143− booktitle = {Theorem Proving in Higher Order Logics},
2144− pages = {323-337},
2145− author = {Vincent Zammit}
2146−}
2147−
2148−@misc{gay90,
2149− month = {November},
2150− title = {Correctly Rounded Binary-Decimal and Decimal-Binary Conversions},
2151− year = {1990},
2152− author = {David M. Gay},
2153− note = {AT&T Bell Laboratories, Numerical Analysis Manuscript 90-10}
2154−}
2155−
2156−@article{hughes-matters,
2157− journal = {Computer Journal},
2158− number = {2},
2159− volume = {32},
2160− title = {Why Functional Programming Matters},
2161− year = {1989},
2162− pages = {98--107},
2163− author = {J. Hughes}
2164−}
2165−
2166−@inproceedings{proofpointing,
2167− title = {Proof by Pointing},
2168− year = {1994},
2169− booktitle = {Proceedings of the International Symposium on Theoretical Aspects of Computer So},
2170− pages = {141--160},
2171− editor = {M. Hagiya and J. C. Mitchell},
2172− publisher = {Springer-Verlag},
2173− series = {LNCS},
2174− volume = {789},
2175− address = {Sendai, Japan},
2176− author = {Yves Bertot and Gilles Kahn and Laurent Th{\'e}ry}
2177−}
2178−
2179−@misc{inductive-coq,
2180− month = {December},
2181− title = {Inductive Definitions in the System Coq -- Rules and Properties},
2182− year = {1992},
2183− author = {Christine Paulin-Mohring}
2184−}
2185−
2186−@misc{leiserson98,
2187− month = {July},
2188− title = {Using de Bruijn Sequences to Index a 1 in a Computer Word},
2189− year = {1998},
2190− author = {{Charles E. Leiserson} and {Harald Prokop} and {Keith H. Randall}}
2191−}
2192−
2193−@inproceedings{proofchecking,
2194− title = {A two-level approach towards lean proof-checking},
2195− year = {1996},
2196− booktitle = {TYPES},
2197− pages = {16--35},
2198− author = {G. Barthe and M.P.J. Ruys and H.P. Barendregt}
2199−}
2200−
2201−@inproceedings{congruence,
2202− title = {Congruence Types},
2203− year = {1995},
2204− booktitle = {CSL},
2205− pages = {36--51},
2206− author = {Gilles Barthe and Herman Geuvers}
2207−}
2208−
2209−@phdthesis{geuvers-thesis,
2210− title = {Logic and Type Systems},
2211− author = {Herman Geuvers},
2212− year = 1993,
2213− school = {Katholieke Universiteit Nijmegen}
2214−}
2215−
2216−@techreport{multiple-values,
2217− title = {Multiple Values in {Standard ML}},
2218− year = {1994},
2219− number = {94-312},
2220− institution = {LFCS, Dept of Computer Science, University of Edinburgh},
2221− author = {Kevin Mitchell}
2222−}
2223−
2224−@inproceedings{oracle-checking,
2225− month = {January},
2226− title = {Oracle-Based Checking of Untrusted Software},
2227− year = {2001},
2228− booktitle = {Proceedings of the 28th {ACM} Symposium on Principles of Programming Languages},
2229− pages = {142--154},
2230− author = {{George C. Necula} and {S.P. Rahul}}
2231−}
2232−
2233−@article{adams93jfp,
2234− journal = {Journal of Functional Programming},
2235− number = {4},
2236− volume = {3},
2237− title = {Efficient Sets -- A Balancing Act},
2238− year = {1993},
2239− pages = {553--561},
2240− author = {Stephen Adams}
2241−}
2242−
2243−@inproceedings{hughes-sized,
2244− title = {Proving the Correctness of Reactive Systems Using Sized Types},
2245− year = {1996},
2246− booktitle = {Proceedings of the 23rd {ACM} {SIGPLAN}-SIGACT symposium on Principles of programmin},
2247− pages = {410--423},
2248− author = {John Hughes and Lars Pareto and Amr Sabry}
2249−}
2250−
2251−@inproceedings{whittle99ml,
2252− title = {An {ML} Editor Based on Proofs-As-Programs},
2253− year = {1999},
2254− booktitle = {Automated Software Engineering},
2255− pages = {166--173},
2256− author = {Jon Whittle and Alan Bundy and Richard J. Boulton and Helen Lowe}
2257−}
2258−
2259−@book{efp-typeinf,
2260− title = {Elements of Functional Programming},
2261− year = {1989},
2262− publisher = {Addison-Wesley},
2263− author = {Chris Reade},
2264− series = {International Computer Science Series}
2265−}
2266−
2267−@incollection{ wadler-views,
2268− author = "Philip Wadler",
2269− title = "Views: {A} Way for Pattern Matching to Cohabit with Data Abstraction",
2270− booktitle = "Proceedings, 14th Symposium on Principles of Programming Languages",
2271− publisher = "Association for Computing Machinery",
2272− editor = "Steve Munchnik",
2273− pages = "307--312",
2274− year = "1987",
2275− url = "citeseer.nj.nec.com/wadler87views.html" }
2276−
2277−@article{ coquand-checking,
2278− author = "Thierry Coquand",
2279− title = "An Algorithm for Type-Checking Dependent Types",
2280− journal = "Science of Computer Programming",
2281− volume = "26",
2282− number = "1-3",
2283− pages = "167-177",
2284− year = "1996",
2285− url = "citeseer.nj.nec.com/coquand96algorithm.html" }
2286−
2287−@misc{coquand-pm,
2288− author = "Thierry Coquand",
2289− title = "Pattern Matching with Dependent Types",
2290− year = "1992",
2291− howpublished = "Available from \verb+http://www.cs.chalmers.se/~coquand/type.html+"
2292−}
2293−
2294−@misc{pollack-records,
2295− month = {August},
2296− title = {Dependently Typed Records for Representing Mathematical Structure},
2297− year = {2000},
2298− author = {Robert Pollack}
2299−}
2300−
2301−@article{checking-betarte,
2302− journal = {Journal of Functional Programming},
2303− number = {2},
2304− month = {March},
2305− volume = {10},
2306− title = {Type checking dependent (record) types and subtyping},
2307− year = {2000},
2308− pages = {137--166},
2309− author = {Gustavo Betarte}
2310−}
2311−
2312−
2313−@article{ gcode,
2314− author = "Thomas Johnsson",
2315− title = "Efficient Compilation of Lazy Evaluation",
2316− booktitle = "Proceedings of the {{ACM}} {{SIGPLAN}}'84 Symposium on Compiler Con struction",
2317− journal = "{SIGPLAN} Notices",
2318− volume = "19",
2319− number = "6",
2320− month = "June",
2321− publisher = "{ACM} Press",
2322− pages = "58--69",
2323− year = "1984",
2324− url = "citeseer.nj.nec.com/johnsson84efficient.html" }
2325−
2326−@misc{kamareddine01,
2327− month = {February},
2328− title = {Reviewing the classical and the de Bruijn notation for $\lambda$-calculus and pure type systems},
2329− year = {2001},
2330− author = {Fairouz Kamareddine}
2331−}
2332−
2333−@book{prooftheory,
2334− title = {Basic Proof Theory},
2335− year = {1996},
2336− publisher = {Cambridge University Press},
2337− author = {A.S. Troelstra and H. Schwichtenberg},
2338− series = {Cambridge Tracts in Theoretical Computer Science}
2339−}
2340−
2341−@misc{nbe_staged,
2342− title = {Integrating Normalization-by-Evaluation into a Staged Programming Language},
2343− year = {1998},
2344− author = {Tim Sheard}
2345−}
2346−
2347−@inproceedings{nbe2,
2348− title = {Normalization by evaluation},
2349− year = {1998},
2350− author = {Ulrich Berger and Matthias Eberl and Helmut Schwichtenberg},
2351− booktitle = {Prospects for Hardware Foundations 1998},
2352− pages = {117--137},
2353− series = {LNCS}
2354−}
2355−
2356−
2357−
2358−@misc{rtcg_jfp,
2359− title = {Compiling for Run-time Code Generation},
2360− year = {2000},
2361− author = {Frederick Smith and Dan Grossman and Greg Morrisett and Luke Hornof and Trevor J},
2362− note = {Under consideration for J. Functional Programming}
2363−}
2364−
2365−@phdthesis{fredsmith_thesis,
2366− month = {January},
2367− school = {Cornell University},
2368− title = {Certified Run-time Code Generation},
2369− year = {2002},
2370− author = {Frederick Smith}
2371−}
2372−
2373−@inproceedings{xi_arraybounds,
2374−author = "Hongwei Xi and Frank Pfenning",
2375−title = {Eliminating Array Bound Checking through Dependent Types},
2376−booktitle = "Proceedings of {ACM} {SIGPLAN} Conference on Programming Language Design and Implementation",
2377−year = 1998,
2378−month = "June",
2379−address = "Montreal",
2380−pages = "249--257",
2381−}
2382−
2383−@inproceedings{xi_deadcode,
2384−author = "Hongwei Xi",
2385−title = {Dead Code Elimination through Dependent Types},
2386−booktitle = "The First International Workshop on Practical Aspects of Declarative Languages",
2387−year = 1999,
2388−month = "January",
2389−address = "San Antonio",
2390−pages = "228--242"
2391−}
2392−
2393−@book{compilers,
2394− title = {Compilers --- Principles, Techniques and Tools},
2395− year = {1986},
2396− publisher = {Addison-Wesley},
2397− author = {Alfred Aho and Ravi Sethi and Jeffrey Ullman}
2398−}
2399−
2400−@inproceedings{nhc,
2401− title = {Highlights from nhc: A space efficient {Haskell} Compiler},
2402− year = {1995},
2403− author = "Niklas R{\"o}jemo",
2404− booktitle = "Functional Programming Languages and Computer Architecture",
2405− pages = "282--292"
2406−}
2407−
2408−
2409−@misc{mlmatch,
2410− title = {SML/NJ Match Compiler Notes},
2411− year = {1992},
2412− author = {William Aitken}
2413−}
2414−
2415−@misc{mlmatch_sestoft,
2416− title = {ML pattern match compilation and partial evaluation},
2417− year = {1992},
2418− author = {Peter Sestoft}
2419−}
2420−
2421−@inproceedings{compiledstrongreduction,
2422− title = {A Compiled Implementation of Strong Reduction},
2423− year = {2002},
2424− author = {Benjamin Gr\'{e}goire and Xavier Leroy},
2425− booktitle = {Proc. 2002 International Conf. on Functional Programming ({ICFP} 2002)},
2426− pages = {235--246}
2427−}
2428−
2429−@misc{tclhaskell,
2430− howpublished = {http://www.dcs.gla.ac.uk/~meurig/TclHaskell/usermanual.html},
2431− month = {August},
2432− title = {TclHaskell - User Manual},
2433− year = {1999},
2434− author = {Meurig Sage}
2435−}
2436−
2437−
2438−@InProceedings{nbe-cat,
2439− author = "Thorsten Altenkirch and Martin Hofmann and Thomas Streicher",
2440− title = "Categorical reconstruction of a reduction free
2441− normalization proof",
2442− year = "1995",
2443− booktitle = "Category Theory and Computer Science",
2444− editor = {David Pitt and David E. Rydeheard and Peter Johnstone},
2445− series = {LNCS},
2446− volume = {953},
2447− pages = {182-199}
2448−}
2449−
2450−@inproceedings{presburgerEFSM,
2451− title = {A Comparison of Presburger Engines for EFSM Reachability},
2452− year = {1998},
2453− booktitle = {Computer Aided Verification '98},
2454− pages = {280--292},
2455− author = {Thomas R. Shiple and James H. Kukula and Rajeev K. Ranjan}
2456−}
2457−
2458−@misc{typesafecast,
2459− title = {Type-Safe Cast},
2460− year = {2000},
2461− author = {Stephanie Weirich}
2462−}
2463−
2464−@phdthesis{grobauer-thesis,
2465− school = {University of Aarhus},
2466− title = {Topics in Semantics Based Program Manipulation},
2467− year = {2001},
2468− author = {Bernd Grobauer}
2469−}
2470−
2471−@misc{monads-moggi,
2472− title = {Computational Lambda Calculus and Monads},
2473− year = {1989},
2474− author = {Eugenio Moggi}
2475−}
2476−
2477−@article{gmp-proof,
2478− title = {A proof of {GMP} square root},
2479− year = {2002},
2480− journal = {Journal of Automated Reasoning},
2481− volume = {29},
2482− pages = {225--252},
2483− author = {Yves Bertot and Nicolas Magaud and Paul Zimmerman}
2484−}
2485−
2486−@article{F-tal,
2487− journal = {{ACM} Transactions on Programming Languages and Systems},
2488− number = {3},
2489− month = {May},
2490− volume = {21},
2491− title = {From {System F} to Typed Assembly Language},
2492− year = {1999},
2493− pages = {528--569},
2494− author = {Greg Morrisett and David Walker and Karl Crary and Neal Glew}
2495−}
2496−
2497−@techreport{nbe-rtcg,
2498− month = {December},
2499− title = {Strong Normalization by Type-Directed Partial Evaluation and Run-Time Code Generation},
2500− year = {1997},
2501− institution = {BRICS},
2502− author = {Vincent Balat and Oliver Danvy}
2503−}
2504−
2505−@misc{yong-schemata,
2506− howpublished = {http://www.dur.ac.uk/yong.luo/},
2507− title = {A Methodology for Implementing Inductive Schemata},
2508− year = {2002},
2509− author = {Yong Luo and Zhaohui Luo}
2510−}
2511−
2512−@inproceedings{harper93,
2513− title = {Explicit Polymorphism and CPS Conversion},
2514− year = {1993},
2515− booktitle = {20th {ACM} {SIGPLAN}-SIGACT Symposium on Principles of Programming Languages},
2516− pages = {206--219},
2517− publisher = {{ACM} Press, New York, NY, USA},
2518− author = {Robert Harper and Mark Lillibridge}
2519−}
2520−
2521−@techreport{backends,
2522− month = {November},
2523− title = {Functional Back-Ends within the Lambda-Sigma Calculus},
2524− year = {1996},
2525− institution = {INRIA},
2526− author = {Th\'{e}r\`{e}se Hardin and Luc Maranget and Bruno Pagano}
2527−}
2528−
2529−@article{stg,
2530− title = {Implementing lazy functional languages on stock hardware -- the {Spineless Tagless G-machine}},
2531− year = {1992},
2532− journal = {Journal of Functional Programming},
2533− volume = {2},
2534− number = {2},
2535− pages = {127--202},
2536− month = {April},
2537− author = {Simon {Peyton Jones}}
2538−}
2539−
2540−@article{debruijn,
2541− journal = {Indagationes Mathematicae},
2542− volume = {34},
2543− title = {Lambda calculus notation with nameless dummies},
2544− year = {1972},
2545− pages = {381--392},
2546− author = {N.G. de Bruijn}
2547−}
2548−
2549−@book{assembly,
2550− month = {January},
2551− title = {PC Assembly Language},
2552− year = {2002},
2553− publisher = {http://www.drpaulcarter.com/},
2554− author = {Paul A. Carter}
2555−}
2556−
2557−@inproceedings{poly99,
2558− title = {Once Upon A Polymorphic Type},
2559− year = {1999},
2560− booktitle = {26th {ACM} {SIGPLAN}-SIGACT Symposium on Principles of Programming Languages},
2561− publisher = {{ACM}},
2562− author = {Keith Wansbrough and Simon {Peyton Jones}}
2563−}
2564−
2565−@misc{lazy_intro,
2566− title = {Compiling Lazy Functional Languages: An introduction},
2567− year = {1986},
2568− author = {Thomas Johnsson}
2569−}
2570−
2571−@inproceedings{unboxed-fp,
2572− month = {Sept},
2573− title = {Unboxed Values as First Class Citizens in a Non-Strict Functional Language},
2574− year = {1991},
2575− author = {Simon {Peyton Jones} and John Launchbury},
2576− booktitle = {Functional Programming Languages and Computer Architecture (FPCA'91)},
2577− crossref = {fplca91},
2578− pages = {636--666}
2579−}
2580−
2581−@inproceedings{abc-machine,
2582− author = {Sjaak Smetsers and Eric N{\"{o}}cker and John {van Groningen} and Rinus Plasmeijer},
2583− title = {Generating efficient code for lazy functional languages},
2584− booktitle = {Functional programming Languages and Computer Architecture},
2585− year = {1991},
2586− pages = {592--617},
2587− crossref = {fplca91}
2588−}
2589−
2590−@proceedings{fplca91,
2591− title = {Functional programming Languages and Computer Architecture},
2592− year = {1991},
2593− volume = {523},
2594− series = {LNCS},
2595− publisher = {Springer-Verlag},
2596− editor = {John Hughes}
2597−}
2598−
2599−
2600−
2601−@inproceedings{nbe,
2602− title = {An inverse of the evaluation functional for typed $\lambda$-calculus},
2603− year = {1991},
2604− booktitle = {Proc. 1991 {IEEE} Symp. on Logic in Comp. Sci.},
2605− pages = {203--211},
2606− editor = {R. Vemuri},
2607− author = {Ulrich Berger and Helmut Schwichtenberg}
2608−}
2609−
2610−@inproceedings{typed-closure,
2611− title = {Typed Closure Conversion},
2612− year = {1996},
2613− booktitle = {Symposium on Principles of Programming Languages},
2614− pages = {271--283},
2615− author = {Yasuhiko Minamide and J. Gregory Morrisett and Robert Harper}
2616−}
2617−
2618−@misc{ghc-commentary,
2619− howpublished = {http://www.cse.unsw.edu.au/~chak/haskell/ghc/comm/},
2620− title = {The Glasgow Haskell Compiler (GHC) Commentary},
2621− year = {2002},
2622− author = {Manuel M. T. Chakravarty and Sigbjorn Finne and Simon Marlow and Simon {Peyton Jones} and Julian Seward and Reuben Thomas},
2623− note = {Available from GHC CVS repository}
2624−}
2625−
2626−@inproceedings{lambdalift,
2627− month = {September},
2628− title = {Lambda Lifting: Transforming Programs to Recursive Equations},
2629− year = {1985},
2630− booktitle = {Functional Programming Languages and Computer Architecture},
2631− pages = {190--203},
2632− editor = {Jean-Pierre Jouannaud},
2633− publisher = {Springer-Verlag},
2634− author = {Thomas Johnsson}
2635−}
2636−
2637−@inproceedings{til,
2638− title = {TIL: A Type-Directed Optimizing Compiler for ML},
2639− year = {1996},
2640− booktitle = {Proc. {{ACM}} {{SIGPLAN}} '96 Conference on Programming Language Design and Implementation},
2641− pages = {181--192},
2642− author = {D. Tarditi and G. Morrisett and P. Cheng and C. Stone and R. Harper and P. Lee}
2643−}
2644−
2645−@phdthesis{shao94,
2646− school = {Princeton University},
2647− title = {Compiling Standard {ML} for Efficient Execution on Modern Machines},
2648− year = {1994},
2649− author = {Zhong Shao}
2650−}
2651−
2652−@inproceedings{gmachine,
2653− month = {September},
2654− title = {The {G-Machine}: A fast, graph-reduction evaluator},
2655− year = {1985},
2656− booktitle = {Functional Programming Languages and Computer Architecture},
2657− pages = {400--413},
2658− editor = {Jean-Pierre Jouannaud},
2659− publisher = {Springer-Verlag},
2660− author = {R.B. Kieburtz}
2661−}
2662−
2663−@inproceedings{strictness,
2664− month = {September},
2665− title = {Strictness Analysis - A practical approach},
2666− year = {1985},
2667− booktitle = {Functional Programming Languages and Computer Hardware},
2668− pages = {35--49},
2669− editor = {Jean-Pierre Jouannaud},
2670− publisher = {Springer-Verlag},
2671− author = {Chris Clack and Simon {Peyton Jones}}
2672−}
2673−
2674−@book{fl-impl,
2675− title = {Implementing Functional Languages - A Tutorial},
2676− year = {1992},
2677− publisher = {Prentice Hall International},
2678− author = {Simon {Peyton Jones} and David Lester}
2679−}
2680−
2681−@phdthesis{capretta-thesis,
2682− school = {Katholieke Universiteit Nijmegen},
2683− title = {Abstraction and Computation},
2684− year = {2002},
2685− author = {Venanzio Capretta}
2686−}
2687−
2688−@article{bird-pointer,
2689− journal = {Journal of Functional Programming},
2690− number = {3},
2691− month = {May},
2692− volume = {11},
2693− title = {Unfolding Pointer Algorithms},
2694− year = {2001},
2695− pages = {347--358},
2696− author = {Richard S. Bird}
2697−}
2698−
2699−@article{impl-tp,
2700− journal = {Journal of Functional Programming},
2701− number = {2},
2702− month = {March},
2703− volume = {9},
2704− title = {Implementing Theorem Provers in a Purely Functional Style},
2705− year = {1999},
2706− pages = {147--166},
2707− author = {Keith Hanna}
2708−}
2709−
2710−@article{shrink-lambda,
2711− journal = {Journal of Functional Programming},
2712− number = {5},
2713− month = {September},
2714− volume = {7},
2715− title = {Shrinking Lambda Expressions in Linear Time},
2716− year = {1997},
2717− pages = {515--540},
2718− author = {Andrew W. Appel and Trevor Jim}
2719−}
2720−
2721−@article{stack-tal,
2722− journal = {Journal of Functional Programming},
2723− number = {1},
2724− month = {January},
2725− volume = {12},
2726− title = {Stack-based Typed Assembly Language},
2727− year = {2002},
2728− pages = {43--88},
2729− author = {Greg Morrisset and Karl Crart and Neal Glew and David Walker}
2730−}
2731−
2732−@article{runtime-lamsig,
2733− journal = {Journal of Functional Programming},
2734− number = {2},
2735− month = {March},
2736− volume = {8},
2737− title = {Functional Runtime Systems within the lambda-sigma Calculus},
2738− year = {1998},
2739− pages = {131--176},
2740− author = {Th\'{e}r\`{e}se Hardin and Luc Maranget and Bruno Pagano}
2741−}
2742−
2743−@article{busylazy,
2744− journal = {Journal of Functional Programming},
2745− number = {6},
2746− month = {November},
2747− volume = {11},
2748− title = {How to look busy while being as lazy as ever: the Implementation of a lazy functional debugger},
2749− year = {2001},
2750− pages = {629--671},
2751− author = {Henrik Nilsson}
2752−}
2753−
2754−@article{lazyveager,
2755− journal = {Journal of Functional Programming},
2756− number = {5},
2757− month = {September},
2758− volume = {7},
2759− title = {More haste, less speed: lazy versus eager evaluation},
2760− year = {1997},
2761− pages = {541--547},
2762− author = {Richard Bird and Geraint Jones and Oege {de Moor}}
2763−}
2764−
2765−@article{jvm-fp,
2766− journal = {Journal of Functional Programming},
2767− number = {6},
2768− month = {November},
2769− volume = {9},
2770− title = {Compiling lazy functional programs for the Java Virtual Machine},
2771− year = {1999},
2772− pages = {579--603},
2773− author = {David Wakeling}
2774−}
2775−
2776−@book{isabelle,
2777− publisher = {Springer-Verlag},
2778− series = {LNCS},
2779− volume = {2283},
2780− month = {March},
2781− title = {Isabelle/HOL - A proof assistant for higher order logic},
2782− year = {2002},
2783− author = {Tobias Nipkow and Lawrence C. Paulson and Markus Wenzel}
2784−}
2785−
2786−@article{ghc-inliner,
2787− journal = {Journal of Functional Programming},
2788− number = {4},
2789− month = {September},
2790− volume = {12},
2791− title = {Secrets of the {Glasgow Haskell Compiler} inliner},
2792− year = {2002},
2793− pages = {393--434},
2794− author = {Simon {Peyton Jones} and Simon Marlow}
2795−}
2796−
2797−@article{dynamic-fp,
2798− journal = {Journal of Functional Programming},
2799− number = {1},
2800− month = {January},
2801− volume = {8},
2802− title = {The dynamic compiliation of lazy functional programs},
2803− year = {1998},
2804− pages = {61--81},
2805− author = {David Wakeling}
2806−}
2807−
2808−@misc{isabelle-ref,
2809− month = {March},
2810− title = {Isabelle Reference Manual},
2811− year = {2002},
2812− author = {Lawrence C. Paulson}
2813−}
2814−
2815−@article{debruijn-nested,
2816− journal = {Journal of Functional Programming},
2817− number = {1},
2818− month = {January},
2819− volume = {9},
2820− title = {de Bruijn notation as a nested datatype},
2821− year = {1999},
2822− pages = {77--91},
2823− author = {Richard S. Bird and Ross Paterson}
2824−}
2825−
2826−@article{perfect-trees,
2827− journal = {Journal of Functional Programming},
2828− number = {3},
2829− month = {May},
2830− volume = {10},
2831− title = {Perfect trees and bit-reversal permutations},
2832− year = {2000},
2833− pages = {305--317},
2834− author = {Ralf Hinze}
2835−}
2836−
2837−@phdthesis{paulin-extraction,
2838− school = {Paris 7},
2839− title = {Extraction de programmes dans le Calcul des Constructions},
2840− year = {1989},
2841− author = {Christine Paulin-Mohring}
2842−}
2843−
2844−@phdthesis{santos95,
2845− school = {University of Glasgow},
2846− title = {Compilation By Transformation In Non-Strict Functional Languages},
2847− year = {1995},
2848− author = {{Andr\'{e} Lu\'{i}s de Medeiros} Santos}
2849−}
2850−
2851−@book{cps,
2852− title = {Compiling With Continuations},
2853− year = {1992},
2854− publisher = {Cambridge University Press},
2855− author = {Andrew W. Appel}
2856−}
2857−
2858−@techreport{SKIM,
2859− number = {31},
2860− title = {The {SKIM} microprogrammer's guide},
2861− year = {1983},
2862− institution = {University of Cambridge},
2863− author = {W.R. Stoye}
2864−}
2865−
2866−@misc{NORMA,
2867− title = {An Overview of Burroughs {NORMA}},
2868− year = {1985},
2869− author = {H. Richards}
2870−}
2871−
2872−@book{ml,
2873− title = {The Definition of Standard ML --- Revised},
2874− year = {1997},
2875− publisher = {MIT Press},
2876− author = {Robin Milner and Mads Tofte and Robert Harper and David MacQueen}
2877−}
2878−
2879−@misc{ml71,
2880− title = {An intuitionistic theory of types},
2881− year = {1971},
2882− author = {Per Martin-L\"{o}f}
2883−}
2884−
2885−@phdthesis{girard-thesis,
2886− school = {Universit\'{e} Paris VII},
2887− title = {Interpr\'{e}tation fonctionelle et \'{e}limination des coupures de l'arithm\'{e}tique d'ordre sup\'{e}rieur},
2888− year = {1972},
2889− author = {Jean-Yves Girard}
2890−}
2891−
2892−@inproceedings{ml75,
2893− title = {An intuitionistic theory of types: predicative part},
2894− year = {1975},
2895− booktitle = {Logic Colloquium '73},
2896− editor = {H. Rose and J.C. Shepherdson},
2897− publisher = {North-Holland},
2898− author = {Per Martin-L\"{o}f}
2899−}
2900−
2901−@inproceedings{cpm90,
2902− title = {Inductively defined types},
2903− year = {1990},
2904− author = {Thierry Coquand and Christine Paulin-Mohring},
2905− series = {LNCS},
2906− volume = {417},
2907− publusher = {Springer-Verlag}
2908−}
2909−
2910−@phdthesis{fpcustom,
2911− month = {May},
2912− school = {Computer Lab, University of Cambridge},
2913− title = {The Implementation of Functional Languages using Custom Hardware},
2914− year = {1985},
2915− author = {W.R. Stoye}
2916−}
2917−
2918−@phdthesis{hughesthesis,
2919− month = {September},
2920− school = {Programming Research Group, Oxford},
2921− title = {The design and implementation of programming languages},
2922− year = {1984},
2923− author = {John Hughes}
2924−}
2925−
2926−@inproceedings{tim,
2927− volume = {274},
2928− title = {{TIM} -- A simple lazy abstract machine to execute supercombinators},
2929− year = {1987},
2930− booktitle = {Functional Programming Languages and Computer Architecture},
2931− publisher = {Springer-Verlag},
2932− author = {John Fairbairn and Stuart Wray},
2933− pages = {34--45},
2934− series = {LNCS}
2935−}
2936−
2937−@techreport{abc,
2938− title = {The {ABC} machine -- A Sequential Stack-based Abstract Machine For Graph Rewriting},
2939− year = {1990},
2940− institution = {University of Nijmegen},
2941− author = {P.W.M. Koopman and M.C.J.D. van {Eekelen} and E.G.J.M.H. Ncker and J.E.W. Smetsers and M.J. Plasmeijer}
2942−}
2943−
2944−@techreport{implicit,
2945− title = {On Implicit Arguments},
2946− year = {1994},
2947− institution = {Faculty of Science, University of Tokyo},
2948− author = {Masami Hagiya and Yozo Toda}
2949−}
2950−
2951−@book{semantics,
2952− title = {Denotational Semantics},
2953− year = {1986},
2954− publisher = {Wm. C. Brown},
2955− author = {David A. Schmidt}
2956−}
2957−
2958−@inproceedings{lazyml,
2959− month = {August},
2960− title = {A compiler for {Lazy} {ML}},
2961− year = {1984},
2962− booktitle = {Proceedings of the {{ACM}} Symposium on Lisp and Functional Programming},
2963− pages = {218--227},
2964− author = {Lennart Augustsson}
2965−}
2966−
2967−@inproceedings{nu-g,
2968− title = {Parallel graph reduction with the $\langle\nu,G\rangle$-machine},
2969− year = {1989},
2970− booktitle = {Functional Programming Languages and Computer Architecture},
2971− publisher = {{ACM} Press},
2972− author = {Lennart Augustsson and Thomas Johnsson}
2973−}
2974−
2975−@book{k&r,
2976− title = {The C programming language},
2977− year = {1988},
2978− publisher = {Prentice-Hall},
2979− author = {Brian W. Kernighan and Dennis M. Ritchie}
2980−}
2981−
2982−@misc{c--garbage,
2983− title = {C--: a portable assembly language that supports garbage collection},
2984− year = {1999},
2985− author = {Simon {Peyton Jones} and Norman Ramsey and Fermin Reig},
2986− note = {Invited talk at PPDP'99}
2987−}
2988−
2989−@misc{epigram,
2990− howpublished = {http://www.dur.ac.uk/CARG/epigram.html},
2991− title = {Project Proposal: {Epigram}: Innovative Programming via Inductive Families},
2992− year = {2002},
2993− author = {Zhaohui Luo and James McKinna and Paul Callaghan and Conor McBride}
2994−}
2995−
2996−@misc{ghc-rewrite,
2997− title = {Playing by the Rules: Rewriting as a practical optimisation technique in {GHC}},
2998− year = {2001},
2999− author = {Simon {Peyton Jones} and Andrew Tolmach and Tony Hoare}
3000−}
3001−
3002−@UNPUBLISHED{implicit-pollack,
3003− AUTHOR = {Robert Pollack},
3004− TITLE = {Implicit Syntax},
3005− NOTE = {Informal Proceedings of First Workshop on
3006− Logical Frameworks, Antibes},
3007− YEAR = {1990},
3008− MONTH = MAY
3009−}
3010−
3011−
3012−@article{transform-haskell,
3013− journal = {Science of Computer Programming},
3014− volume = {32},
3015− title = {A transformation-based optimiser for {Haskell}},
3016− year = {1998},
3017− pages = {3--47},
3018− author = {Simon {Peyton Jones} and Andr\'{e} L. M. Santos}
3019−}
3020−
3021−@inproceedings{knuth-bendix,
3022− title = {Simple Word Problems in Universal Algebras},
3023− year = {1970},
3024− booktitle = {Computational Problems in Abstract Algebra},
3025− pages = {263--298},
3026− editor = {John Leech},
3027− publisher = {Pergamon Press},
3028− author = {Donald E. Knuth and Peter B. Bendix}
3029−}
3030−
3031−@inproceedings{phantomfun,
3032− title = {Fun With Phantom Types},
3033− author = {Ralf Hinze},
3034− pages = {245--262},
3035− year = {2003},
3036− crossref = {funprogramming},
3037− booktitle = {The Fun Of Programming},
3038− publisher = {Palgrave}
3039−}
3040−
3041−@book{funprogramming,
3042− month = {March},
3043− title = {The Fun Of Programming},
3044− year = {2003},
3045− editor = {Jeremy Gibbons and Oege {de Moor}},
3046− publisher = {Palgrave},
3047− series = {Cornerstones of Computing}
3048−}
3049−
3050−@inproceedings{anderson-proof,
3051− title = {Representing Proof Transformations For Program Optimization},
3052− year = {1994},
3053− booktitle = {International Conference On Automated Deduction},
3054− publisher = {Springer Verlag},
3055− author = {Penny Anderson}
3056−}
3057−
3058−@phdthesis{daria-thesis,
3059− month = {April},
3060− school = {Institute of Informatics, Warsaw University},
3061− title = {Termination of Rewriting in the Calculus of Constructions},
3062− year = {2003},
3063− author = {Daria Walukiewicz-Chrzaszcz}
3064−}
3065−
3066−@inproceedings{change-data,
3067− title = {Changing Data Structures In Type Theory: A Study Of Natural Numbers},
3068− year = {2001},
3069− booktitle = {Types For Proofs And Programs 2000},
3070− pages = {181--196},
3071− editor = {Paul Callaghan and Zhaohui Luo and James McKinna and Robert Pollack},
3072− publisher = {Springer},
3073− author = {Nicolas Magaud and Yves Bertot}
3074−}
3075−
3076−@phdthesis{nico-thesis,
3077− title = {Changement de Representation des donn\'{e}es dans le Calcul de Constructions},
3078− author = {Nicolas Magaud},
3079− year = {2003},
3080− month = {October},
3081− school = {Universit\'{e} de Nice - Sophia Antipolis}
3082−}
3083−
3084−
3085−@book{patterns,
3086− title = {Design Patterns},
3087− year = {1995},
3088− publisher = {Addison Wesley},
3089− author = {Erich Gamma and Richard Helm and Ralph Johnson and John Vlissides}
3090−}
3091−
3092−@misc{ghchugs,
3093− month = {August},
3094− title = {The New {GHC}/{Hugs} Runtime System},
3095− year = {1998},
3096− author = {Simon Marlow and Simon {Peyton Jones}}
3097−}
3098−
3099−@misc{stgrevised,
3100− month = {February},
3101− title = {The {STG} runtime system (revised)},
3102− year = {1999},
3103− author = {Simon {Peyton Jones} and Simon Marlow and Alastair Reid},
3104− howpublished = {Available from \verb+http://www.haskell.org/ghc/documentation.html+}
3105−}
3106−
3107−@inproceedings{optimistic,
3108− month = {March},
3109− title = {Optimistic Evaluation --- an adaptive evaluation strategy for non-strict programs},
3110− year = {2003},
3111− author = {Robert Ennals and Simon {Peyton Jones}},
3112− booktitle = {International Conference on Functional Programming},
3113− pages = {287--298}
3114−}
3115−
3116−@phdthesis{ennals-thesis,
3117− title = {Adaptive Evaluation of Non-Strict Programs},
3118− author = {Robert Ennals},
3119− year = {2003},
3120− month = {December},
3121− school = {King's College, University of Cambridge}
3122−}
3123−
3124−@article{garbage,
3125− journal = {{ACM} Computing Surveys},
3126− number = {3},
3127− volume = {13},
3128− title = {Garbage Collection of Linked Data Structures},
3129− year = {1981},
3130− pages = {341--367},
3131− author = {Jacques Cohen}
3132−}
3133−
3134−@article{baker-gc,
3135− journal = {Communications of the {ACM}},
3136− number = {4},
3137− month = {April},
3138− volume = {21},
3139− title = {List Processing In Real Time On A Serial Computer},
3140− year = {1978},
3141− pages = {280--294},
3142− author = {Henry G. {Baker Jr}}
3143−}
3144−
3145−@misc{bc-rec,
3146− month = {February},
3147− title = {Modelling General Recursion in Type Theory},
3148− year = {2003},
3149− note = {Under consideration for publication in Math. Struct. in Comp. Science. Draft, DCS, CTH --- INRIA, Sophia Antipolis, France},
3150− author = {Ana Bove and Venanzio Capretta}
3151−}
3152−
3153−@misc{global-tag,
3154− title = {Global Tagging Optimization by Type Inference},
3155− year = {1992},
3156− author = {Fritz Henglein}
3157−}
3158−
3159−@book{esr,
3160− month = {October},
3161− title = {The Cathedral And The Bazaar},
3162− year = {1999},
3163− publisher = {O'Reilly},
3164− author = {Eric Raymond}
3165−}
3166−
3167−@book{manmonth,
3168− title = {The Mythical Man-month: Essays on Software Engineering},
3169− year = {1975},
3170− publisher = {Addison Wesley},
3171− author = {Frederick P. Brooks}
3172−}
3173−
3174−@inproceedings{evalpush,
3175− title = {How to make a fast curry: push/enter vs eval/apply},
3176− year = {2004},
3177− author = {Simon Marlow and Simon {Peyton Jones}},
3178− booktitle = {International Conference on Functional Programming, Snowbird},
3179− pages = {4--15}
3180−}
3181−
3182−@phdthesis{boquist-thesis,
3183− month = {April},
3184− school = {Chalmers University of Technology},
3185− title = {Code Optimisation Techniques for Lazy Functional Languages},
3186− year = {1999},
3187− author = {Urban Boquist}
3188−}
3189−
3190−@book{formal-spec,
3191− title = {Formal Specification Of Programming Languages},
3192− year = {1981},
3193− publisher = {Prentice-Hall},
3194− author = {Frank G. Pagan}
3195−}
3196−
3197−@inproceedings{elim-motive,
3198− title = {Elimination With A Motive},
3199− year = {2000},
3200− booktitle = {Types for Proofs and Programs},
3201− pages = {197--216},
3202− editor = {Paul Callaghan and Zhaohui Luo and James McKinna and Robert Pollack},
3203− publisher = {Springer},
3204− author = {Conor McBride}
3205−}
3206−
3207−@article{telescope,
3208− journal = {Information and Computation},
3209− number = {2},
3210− month = {April},
3211− volume = {91},
3212− title = {Telescoping Mappings in Typed Lambda Calculus},
3213− year = {1991},
3214− pages = {189--204},
3215− author = {N.G. de Bruijn}
3216−}
3217−
3218−@misc{typeintype,
3219− title = {Typechecking is undecidable when 'type' is a type},
3220− year = {1989},
3221− author = {Mark B. Reinhold}
3222−}
3223−
3224−@misc{core,
3225− month = {September},
3226− title = {An External Representation for the {GHC} Core Language},
3227− year = {2001},
3228− author = {Andrew Tolmach and {The GHC Team}}
3229−}
3230−
3231−@article{deforestation,
3232− journal = {Theoretical Computer Science},
3233− volume = {73},
3234− title = {Deforestation: Transforming programs to eliminate trees},
3235− year = {1990},
3236− pages = {231--248},
3237− author = {Philip Wadler}
3238−}
3239−
3240−@misc{hep,
3241− month = {July},
3242− title = {Architecture of the {Haskell} Execution Platform},
3243− year = {1999},
3244− author = {Julian Seward and Simon Marlow and Andy Gill and Sigbjorn Finne and Simon {Peyton Jones} },
3245− note = {Version 6},
3246− howpublished = {Available from \verb+http://www.haskell.org/ghc/documentation.html+}
3247−}
3248−
3249−@mastersthesis{wahlstedt-thesis,
3250− month = {October},
3251− school = {Chalmers University Of Technology},
3252− title = {Detecting Termination Using Size Change In Parameter Values},
3253− year = {2000},
3254− author = {David Wahlstedt}
3255−}
3256−
3257−@inproceedings{size-change,
3258− title = {The size-change principle for program termination},
3259− year = {2001},
3260− booktitle = {Proceedings of the 28th Annual {ACM} {SIGPLAN}-SIGACT Symposium on Principles of Programming Languages},
3261− author = {Chin Soon Lee and Neil D. Jones and Amir Ben-Amram. }
3262−}
3263−
3264−@article{ski-turner,
3265− journal = {Software -- Practice and Experience},
3266− volume = {9},
3267− title = {A new implementation technique for applicative languages},
3268− year = {1979},
3269− pages = {31--49},
3270− author = {David Turner}
3271−}
3272−
3273−@inproceedings{turner-strong,
3274− number = {1022},
3275− title = {Elementary Strong Functional Programming},
3276− year = {1996},
3277− booktitle = {First International Symposium on Functional Programming Languages in Education, Nijmegen, Netherlands, December 1995.},
3278− pages = {1--13},
3279− publisher = {Springer},
3280− author = {David Turner},
3281− series = {LNCS}
3282−}
3283−
3284−@misc{clean,
3285− title = {The {Concurrent CLEAN} Language Report (draft)},
3286− year = {2003},
3287− author = {Rinus Plasmeijer and Marko van Eekelen},
3288− howpublished = {Available from \verb+http://www.cs.kun.nl/~clean/+}
3289−}
3290−
3291−@article{burstall-struct,
3292− journal = {Computer Journal},
3293− number = {1},
3294− volume = {12},
3295− title = {Proving Properties of Programs By Structural Induction},
3296− year = {1969},
3297− pages = {41--48},
3298− author = {Rod Burstall}
3299−}
3300−
3301−@incollection{ barendregt-types,
3302− author = "Henk Barendregt",
3303− title = "Lambda Calculi with Types",
3304− booktitle = "Handbook of Logic in Computer Science, Volumes 1 (Background: Mathematical Structures) and 2 (Background: Computational Structures), Abramsky \& Gabbay \& Maibaum (Eds.)",
3305− publisher = "Clarendon",
3306− volume = "2",
3307− year = "1992",
3308− url = "citeseer.nj.nec.com/barendregt92lambda.html" }
3309−
3310−@book{curry-feys,
3311− title = {Combinatory Logic, volume 1},
3312− year = {1958},
3313− publisher = {North Holland},
3314− author = {Haskell B. Curry and Robert Feys}
3315−}
3316−
3317−@phdthesis{bove-thesis,
3318− month = {November},
3319− school = {Chalmers University of Technology},
3320− title = {General Recursion in Type Theory},
3321− year = {2002},
3322− author = {Ana Bove}
3323−}
3324−
3325−@inbook{ml-cm,
3326− title = {Constructive Mathematics and Computer Programming},
3327− year = {1985},
3328− booktitle = {Mathematical Logic and Programming Languages},
3329− publisher = {Prentice Hall},
3330− author = {Per Martin-L\"{o}f}
3331−}
3332−
3333−@inproceedings{howard,
3334− title = {The formulae-as-types notion of construction},
3335− year = {1980},
3336− booktitle = {To H.B.Curry: Essays on combinatory logic, lambda calculus and formalism},
3337− editor = {Jonathan P. Seldin and J. Roger Hindley},
3338− publisher = {Academic Press},
3339− author = {William A. Howard},
3340− note = {A reprint of an unpublished manuscript from 1969}
3341−}
3342−
3343−@inproceedings{talx86,
3344− title = {TALx86: A Realistic Typed Assembly Language},
3345− year = {1999},
3346− booktitle = {{ACM} {SIGPLAN} Workshop on Compiler Support for System Software},
3347− pages = {25--35},
3348− author = {Greg Morrisett and Karl Crary and Neal Glew and Dan Grossman and Richard Samuels and Frederick Smith and David Walker and Stephanie Weirich and Steve Zdancewic}
3349−}
3350−
3351−@inproceedings{bove-capretta,
3352− volume = {2152},
3353− title = {Nested General Recursion and Partiality in Type Theory},
3354− year = {2001},
3355− booktitle = {Theorem Proving in Higher Order Logics, 14th International Conference, TPHOLS 2001},
3356− pages = {121--135},
3357− editor = {Richard J. Boulton and Paul B. Jackson},
3358− publisher = {Springer-Verlag},
3359− author = {Ana Bove and Venanzio Capretta},
3360− series = {LNCS}
3361−}
3362−
3363−@misc{lvm,
3364− month = {November},
3365− title = {LVM, the lazy virtual machine},
3366− year = {2002},
3367− author = {Daan Leijen}
3368−}
3369−
3370−@misc{ocaml,
3371− howpublished = {\verb+http://caml.inria.fr/ocaml/htmlman/+},
3372− month = {August},
3373− title = {The {Objective Caml} system release 3.06},
3374− year = {2002},
3375− author = {Xavier Leroy}
3376−}
3377−
3378−@misc{lambdagoto,
3379− title = {Lambda : The Ultimate Goto},
3380− year = {1977},
3381− author = {Guy L. {Steele Jr}},
3382− note = {MIT AI Memo 443}
3383−}
3384−
3385−@inproceedings{ liu-tail,
3386− author = "Yanhong A. Liu and Scott D. Stoller",
3387− title = "From Recursion to Iteration: What are the Optimizations?",
3388− booktitle = "Partial Evaluation and Semantic-Based Program Manipulation",
3389− pages = "73-82",
3390− year = "2000",
3391− url = "citeseer.nj.nec.com/liu00from.html" }
3392−
3393−@inproceedings{aczel77,
3394− title = {An Introduction To Inductive Definitions},
3395− year = {1977},
3396− booktitle = {Handbook of Mathematical Logic},
3397− editor = {J. Barwise},
3398− publisher = {North Holland},
3399− author = {Peter Aczel}
3400−}
3401−
3402−@inproceedings{inductive-plastic,
3403− volume = {1956},
3404− title = {Implementation Techniques for Inductive Types in {Plastic}},
3405− year = {1999},
3406− booktitle = {Types for Proofs and Programs},
3407− pages = {94--113},
3408− editor = {Thierry Coquand and Peter Dybjer and Bengt Nordstr\"{o}m and Jan Smith},
3409− publisher = {Springer-Verlag},
3410− author = {Paul Callaghan and Zhaohui Luo},
3411− series = {LNCS}
3412−}
3413−
3414−@misc{graham,
3415− howpublished = {Available from \verb+http://www.paulgraham.com/+},
3416− month = {April},
3417− title = {The Hundred Year Language},
3418− year = {2003},
3419− author = {Paul Graham},
3420− note = {Keynote address at PyCon 2003}
3421−}
3422−
3423−@inproceedings{gimenez98,
3424− volume = {1443},
3425− title = {Structural Recursive Definitions in Type Theory},
3426− year = {1998},
3427− booktitle = {Proceedings of ICALP '98},
3428− publisher = {Springer-Verlag},
3429− author = {Eduardo Gim\'{e}nez},
3430− series = {LNCS}
3431−}
3432−
3433−@article{quicksort,
3434− journal = {Computer Journal},
3435− number = {1},
3436− volume = {5},
3437− title = {Quicksort},
3438− year = {1962},
3439− pages = {10--15},
3440− author = {C.A.R. Hoare}
3441−}
3442−
3443−@phdthesis{goguen-thesis,
3444− school = {University of Edinburgh},
3445− title = {A Typed Operational Semantics for Type Theory},
3446− year = {1994},
3447− author = {Healfdene Goguen}
3448−}
3449−
3450−@article{ph-universes,
3451− journal = {Theoretical Computer Science},
3452− number = {1},
3453− volume = {89},
3454− title = {Type Checking With Universes},
3455− year = {1991},
3456− pages = {107--136},
3457− author = {Robert Harper and Randy Pollack}
3458−}
3459−
3460−@inproceedings{pm-compile,
3461− month = {September},
3462− title = {Compiling Pattern Matching},
3463− year = {1985},
3464− booktitle = {Functional Programming Languages and Computer Architecture},
3465− pages = {368--381},
3466− editor = {Jean-Pierre Jouannaud},
3467− publisher = {Springer-Verlag},
3468− author = {Lennart Augustsson}
3469−}
3470−
3471−@phdthesis{lena-thesis,
3472− school = {Chalmers University of Technology, G\"{o}teborg},
3473− title = {The implementation of {ALF} -- A Proof Editor based on {Martin-L\"{o}f}'s Monomorphic Type Theory with Explicit Substitutions},
3474− year = {1994},
3475− author = {Lena Magnusson}
3476−}
3477−
3478−@article{view-left,
3479− journal = {Journal of Functional Programming},
3480− number = {1},
3481− volume = {14},
3482− title = {The View From The Left},
3483− year = {2004},
3484− author = {Conor McBride and James McKinna},
3485− pages = {69--111}
3486−}
3487−
3488−@inproceedings{not-a-number,
3489− author = {Conor McBride and James McKinna},
3490− title = {I am not a number, {I} am a free variable},
3491− year = {2004},
3492− booktitle = {Proceedings of the {ACM} {SIGPLAN} Haskell Workshop}
3493−}
3494−
3495−
3496−@misc{profiling,
3497− title = {Time and Space Profiling for Non-Strict, Higher Order Functional Languages},
3498− year = {1995},
3499− author = {Patrick M. Sansom and Simon {Peyton Jones}}
3500−}
3501−
3502−@inbook{pattern-matching,
3503− title = {The Implementation of Functional Programming Languages},
3504− year = {1987},
3505− booktitle = {The Implementation of Functional Programming Languages},
3506− pages = {78--103},
3507− editor = {Simon {Peyton Jones}},
3508− chapter = {5},
3509− publisher = {Prentice Hall},
3510− author = {Philip Wadler},
3511− crossref = {pj-imp}
3512−}
3513−
3514−@article{pe-problems,
3515− author = {Jones, N. D.},
3516− title = {Challenging problems in partial evaluation and mixed computation},
3517− journal = {New Gen. Comput.},
3518− volume = {6},
3519− number = {2-3},
3520− year = {1988},
3521− issn = {0288-3635},
3522− pages = {291--302},
3523− doi = {http://dx.doi.org/10.1007/BF03037143},
3524− publisher = {Ohmsha},
3525− address = {Tokyo, Japan, Japan},
3526− }
3527−
3528−@inproceedings{tag-elim,
3529− title = {Tag Elimination -- or -- Type Specialisation is a Type Indexed Effect},
3530− year = {2000},
3531− booktitle = {Subtyping and Dependent Types in Programming, APPSEM Workshop},
3532− author = {Walid Taha and Henning Makholm}
3533−}
3534−
3535−@inproceedings{extraction-coq,
3536− title = {A New Extraction for {Coq}},
3537− year = {2002},
3538− booktitle = {Types for proofs and programs},
3539− editor = {Herman Geuvers and Freek Wiedijk},
3540− publisher = {Springer},
3541− author = {Pierre Letouzey},
3542− series = {LNCS}
3543−}
3544−
3545−@phdthesis{mcbride-snr-thesis,
3546− school = {Queen's University of Belfast},
3547− title = {Computer Aided Manipulation of Symbols},
3548− year = {1970},
3549− author = {Fred McBride}
3550−}
3551−
3552−@article{ho-strictness,
3553− journal = {Science of Computer Programming},
3554− volume = {7},
3555− title = {Strictness analysis for higher-order functions},
3556− year = {1986},
3557− pages = {249--278},
3558− author = { Geoffrey L. Burn and Chris Hankin and Samson Abramsky}
3559−}
3560−
3561−@phdthesis{mycroft-thesis,
3562− school = {Dept Computer Science, University of Edinburgh},
3563− title = {Abstract interpretation and optimising transformations for applicative programs},
3564− year = {1981},
3565− author = {A. Mycroft}
3566−}
3567−
3568−@inproceedings{bc-nested,
3569− month = {September},
3570− volume = {2152},
3571− title = {Nested General Recursion and Partiality in Type Theory},
3572− year = {2001},
3573− booktitle = {Theorem Proving In Higher Order Logics: 14th International Conferences, TPHOLS 2001},
3574− pages = {121--135},
3575− publisher = {Springer--Verlag},
3576− author = {Ana Bove and Venanzio Capretta},
3577− series = {LNCS}
3578−}
3579−
3580−@techreport{bove-mutual,
3581− month = {May},
3582− title = {Mutual General Recursion in Type Theory},
3583− year = {2002},
3584− institution = {Department of Computing Science, Chalmers University of Technology},
3585− author = {Ana Bove}
3586−}
3587−
3588−@article{berardi-pruning,
3589− journal = {Journal of Logic and Computation},
3590− number = {5},
3591− volume = {6},
3592− title = {Pruning Simply Typed Lambda Terms},
3593− year = {1996},
3594− pages = {663--681},
3595− author = {Stefano Berardi}
3596−}
3597−
3598−@article{milner-tc,
3599− journal = {Journal of Computer and System Science},
3600− volume = {17},
3601− title = {A Theory of Type Polymorphism in Programming},
3602− year = {1978},
3603− pages = {348--75},
3604− author = {R. Milner}
3605−}
3606−
3607−@inproceedings{extt,
3608− title = {Inductive Families Need Not Store Their Indices},
3609− year = {2004},
3610− booktitle = {Types for Proofs and Programs 2003},
3611− author = {Edwin Brady and Conor McBride and James McKinna},
3612− editor = {Stefano Berardi and Mario Coppo and Ferruccio Damiani},
3613− series = {Lecture Notes in Computer Science},
3614− publisher = {Springer},
3615− volume = {3085},
3616− pages = {115--129}
3617−}
3618−
3619−@book{luo94,
3620− title = {Computation and Reasoning -- A Type Theory for Computer Science},
3621− year = {1994},
3622− publisher = {OUP},
3623− author = {Zhaohui Luo},
3624− series = {Intl. Series of Monographs on Comp. Sci.}
3625−}
3626−
3627−@article{backus78,
3628− journal = {Communications of the {ACM}},
3629− month = {August},
3630− volume = {21},
3631− title = {Can Programming Be Liberated From the {Von Neumann} Style?},
3632− year = {1978},
3633− pages = {280--294},
3634− author = {John Backus}
3635−}
3636−
3637−@misc{henk,
3638− month = {May},
3639− title = {Henk: A Typed Intermediate Language},
3640− year = {1997},
3641− author = {Simon {Peyton Jones} and Erik Meijer}
3642−}
3643−
3644−@article{thunks,
3645− journal = {Journal of Functional Programming},
3646− number = {3},
3647− month = {May},
3648− volume = {7},
3649− title = {Thunks and the $\lambda$-calculus},
3650− year = {1997},
3651− pages = {303--319},
3652− author = {John Hatcliff and Olivier Danvy}
3653−}
3654−
3655−@inproceedings{grin-project,
3656− author = "Urban Boquist and Thomas Johnsson",
3657− title = "The {GRIN} Project: A Highly Optimising Back End for Lazy Functional Languages",
3658− booktitle = "Implementation of Functional Languages",
3659− pages = "58--84",
3660− year = "1996",
3661− url = "citeseer.ist.psu.edu/boquist96grin.html" }
3662−
3663−@misc{boehm-gc,
3664− nothowpublished = {\url{http://www.hpl.hp.com/personal/Hans_Boehm/gc/}},
3665− title = {A garbage collector for {C} and {C++}},
3666− year = {2001},
3667− author = {Hans-J. Boehm and Alan J. Demers and {Xerox Corporation Silicon Graphic} and {Hewlett-Packard Company}}
3668−}
3669−
3670−@misc{art-interpreter,
3671− month = {May},
3672− title = {The Art of the Interpreter or, the Modularity Complex (Parts Zero, One, and Two)},
3673− year = {1978},
3674− author = {Guy Lewis {Steele, Jr.} and Gerald Jay Sussman},
3675− note = {MIT AI Lab. AI Lab Memo AIM-453}
3676−}
3677−
3678−@inproceedings{gimenez,
3679− title = {Codifying Guarded Definitions With Recursive Schemes},
3680− year = {1994},
3681− booktitle = {Proceedings of TYPES 1994},
3682− pages = {39--59},
3683− author = {Eduardo Gim\'{e}nez}
3684−}
3685−
3686−@manual{ghc-manual,
3687− title = {The Glasgow Haskell Compiler User's Guide, Version 6.0},
3688− year = {2003},
3689− author = {The {GHC Team}}
3690−}
3691−
3692−@article{rbtree,
3693− journal = {Journal of Functional Programming},
3694− number = {4},
3695− month = {May},
3696− volume = {9},
3697− title = {Red-Black Trees In A Functional Setting},
3698− year = {1999},
3699− pages = {471--477},
3700− author = {Chris Okasaki}
3701−}
3702−
3703−@inproceedings{dt-data,
3704−author = "Hongwei Xi",
3705−title = {{Dependently Typed Data Structures}},
3706−booktitle = "Proceedings of Workshop of Algorithmic Aspects of Advanced Programming Languages (WAAAPL '99)",
3707−year = 1999,
3708−month = "September",
3709−pages = "17--32",
3710−address = "Paris",
3711−}
3712−
3713−@misc{krivine,
3714− title = {On the Correctness and Efficiency of the {Krivine} Machine},
3715− year = {2003},
3716− month = {October},
3717− author = {Mitchell Wand and Daniel P. Friedman},
3718− howpublished = {Submitted for publication}
3719− }
3720−
3721−@inproceedings{nbe-filinski,
3722− title = {Normalization by Evaluation for the Computational Lambda-Calculus},
3723− year = {2001},
3724− month = {May},
3725− booktitle = {Typed Lambda Calculi and Applications: 5th International Conference, TLCA 2001},
3726− author = {Andrzej Filinski},
3727− pages = {151--165},
3728− publisher = {Springer-Verlag},
3729− series = {LNCS},
3730− volume = {2044}
3731−}
3732−
3733−@inproceedings{filinski-nbesem,
3734− title = {A semantic account of type-directed partial evaluation},
3735− year = {1999},
3736− author = {Andrzej Filinski},
3737− editor = {G. Nadathur},
3738− booktitle = {International Conference on Principles and Practice of Declarative Programming},
3739− volume = {1702},
3740− series = {LNCS},
3741− pages = {378--395},
3742− publisher = {Springer-Verlag}
3743−}
3744−
3745−@article{secd,
3746− title = {The mechanical evaluation of expressions},
3747− author = {P.J. Landin},
3748− year = {1964},
3749− journal = {Computer Journal},
3750− volume = {6},
3751− pages = {308--320}
3752−}
3753−
3754−@misc{lispkit,
3755− title = {The {LispKit} Manual},
3756− author = {Peter Henderson and Geraint Jones and Simon Jones},
3757− year = {1982},
3758− howpublished = {Oxford University Computing Laboratory}
3759−}
3760−
3761−@inproceedings{wells-undecidable,
3762− title = {Typability and Type Checking in the Second-order $\lambda$-calculus are equivalent and undecidable},
3763− author = {J. Wells},
3764− year = {1994},
3765− month = {July},
3766− booktitle = {Proc. 9th Ann. {IEEE} Symp. Logic Comput. Sci.}
3767−}
3768−
3769−@misc{patguards,
3770− title = {Pattern Guards and Transformational Patterns},
3771− author = {Martin Erwig and Simon {Peyton Jones}},
3772− year = {2000},
3773− howpublished = {Haskell Workshop}
3774−}
3775−
3776−@misc{alfa-manual,
3777− title = {Alfa Users' Guide},
3778− author = {Thomas Hallgren},
3779− year = {2001},
3780− howpublished = {Available from \verb+http://www.cs.chalmers.se/~hallgren/Alfa/+}
3781−}
3782−
3783−@inproceedings{nofib,
3784− title = {The nofib Benchmark Suite of {Haskell} Programs},
3785− author = {Will Partain},
3786− year = {1992},
3787− booktitle = {Functional Programming},
3788− editor = {J. Launchbury and P.L. Sansom},
3789− series = {Workshops in Computing},
3790− publisher = {Springer Verlag}
3791−}
3792−
3793−@article{shape,
3794− title = {Shape in Computing},
3795− author = {Barry Jay},
3796− journal = "{{ACM}} Computing Surveys",
3797− year = "1996",
3798− volume = "28",
3799− number = "2",
3800− pages = "355--357",
3801−}
3802−
3803−@misc{ffi,
3804− title = {The {Haskell 98} Foreign Function Interface 1.0: An Addendum to the {Haskell 98} Report},
3805− editor = {Manuel Chakravarty},
3806− key = {FFI},
3807− year = {2002},
3808− month = {December},
3809− howpublished = {Available from \verb+http://www.haskell.org/+}
3810−}
3811−
3812−@misc{perlxs,
3813− title = {Perl {XS} Reference Manual},
3814− author = {Dean Roehrich and {The Perl Porters}},
3815− year = {1996},
3816− howpublished = {\verb+http://www.perldoc.com/perl5.6/pod/perlxs.html+}
3817−}
3818−
3819−@misc{swig,
3820− title = {{SWIG} : An Easy to Use Tool for Integrating Scripting Languages with {C} and {C++}},
3821− author = {David M. Beazley},
3822− year = {1996},
3823− howpublished = {\verb+http://www.swig.org/papers/Tcl96/tcl96.html+}
3824−}
3825−
3826−@inproceedings{types-prog,
3827− title = {Type Systems for Programming Languages},
3828− booktitle = {Handbook of Theoretical Computer Science},
3829− author = {John C. Mitchell},
3830− pages = {365--458},
3831− year = {1990},
3832− crossref = {htcs}
3833−}
3834−
3835−@book{htcs,
3836− title = {Handbook of Theoretical Computer Science},
3837− editor = {J. van Leeuwen},
3838− publisher = {Elsevier Science},
3839− year = {1990}
3840−}
3841−
3842−@misc{r5rs,
3843− title = {Revised$^5$ Report on the Algorithmic Language Scheme},
3844− author = {Richard Kelsey and William Clinger and Jonathan Rees},
3845− year = {1998},
3846− month = {February},
3847− howpublished = {Available from \verb+http://www.schemers.org/+}
3848− }
3849−
3850−@misc{gmail-outage,
3851− title = {Update on today's {Gmail} Outage},
3852− author = {{Official Gmail Blog}},
3853− howpublished = {\url{http://gmailblog.blogspot.com/2009/02/update-on-todays-gmail-outage.html}},
3854− note = {Retrieved 26th February 2009},
3855− year = 2009
3856−}