[Haskell-cafe] Open-source projects for beginning Haskell students?

Heinrich Apfelmus apfelmus at quantentunnel.de
Sat Mar 17 16:01:22 CET 2012

Brent Yorgey wrote:
> I am currently teaching a half-credit introductory Haskell class for
> undergraduates.  This is the second time I've taught it.  The last
> time, for their final project I gave them the option of contributing
> to an open-source project; a couple groups took me up on it and I
> think it ended up being a modest success.
> So I'd like to do it again this time around, and am looking for
> particular projects I can suggest to them.  Do you have an open-source
> project with a few well-specified tasks that a relative beginner (see
> below) could reasonably make a contribution towards in the space of
> about four weeks? I'm aware that most tasks don't fit that profile,
> but even complex projects usually have a few "simple-ish" tasks that
> haven't yet been done just because "no one has gotten around to it
> yet".

Finding a suitable project seems tricky to me as most "real-world" 
projects usually involve at least one nasty corner like interfacing with 
a C library, which is usually too hard for someone who just became 
comfortable with the traditional list origami.

With that caveat, I do have a small task that may be suitable and that 
is useful to me in the context of my reactive-banana library and my yet 
undisclosed tomato-rubato project.

The task is to implement a small audio synthesizer in Haskell. Of 
course, implementing high-performance audio synthesis is too challenging 
a task for a Haskell beginner, but there is one particular approach that 
I would like to see performance measurements of.

More specifically, the idea is the following:
1a. Implement a handful of combinators for generating audio as a lazy 
list of samples

     type Audio = [Sample]

1b. Get it out of the speakers. (I can find a library for that.) This 
will be slooow.
2. Implement the same handful of combinators for a different 
representation, namely a lazy list of memory blocks with 64 samples each

     type Block = Data.Vector.Vector  -- 64 samples
     type Audio = [Block]

In other words, each block is filled in an aggressively optimized inner 
loop while the blocks are shuffled around with ordinary Haskell functions.
3. Do performance measurements on 2 and test whether it can be run in 

So, the task does involve an external library and some knowledge about 
GHC's optimization, but hopefully nothing too fancy.

How is this task useful for me? If the performance is good enough, I can 
replace the lazy lists with  Event / Behavior  from reactive-banana , 
giving a real-time audio synthesizer in the style of functional reactive 
programming. If it doesn't work out, then the students had a fun project 
to work on, which is just as well.

Best regards,
Heinrich Apfelmus


More information about the Haskell-Cafe mailing list