# 2IPH0       Declarative programming                                     20180410

 Running in this theatre: 2017/18 Q3 This web page will be under construction permanently for questions and other communication contact j.c.s.p.v.d.woude@tue.nl

Due to unforseen cirumstanes this course will be an experimental tryout again, so any remark and criticism is welcomed warmly and easily dealt with by referring to the experimental character.

This webpage should inform you on the course, its materials, duties and possibilities. So most of it will consist of  references and directives, can't make it much cosier.

## Some details

The course runs in quartile 3 block E (Tuesday afternoon and Thursday morning).

• responsible staff: Jaap van der Woude, with much appreciated help from Rik van Geldrop,
the former teacher of functional programming courses at the TU/e.
• level 3 , 5ects, exam and assignment  (70%-30%)
• material: the book of Graham Hutton (2nd edition) and several handouts and papers
• contact hours: Tuesdays 5+6+7+8, partly organized selftuition and exercise sessions.
• exam date: 20180410 09.00

### Study guide

In order to  define the course content and help you study it there is a study guide, with a definition of the subject and material to study it per week. The guide will grow
study guide

### Exercises

It is very important to get to grips with the literature mentioned in the study guide, but it is evenly important to do the exercises. So we have a host of exercises. The study guide mentiones what exercises are relevant. Some are in the literature for the subject, but most are from the reader of 2IA05 the old course in functional programming.
exercises

There are solutions for many of these exercise, but not for all of them. The solutions may be in dutch, but we assume it doesn't hurt too much since the formulae are the same. In due time the existing solutions will be made available here.
V(week1),  week2,
The solutions we have for the other exercise collections:
T, S, B, A
solutions for exercises in streams paper
nim solutions (directory) and GH 10.5 (hs)
solution of statemonad exercise on building trees (hs)

#### Exam

The exam date is 20180410 in the morning.
Two former exams are exam17q3, exam17q4.
They may give an impression, but are no promise on the shape of things to come.
The real thing of 20180410 with solutions: exam18q3

#### A remark on the assignment

As promised a little note on the assignment including examples

### General references

There are many places to get your fp-knowledge from.

#### booksGraham Hutton, Programming in Haskell, 2nd edition  (obligatory)

alternative paperware
Richard Bird, Thinking functionally with Haskell,
Simon Thompson, Haskell, the craft of functional programming
Paul Hudak, School of expression   (slightly old but interesting for music lovers)
Simon Peyton Jones, Haskell 98 language and libraries   (unreadable, only for reference)

online
Wikibooks, Haskell,  pdf       extensive but informative (~600 pages)
Miran Lipovaca, Learn you a Haskell for great good, pdf     ( too informal and too easy going)
Hal Daume III, yet another Haskell tutorial,  pdf  (?)

software
(Of course you are free, even encouraged, to look at other  languages too, like ELM, Clean, SML and what have you more.)
In order to work with the software, you have to get it and install it. The process is described in

installation remarks

Arduin mentioned that the proud Mac OS user might want to get 'homebrew' from
www.brew.sh
Just type and run in your terminal
brew install ghc cabal-install

Weekly plan with relevant material (to evolve during the quartile)

A rough sketch of the course plan in week subjects with references to the relevant chapters in the book of Hutton.
More details are mentioned in the study guide.
1. a first meet and greet with functional programming and Haskell in particular, (Hutton 1-5)
2. recursion ( Hutton 6,7)
3. types and classes (Hutton 8), inductive types
4. algebra's (handout) and reasoning about programs (Hutton 16)
5. lazy programs, coinduction (Hutton 15)
6. monads and I/O (Hutton 10,12)
7. parsing (Hutton 13), dynamic programming
8. (optional enrichment)  lambda calulus, logic programming

#### Material week 1

• Rojas paper on lambda calculus (pdf)
• a note on notation (pdf)
• the prelude (htm)
• sudoku solver (hs, hs, pdf)

#### Material week 2

• handout on recursion (pdf)
• how to work on lists (pdf)

#### Material week 3

• handout on polymorphic typing (pdf)
• slides 2007/8 on polymorphic typing (pdf)
• slides on (old) chapter 7 oo Hutton (ppt)
• handout on inductive types (pdf)
• jeremy gibbons chapter 5 (pdf)
• lambert meertens category theory (pdf)

#### Material week 4

• slides week 4 (pdf)
• huffman exercise (pdf)
Material week 5
• slides week 5 (pdf)
• streams and co-induction handout (pdf)
• corecursion paper Gibbons and Hutton (pdf)
• streams paper Hinze (pdf)
Material week 6
• introduction to Haskell IO (htm)
• Yblog (htm)
• nim exercise (pdf, hs, hs)
• monaatje handout on monads (pdf)
• slides week 6 (pdf)
• monads as computation and containers (pdf, pdf)
• wikibooks monads and categories (pdf)
• typeclassopedia (pdf)