FP-Syd, April 2013


The April 2013 meeting of the FP-Syd group had presentations about GPU programming with Accelerate and little languages using the Free data structure. Posted by Thomas Sutton on April 24, 2013

Trevor McDonell gave a presentation about the Accelerate Haskell library, which provides an EDSL for writing code which is compiled and executed on the GPU.

The approach involves using an EDSL to write CUDA code in a Haskell program. This is generates code to be compiled and shipped to the GPU at run time. Being Haskell, there’s a bunch of nice types involved: matrices have shapes, matrix and scalar programs/fragments are of different types, and there are a few of typeclasses.

Trevor demonstrated a brute-force MD5 collision finder written with Accelerate which was very impressive.

Mark Hibberd spoke about interpreters and little languages with the Free package. Essentially, this boiled down to using Free with its functor and monad instances to replace an API full of IO a typed operations, each of them possibly unsafe, with a nice monadic EDSL and a single IO interpreter function.

The various operations in the API no longer “do” the operation but build up a data structure describing the operations to be performed as a little data structure (essentially an AST) which the client code passes to an evaluation function.

The more advanced theory categories and groups and left adjoint functors and such left me behind, but his running example of a password manager library (to generate, store and retrieve passwords) very illuminated the practical side of using this technique. I’m quite looking forward to Jed Wesley-Smith’s YOW! Lambda Jam talk about a similar topic: Connection Management, FP Style: A Case Study.

This post was published on April 24, 2013 and last modified on January 26, 2024. It is tagged with: event, haskell, monads, gpu, functional programming, user group, fp-syd, meetup.