Advanced Functional Programming Problem 1

John Hughes & Magnus Carlsson

The Problem

Your assignment is to write a Haskell program for searching a database containing a list of papers. The user should be able to search for papers by a given author, with a particular string in the title, or with a particular keyword. By giving a sequence of queries, the user should be able to gradually narrow down the set of papers selected. You should provide an undo operation to reverse the effect of the last query. The user should be able to view the list of papers currently selected, and to request more detailed information about any individual paper. Your program should have a graphical user interface, implemented using the fudgets library. The user interface should show not only the selected papers, but also the sequence of queries applied.

Once your program is working you should analyse its memory use using the heap profiler, and consider whether you can improve its space behaviour.

Sample Data

You may use any sample data you wish, as long as there is enough to make searching it meaningful! However, for your convenience there is a sample list of papers, and a much shorter list in the same format. (These files contain a list of 200 rather old papers in John's office!) An advantage of this sample data is that it is very easily parsed. Each file contains one paper record per line, and the fields of each record are separated by dollar signs. For example, the first record is

implem effici function array sml $0$Annika Aasa and \
Christina Nilsson$How to implement efficient functional \
arrays in SML$PMG draft paper 1986$
(where we have inserted line breaks preceded by back-slashes to fit it on the page). All records contain the same fields: Notice that the keywords are stored as stems: for example, both `programs' and `programming' have the same stem (`program'). Searching for keyword stems will enable your program to find papers that match the user's query, except for grammatical form.

Information Sources

Haskell Programming

You have a choice of Haskell tutorials available. If you would like to try some smaller Haskell exercises first, look at these get-you-started Hugs exercises.

The Fudget Library

A good command to remember is fudhelp. It tells you about other commands, like fudscape, which starts Netscape at the fudget home page ( http://www.cs.chalmers.se/Fudgets). From there, you can find the online reference manual. For information on a particular function or type you can also use the command fudgrep (which runs grep on all the module interfaces in the fudget library). fudgrep is particularly useful when you try to track down type errors.

It can be a little hard to find the fudget you need using the manual. You might find the following fudgets and stream processors useful: stringF, inputDoneSP, readFileF, moreF, inputPopupF, pickListF, and filePickF.

Here is a much simpler fudget exercise, for practice.

A Stemming Algorithm

There is a module Stem defining a function stem which converts English words to their stems here.

Learning Goals

The purpose of this problem is to learn about:

Report

This project is intended to take two weeks. Solutions must be reported by Monday 8th November.

You will report your solution at a meeting with me. I will want to see:

Collaboration

You may either hand in individual solutions, or collaborate within your group.