I. CCSC Haskell tutorial A. Short Haskell applications: text, numbers, treesort and DFAs 1. Simple text processing a. \begin{itemize} b. \item higher-order list functions and a few simple utilities can be combined to do \xlink{../code/short.html#textproc}{simple text processing} c. \end{itemize} 2. ROT-13 transcoder a. \begin{itemize} b. \item similar techniques allow us to define a basic \xlink{../code/short.html#rot13}{"ROT-13" text encryption utility} in about 5 lines c. \end{itemize} 3. Command-line interaction a. \begin{itemize} b. \item Haskell's pre-defined interaction process is based on whole inputs, but a few intervening functions allow us to easily define a \xlink{../code/short.html#rot13}{line-by-line user interaction program} c. \end{itemize} 4. Palindrome checking a. \begin{itemize} b. \item we can check whether a string is a palindrome by normalizing it and comparing it to its own reversal: \xlink{../code/short.html#palcheck}{the palindrome checker} c. \end{itemize} 5. Numeral conversion in different bases a. \begin{itemize} b. \item by spotting certain symmetries in base-radix notation, we can easily write "generator functions" for arbitrary number bases which \xlink{../code/short.html#numbase}{convert between strings and integers} c. \end{itemize} 6. Binary trees and treesort a. \begin{itemize} b. \item a data type for binary search trees, plus an appropriate fold function over those trees, makes \xlink{../code/short.html#treesort}{the definition of tree sort clear and compelling} c. \end{itemize} 7. DFA simulation a. \begin{itemize} b. \item we can transcribe a definition of \xlink{../code/short.html#treesort}{deterministic finite automata} almost verbatim from a theory text, and then experiment with automata and strings c. \end{itemize} B. Medium-sized application: generic sorting and a database 1. Simple insertion and quicksorts a. \begin{itemize} b. \item standard sorting algorithms such as insertion sort or quicksort can be written in a few lines; \xlink{../code/gensort.html#sorts}{some trade-offs between abstraction and readability are demonstrated here for quicksort} c. \end{itemize} 2. Generalizing to an arbitrary order relation a. \begin{itemize} b. \item using higher-order functions we can easily \xlink{../code/gensort.html#absorder}{generalize our quicksort to work for arbitrary ordering relations} c. \end{itemize} 3. Sorting on extracted "fields" a. \begin{itemize} b. \item now, given some more structured data, we can \xlink{../code/gensort.html#fields}{succinctly express sorts by different criteria} c. \end{itemize} 4. Simultaneous sorting a. \begin{itemize} b. \item we can even extend our sorting function to use two relations on the same data, thus providing \xlink{../code/gensort.html#fields}{independent simultaneous sorts} c. \end{itemize} 5. A simple academic course database a. \begin{itemize} b. \item a type definition and a few utility functions provide us with \xlink{../code/gensort.html#courses}{a simple database of academic courses} c. \end{itemize} 6. Derived lexicographic orderings a. \begin{itemize} b. \item a little bit of logical manipulation allows us to extend any pair (or list) of ordering relations to \xlink{../code/gensort.html#lexi}{provide a lexicographic sort} c. \end{itemize} C. Medium-sized application: arithmetic expression processor 1. An arithmetic expression parser and processor a. This example shows how a simple parser and evaluator can be defined for maximum flexibility using polymorphic types and higher-order functions. 2. Token type and scanner a. \begin{itemize} b. \item \xlink{../code/expr.html#scan}{a simple type of alternatives and a short recursive function} suffice to transform strings into lists of tokens c. \end{itemize} 3. Tree type and parser (from concrete to abstract) a. \begin{itemize} b. \item our parser is \xlink{../code/expr.html#parse}{parameterized with respect to functions} which might be semantic actions or just tree constructors c. \end{itemize} 4. Operator semantics ("back-end") a. \begin{itemize} b. \item \xlink{../code/expr.html#oper}{a simple database of operators and their meanings} takes advantage of Haskell's ability to store functions in lists c. \end{itemize} 5. Evaluation (and deforestation with folds) a. \begin{itemize} b. \item \xlink{../code/expr.html#tree}{a data type of abstract syntax trees} allows us to hold onto parse data ... but we can also choose to apply semantic actions immediately in order to evaluate an expression c. \end{itemize} 6. Formatting/pretty-printing (in various forms) a. \begin{itemize} b. \item expressions "frozen" in trees can be \xlink{../code/expr.html#print}{printed in different formats} just by varying a "fixity" parameter c. \end{itemize} 7. Variations on multi-parsing (pair of parsers, parser of pairs) a. \begin{itemize} b. \item we can simultaneously parse and evaluate by using \xlink{../code/expr.html#pair}{a pair of parsers or a parser on pairs} c. \end{itemize} 8. Traced calculations a. \begin{itemize} b. \item we can even extend our notion of output to include \xlink{../code/expr.html#trace}{a complete calculation history, annotated with intermediate terms} c. \end{itemize} 9. Interactivity (at outer entry level) a. \begin{itemize} b. \item all of these operations (evaluation, formatting, tracing) can be accommodated in \xlink{../code/expr.html#interact}{a single, generic command-line interface} c. \end{itemize} D. An overview of larger-scale projects 1. The Haskore music system (and other DSLs) a. Paul Hudak at Yale has defined a powerful language for describing musical structures in abstract terms based on Haskell (see the \xlink{http://haskell.org/haskore/}{Haskore Project} website) b. \par c. In general, Haskell's abstraction features make it ideal for defining {\bf domain-specific languages} as Haskell libraries 2. The Fran and Pan graphics projects a. Conal Elliot at Microsoft Research has developed a couple of libraries, {\bf Fran} and {\bf Pan}, which allow a very high-level way to specify \xlink{../pics/}{complex graphics, animations and interactive animations} b. \par c. In Fran, for example, an interactive, single-player "Pong" game can be written in less than 20 lines, using concepts such as integration to express the relationship between velocity and position 3. GUI projects a. A number of graphical user interface libraries are listed on the Haskell home page, ranging from low-level interfaces to traditional C libraries, to high-level, purely-functional characterizations b. \par c. (see the \xlink{http://haskell.org/libraries/#guigs}{GUI library section of the Haskell homepage} for more details 4. The Galois Connections ray-tracer a. Every year the {\it International Conference on Functional Programming} holds a 72-hour "challenge problem" contest; last year's problem involved writing a 3-D ray-tracer which compiles a scene-description language into rendered output b. \par c. a local team from Galois Connections managed to achieve 2nd-place standing for their entry E. Haskell's place in Computer Science and CS education 1. Haskell at Willamette a. All of Willamette's courses are taught in Java, with the exception of the FP course, which uses Haskell 2. Haskell as a fresh perspective a. Because of its non-standard model of computation and its powerful abstraction features, Haskell can serve to positively influence student's design skills, even in other languages 3. Haskell for Discrete Mathematics a. Rex Page has an \xlink{}{NSF project at U Oklahoma called Beseme} which seeks to provide runnable implementations on traditional discrete math topics b. \par c. Rex uses \xlink{http://www.amazon.com/exec/obidos/ASIN/1852330899/qid=1002009396/sr=1-1/ref=sr_1_4_1/102-7018854-4544137}{Hall and O'Donnel's "Discrete Mathematics Using a Computer"} as a textbook 4. Haskell as "programming for mathematicians" a. to turn the tables a bit, Haskell's mathematical flavor and high-level approach make it ideal for use as a first language for math students END