Computer Lab
USCS2010
Lab environment
The machines you are working with are dual-boot machines that can be booted with
both Linux and Windows as operating systems. Your summer school accounts (starting
with
sc) should work for both operating systems. Your Solis IDs may work on Windows,
but will not work on Linux.
Both operating systems are equipped with a basic Haskell environment, but the Linux installation
is newer, and we can in principle install new stuff during the summer school, so using Linux
is recommended.
Teamwork
You are encouraged to work in teams of two. This does not mean that you have to do
everything together and at the same time. But it means that you talk about what you
are planning to do and what you have done with your partner, and that you show each
other your code, or go through difficult parts together. This, in general, increases the
learning experience.
Assistance and Feedback
Make use of the assistants that are around. They can easily be recognized by their
red badges. They are there to help you. Also, when you have completed a task, show
your code to someone and let them have a look. Writing correct code is good, but
writing elegant, concise, and readable code is important, too. Explaining your code
to someone else is a good test for whether your code is easy to understand for
somebody else.
Tasks for Wednesday, August 25
Work on the tasks from the previous days, or on your projects. Also, if you have
registered for a student presentation slot, keep in mind that the presentations are
only one day away, so you should start preparing ...
Tasks for Tuesday, August 24
Here are two new tasks that require you to write parsers for small languages.
You can, for example, use
uu-parsinglib, the parser combinator library that Doaitse presented
in his lectures.
- Database (medium; performing SQL-like queries on a toy database)
- Arrow (medium; a very simple programming language)
Tasks for Monday, August 23
Here are two new tasks that you can work on next to all the others:
- Profiling (medium; trains heap profiling)
- Unsafe (medium; demonstrates the true evil of
unsafePerformIO)
Tasks for Friday, August 20
Here is one new task involving monads:
Apart from that, either continue with the tasks listed below or work
on your own project.
If you are looking for interesting challenges or inspiration, take a look
at past
ICFP programming contests. These
contests run once every year. In total there are now 13 such problems.
Tasks for Wednesday, August 18 (afternoon lab)
Complete list of tasks available right now, including new ones:
Tasks for Wednesday, August 18 (morning lab)
Here is a new task that is relatively easy, but involves some graphics and IO:
Here are two task descriptions for larger programming projects that I used
for a university course in the past. These are probably too large to be tackled
within the timespan of the course, and definitely too large to take on alone,
but they can serve as an inspiration:
Tasks for Tuesday, August 17 (afternoon lab)
For participants following the A track
You still have time to finish the previous tasks. Apart from that, try to do assignments or
examples from the lectures. Also have a look at QuickCheck. Perhaps you can define
and run QuickCheck properties for one of the functions you have already written?
For participants following the B track
Next to the tasks you have already been given, there are the following options:
- Try to add QuickCheck properties to your solution of MasterMind or Stereograms.
- Try to have a look at Lennart Augustsson's implementation of the lambda calculus (see CourseMaterials).
- Play with Church numerals in Haskell. See below.
Church encodings in Haskell
One way to define Church numerals is (note that this requires the
RankNTypes extension):
data CNat = CNat (forall a. (a -> a) -> a -> a)
Try to implement addition, multiplication and exponentiation. Try to define a function that
converts Church numerals into integers:
cNatToInt :: CNat -> Int
Also define Church Booleans and other Church encodings in the same way.
Tasks for Tuesday, August 17 (morning lab)
For participants following the A track
The task is the same as yesterday. Try to finish the
Lab intro
if you haven't yet finished it. Have a look at the other assignments listed for Monday.
Once you produce some code, make sure that you ask an assistant to look over it and
suggest improvements.
For participants following the B track:
If you have finished the master mind and/or stereograms assignments, make sure you
get a code review.
Tasks for Monday, August 16
For everyone: Primary Goal: Get a working GHC
If you use your own computer, make sure you have the Haskell Platform up and running.
Otherwise, familiarize yourself with the lab computers and make sure you can edit files
and run GHC.
For participants following the A track: Get started
(Participants of the B track, look below.)
Here are a number of simple assignments that do not require a lot of deep Haskell
knowledge:
Also, try some examples from the lecture.
If you feel slightly more adventurous, you can also try the following slightly longer,
but still not very difficult assignments:
You will get more time to work on these assignments tomorrow.
For participants of the B track: Haskell style
Before you jump into more challenging projects, I ask you to tackle one
of the following projects:
With a reasonable amount of Haskell experience, they should not take you
too long. Instead, try to write beautiful, elegant and concise code.
Feel free to deviate from the templates in order to accomplish these goals!
When you
finish, make sure you get your code reviewed by one of the assistants and
explicitly ask for suggestions on how to improve your style.
Note that there is usually no one best solution to a given problem, or a single
best style. Nevertheless, thinking about code quality is an important issue.
If you finish this early, or want to do something else: Try to think about how the
untyped lambda calculus can be embedded into Haskell. Try to write a few
of the programs from the lecture in your embedded language.
--
AndresLoeh - 18 Aug 2010