Practical Haskell: scripting with types

I had the pleasure to give a new talk today, on design in functional programming — types, abstractions and monads — using the motivating example of scripting. The slides are below and a PDF version is available.

Shell scripts are often a quick, dirty way to get the job done. You glue
together external tools, maybe do a little error checking and process all data
as strings. This is great for some very simple problems but as requirements
change and more is demanded from the code shell scripts become unwieldy and
fragile. When they get large, they become slow and difficult to maintain. If
you need to write robust code then shell is not the way to go.

In this talk at an alternative: how to use Haskell as a type checked and
natively compiled language for scripting tasks. By refining the semantics of
the problem domain, employing abstraction, we produce shorter and more robust
code, that is more maintainable and scalable.

Evaluation strategies and synchronization: things to watch for

A talk presented at the weekly Galois Developer Symposium.

The source of the talk and examples are all online.

This talk shows two areas relating to evaluation strategies in Haskell, and how they can subtly interact with threads, synchronization and performance. In addition, we briefly look at the interaction with asynchronous exceptions.

In particular,

  • Be careful with lazy values in synchronization variables
  • Consider using the strict-concurrency package for synchronization
  • All modify* functions should be very very carefully used
  • Interactions between async exceptions (e.g. block/killThread) and threads need expert eyes.