Wednesday, August 31, 2011

New slides and how I made them

New slides

I've posted PDFs of slides from some talks I gave a while ago.

First-Class Concurrency in Haskell covers topics in concurrent imperative programming, such as:

This turned out to be far too much material for a one-hour talk, so the slides are probably more valuable than the talk itself. I'm also thinking of expanding the π-calculus bits into a proper blog post at some point.

High-level FFI in Haskell covers tricks for making bindings to C libraries that feel more like native Haskell libraries. Most of the examples are drawn from my hdis86 library . This includes:

  • Translating C types to idiomatic Haskell types

  • Passing Haskell functions as C function pointers

  • Passing ByteStrings as C buffers

  • Automatic locking and memory management of library state

  • Exposing a C library's state machine as a lazy pure function

  • Bundling a C library with Cabal while also allowing dynamic linking

These slides were available before, in a somewhat strange HTML format. The new PDFs are more portable and I think they look nicer, too.

How I made the slides

I originally wrote the slides in Markdown format and converted them to a S5 slideshow using pandoc. This was a great way to quickly prepare slides, including syntax-highlighted Haskell code. However I ran into a few limitations:

  • Slide layout depends on window size and screen resolution, rendering my obsessive tweaking useless. In some cases the text would run off the edge of the screen or overlap other elements.

  • The slides don't work at all in Chromium, as of the S5 version I used initially. I also got reports of issues with other browsers.

I wanted to switch over to Beamer, as I'd seen some very high-quality slides produced using that package. This would also provide a PDF that renders exactly the same on every machine. Fortunately, pandoc can output LaTeX code suitable for Beamer. I can keep using the lightweight syntax of Markdown, and most of my old slide source code works as-is. Once again pandoc handles a tricky problem with ease.

I followed this scheme with a few modifications. For example, pdflatex was unhappy with slides ("frames") containing verbatim text environments. The solution was to declare all frames as "fragile", whatever that means:


Recent versions of pandoc accept the --listings option and will use the LaTeX listings package to render nicely-formatted source code. This article was helpful for configuring listings. The default Haskell style has a rather odd definition of what counts as a keyword, so I wrote a custom language definition. I ended up with this LaTeX header, which you can pass to pandoc using -H:


otherkeywords={.., ::, |, <-, ->, @, ~, =, =>},
case, class, data, default, deriving, do, else,
foreign, if, import, in, infix, infixl, infixr,
instance, let, module, newtype, of, then, type,
where, _, forall, ccall },


The Markdown sources for the slides are available: 1, 2.

My biggest remaining complaint is that I have a lot of explicit spacing commands, e.g. \vspace{1em}. These are used for logical grouping, and so can't be fully inferred, but maybe there's a better (partial?) solution.


  1. Nice article, thanks for the information. It's very complete information. I will bookmark for next reference
    jaring futsal | jaring golf | jaring pengaman proyek |
    jaring pengaman bangunan | jaring pengaman gedung

  2. HP printer support 24*7 at HP help number for printer connection and driver issues. HP printer repair and setup ... printer technical support.

  3. Packers and Movers Bangalore - Reliable and Verified Household Shifting Service Providers Give Reasonable ###Packers and Movers Charges. Cheap and Best Office Relocation Compare Quotation for Assurance for Local and Domestic House Shifting and Get estimates today to save upto 20%, ***Read Customer Reviews - @ Packers And Movers Bangalore

  4. Get Shifting/Relocation Quotation from ###Packers and Movers Delhi. Packers and Movers Delhi 100% Affordable and Reliable ***Household Shifting Services. Compare Transportation Charges and Save Time, Verified and Trusted Packers and Movers in Delhi, Cheap and Safe Local, Domestic House Shifting @ Packers And Movers Delhi

  5. I enjoyed over read your blog post. Your blog have nice information, I got good ideas from this amazing blog. I am always searching like this type blog post. I hope I will see again @ Packers and Movers Ahmedabad

  6. Packers and Movers Chennai Give Safe and Reliable ***Household Shifting Services in Chennai with Reasonable ###Packers and Movers Price Quotation. We Provide Household Shifting, Office Relocation, ✔✔✔ Local and Domestic Transportation Services, Affordable and Reliable Shifting Service Charges @ Packers And Movers Chennai

  7. Packers and Movers Pune Provide High Quality ***Household Shifting, Home/Office Relocation, Insurance, Packing, Locading, ###Car Transportation Service Pune and High experiences, Top Rated, Safe and Reliable, Best and Secure Packers and Movers Pune Team List. Get ✔✔✔ Affordable Rate Charts and Compare Quotation and Save Money and Time .
    Packers And Movers Pune

  8. The students will be able to check their UP Board Result for Class 12 via SMS also. The UP Board 12th Result 2021 would comprise the student's roll UP Board 12th Result 2021 Around 25 lakh students will be able to check their UP Board Result 2021 Class 12 for the UP 12th examination which will be conducted in April and May 2021.


  9. تعد الحشرات أصغر الكائنات الحية على سطح الأرض، وتتعدد أنواعها،وأشكالها منها ما هو سام،ومنا ما هو مألوف،كذلك توجد حشرات ذات فائدة وضرر في نفس الوقت؛حيث يبلغ عدد فصائل الحشرات نحو ثلاثين مليون فصيلة،ولا شك أن مكافحة الحشرات تحتاج إلى دراية بكل أنواع الحشرات،وذلك للتعرف على درجة خطورتها على الإنسان والأهم من ذلك طرق مكافحتها.

    شركة مكافحة حشرات بالمدينة المنورة

    الحمام هو النوع الأكثر شيوعًا من فئة طيور الآفات، وهو يسبب مجموعة متنوعة من المشاكل في جميع أنواع المباني، في المناطق الحضرية ، من المطارات إلى منشآت التصنيع ومحطات توليد الطاقة وأسطح المتاجر والمكاتب والمنازل
    كما ان الحمام يتكاثر وجوده في فصل الشتاء و في فصل الصيف مما يجعلنا في حاجة إلى مكافحتة لذلك يتم تركيب طارد حمام المدينة مع افضل شركات تنظيف مخلفات الحمام والطيور وتركيب أفضل أنواع شبك طوارد الحمام

    شركة مكافحة الحمام بالمدينة المنورة

    نظافة المنزل تعتبر نظافة المنزل عاملاً أساسياً للصحة الجسدية والعقلية لأفرادها ، ولأن النظافة هي أساس الوقاية من الأمراض الناتجة عن تراكم الأوساخ والبكتيريا وتعكس صورة ونمط حياة صاحب المنزل ، تحتاج كل أسرة إلى إنشاء نظام للحفاظ على جميع تفاصيل المنزل والبقاء على اتصال مع جميع أفراد الأسرة

    شركة تنظيف شقق بالمدينة المنورة

  10. Thanks for sharing such a valuable information.Im very thankful to you that you had given me this opportunity to write on this blog.please visit our website I assure you that it will be very useful for @ Packers And Movers Bangalore

    Packers And Movers Bangalore to Pune
    Packers And Movers Bangalore to Chennai
    Packers And Movers Bangalore to Noida
    Packers And Movers Bangalore to Mumbai