Computer Lab

USCS2009
On this page, we will add instructions for the individual lab sessions.

Monday, August 24 (morning and afternoon)

Mainly try to work on your projects, and start thinking about the presentations. If you want some extra assignment that also involves a parsing component, you can try the Database assignment.

Friday, August 21 (morning and afternoon)

Continue with project work. Beginners can also try the Trees, TurtleGraphics, Stereograms or StateMonad assignments from previous days.

Advanced students can additionally try the Unsafe assignment that shows how to abuse unsafePerformIO.

Thursday, August 20 (afternoon)

In addition to the previous tasks, you can look at the following two new assignments:

The first one is definitely suitable for beginners. The second one should be doable for beginners after tomorrow's morning lecture on type classes.

Thursday, August 20 (morning)

In this session, you should

  • work on your projects
  • try to deepen your knowledge about the lectures

If you are among the beginners, you may now have reached the point where you can also try the TurtleGraphics and Stereograms assignments (download below).

Wednesday, August 19 (afternoon)

Try to start working on your projects.

Wednesday, August 19 (morning)

The goals of this session are to

  • form project groups and decide on a project
  • try out the new things you have learned in the lectures

Projects

See below (Tuesday) for project ideas and information on how groups should be formed. Try to make a decision this morning, because otherwise the time to work on the project will be much reduced.

Practice

Try to write a number of functions from the lectures. For instance, try to write the permutations function of type [a] -> [[a]] that computes all permutations of a given list. Also, if you are a beginner and have not yet looked at the List and MasterMind assignments (download below), you could do so.

For advanced students, a good exercise is to try to implement a datatype for lambda terms, plus functions for computing the free variables, performing substitution, reducing an expression to normal form.

Tuesday, August 18 (afternoon)

The goals of this session are to

  • form project groups and decide on a project
  • play a little with QuickCheck
  • have a look at Cabal and HackageDB, Haskell's packaging and distribution infrastructure

More details below:

Projects

In the days to come, you should work in a group consisting of three to five persons on a small project you find interesting. The conditions on group formation are

  • People in the same group should not have known each other before the summer school.
  • Groups should be balanced between beginners and advanced Haskellers.

Projects are to either write a small application in Haskell according to your interests, or to pick a tool or library that is not handled in the lectures of the course, learn more about it and play with it. In both cases, you have the opportunity to give a short presentation of your results to all the participants of the summer school next Thursday (August 27).

Project ideas

Here are a couple of ideas to choose from, but others are possible as well:

  • Look at a Haskell database library such as HDBC or HaskellDB.
  • Look at Lambdabot, an IRC bot written in Haskell.
  • Look at Djinn, a tool to generate values of a given type.
  • Look at XMonad, a Haskell-based X window manager.
  • Look at how Hoogle works internally.
  • Look at HaXml, an XML toolkit.
  • Look at the binary library to serialize data.
  • Look at the Lava hardware description EDSL.
  • Look at Haskore (a music EDSL).
  • Look at pretty printing combinators.
  • Look at Gitit, a Haskell Wiki using git as version control system.
  • Look at a generic programming library such as regular.
  • Extend the turtle graphics assignment.
  • Write a small library for image generation and manipulation along the lines of Pan.
  • Write a parser for a (not too large and complicated) language in Haskell, using combinators.
  • Write an L-systems generator and/or visualizer.
  • Write an interpreter for a simple programming language (for instance, for the untyped lambda calculus with a few types).
  • Implement a little game, with or without graphics.
  • Implement a little interactive tool, such as a vocabulary trainer.

As an inspiration for programming projects you can also look at old ICFP programming contest tasks (the Wikipedia page has links to all the sites of the individual contests) or the project descriptions for LambdaRogue and Lambdarinth, but note that you'll have to reduce the requirements significantly, as there is not very much time.

QuickCheck, Cabal and HackageDB

Most Haskell libraries are available via a large central repository called HackageDB. All libraries that are available there are packaged in a common format called Cabal.

Try to find the QuickCheck package on HackageDB and download the source code. Note that the lecture discussed versions 1.* of QuickCheck? , because that is what most packages are still using. But feel free to download any version you like.

Unpack the QuickCheck library and look at the structure of a Cabal package. Also consult the Cabal documentation on how to make a Cabal package in order to understand, for instance, the .cabal file and the Setup file contained in the package.

Look at the sources and see how they contain Haddock comments.

If you are a Haskell beginner, you may want to try writing a few simple properties. For instance, you can reimplement the examples from the lecture. If you have implemented an assignment such as MasterMind, try to come up with properties for a few of your functions and test them. An interesting medium task is to define a generator of lists suitable for guesses in MasterMind (correct width and number of colors).

If you are more advanced, try to define a type of binary trees, make that datatype an instance of class Arbitrary, and test a few properties on trees, such as that flattening a tree and then taking the length of the list is the same as computing the size of the tree.

Tuesday, August 18 (morning)

The goals of this session are to

  • continue or finalize working on your initial assignments from yesterday,
  • look at a number of useful Haskell-related tools,
  • start forming project groups (three to five people, balanced between beginners and advanced students).

More details below:

Assignments

Continue what you started with yesterday. It would be good if every beginner had finished the Lab Intro and worked on one additional assignment (even if that's not finished), and if every advanced student had finished at least one assignment that is not the Lab Intro.

Tools

In addition, you should look at a couple of useful Haskell-related tools:

  • HLint checks your Haskell code for style and makes suggestions on how to improve your programs. Try it on your own code and see how you might improve. HLint is installed on the Lab machines, just call hlint on the command line (Linux command lines are case-sensitive, so make sure everything is in lowercase letters).

  • Haddock is a tool to generate API documentation from Haskell modules by analyzing comments written using a simple markup language. The website contains documentation and examples. Again, you are encouraged to try adding Haddock comments to one of your Haskell modules and run Haddock on it. Haddock is installed on the Lab machines and can be called using the haddock command on the command line.

Initial project group formation

In the days to come, you should work in a group consisting of three to five persons on a small project you find interesting. The conditions on group formation are

  • People in the same group should not have known each other before the summer school.
  • Groups should be balanced between beginners and advanced Haskellers.

Projects are to either write a small application in Haskell according to your interests, or to pick a tool or library that is not handled in the lectures of the course, learn more about it and play with it. In both cases, you have the opportunity to give a short presentation of your results to all the participants of the summer school next Thursday (August 27).

In the morning and perhaps over lunch, you can try to talk to a few people about your interests and ideas and try to form initial groups. It will be part of the afternoon lab session to select an actual topic.

Monday, August 17

The goals of this session are:

  • Familiarize yourself with the lab computers and/or get a ghc toolchain running on your own machine. Note that even if you have your own laptop, it may be helpful to have a quick look at how the lab machines work.

  • Solve some assignments based on what you already know about Haskell.

  • Discuss with the lecturers which of the tracks you should follow during the following days.

Lab environment

To familiarize yourself with how the lab computers work, you may consult the cheat sheet.

Assignments

If you have no or little Haskell experience, you should definitely start with the Lab Intro. It assumes basically no previous knowledge at all and presents you with many small questions that gradually expose you to some of the concepts of the language.

Should you finish early on the Lab Intro or if you have more experience already, there are four larger assignments you can choose from:

Even if you feel that any of these four assignments is too easy for you, I encourage you to try to solve either TurtleGraphics and Stereograms. Try to focus on code quality and to write elegant code.

Teamwork

It is generally allowed to work in teams of two persons on assignments, and it is encouraged that you talk among each other and help each other. However, the goal is for each participant to learn as much as possible. You are responsible yourself for not letting others do all your work, because then you will not gain anything. Advanced Haskellers should try to help, but help responsibly: give advice, not solutions.

Support

During the session, Sean Leather, Arie Middelkoop, and Jeroen Fokker will be present next to the lecturers of the course. Do not hesitate to ask them.

Topic attachments
I Attachment Action Size Date Who Comment
pdfpdf CheatSheet.pdf manage 39.9 K 17 Aug 2009 - 13:07 AndresLoeh  
pdfpdf Database.pdf manage 93.0 K 24 Aug 2009 - 12:11 AndresLoeh  
pdfpdf Intro.pdf manage 145.9 K 17 Aug 2009 - 08:33 AndresLoeh Lab Intro
pdfpdf LambdaRogue.pdf manage 147.1 K 18 Aug 2009 - 14:08 AndresLoeh  
pdfpdf Lambdarinth.pdf manage 81.9 K 18 Aug 2009 - 14:11 AndresLoeh  
pdfpdf Lists.pdf manage 46.3 K 17 Aug 2009 - 20:02 AndresLoeh  
elsehs MasterMind.hs manage 2.4 K 17 Aug 2009 - 08:41 AndresLoeh  
pdfpdf MasterMind.pdf manage 70.8 K 17 Aug 2009 - 08:38 AndresLoeh  
elsehs SIRDS.hs manage 8.3 K 17 Aug 2009 - 15:14 AndresLoeh  
pdfpdf StateMonad.pdf manage 70.0 K 20 Aug 2009 - 14:18 AndresLoeh  
pdfpdf Stereograms.pdf manage 127.3 K 17 Aug 2009 - 08:42 AndresLoeh  
pdfpdf Trees.pdf manage 49.0 K 20 Aug 2009 - 14:18 AndresLoeh  
pdfpdf TurtleGraphics.pdf manage 81.4 K 17 Aug 2009 - 13:06 AndresLoeh  
pdfpdf Unsafe.pdf manage 45.2 K 21 Aug 2009 - 09:29 AndresLoeh