Inside 206-105

Existential Pontification and Generalized Abstract Digressions

June, 2010

Call and fun: marshalling redux

This part six of a six part introduction to c2hs. We finally talk about what ostensibly is the point of c2hs: calling C functions from Haskell. c2hs, due to its knowledge of the C headers, can already do the work for generating FFI imports. The call hook simply tells c2hs to generate the FFI import, […]

  • June 30, 2010

Thinking about talk

This one's for the MIT crowd. I will unfortunately not be in Boston over IAP, so I won't be able to do a redux of the class I taught last year, Advanced Typeclasses in Haskell. However, since I will be in Boston for September, it might be a good time to do cluedump for SIPB […]

  • June 28, 2010

Marshalling with get and set

This part five of a six part introduction to c2hs. Today, we explain how to marshal data to and from C structures. An important note. There is a difference between struct foo and foo; c2hs only considers the latter a type, so you may need to add some typedefs of the form typedef struct foo […]

  • June 25, 2010

First steps in c2hs

This is part four of a six part tutorial series on c2hs. Today we discuss the simple things in c2hs, namely the type, enum, pointer, import and context directives. Prior art. All of the directives c2hs supports are tersely described in the “tutorial” page (which would perhaps be more accurately described as a “reference manual”, […]

  • June 23, 2010

The secret to successful autogenerated docs

I've had a rather successful tenure with autogenerated documentation, both as a writer and a reader. So when Jacob Kaplan Moss's articles on writing “great documentation” resurfaced on Reddit and had some harsh words about auto-generated documentation, I sat back a moment and thought about why autogenerated documentation leave developers with a bad taste in […]

  • June 21, 2010

Principles of FFI API design

This is part three of a six part tutorial series on c2hs. Today, we take a step back from the nitty gritty details of FFI bindings and talk about more general design principles for your library. On the one hand, writing an FFI binding can little more than churning out the glue code to let […]

  • June 18, 2010

Well-founded recursion in Agda

Last Tuesday, Eric Mertens gave the Galois tech talk Introducing Well-Founded Recursion. I have to admit, most of this went over my head the first time I heard it. Here are some notes that I ended up writing for myself as I stepped through the code again. I suggest reading the slides first to get […]

  • June 16, 2010

Setting up Cabal, the FFI and c2hs

This part two of a six part introduction to c2hs. Today, we discuss getting the damn thing to compile in the first place. Reader prerequisites. You should know how to write, configure and build a vanilla Cabal file for pure Haskell. Fortunately, with cabal init, this is easier than ever. I'll talk about how to […]

  • June 14, 2010

The Haskell Preprocessor Hierarchy

This post is part of what I hope will be a multi-part tutorial/cookbook series on using c2hs (Hackage). The Haskell Preprocessor Hierarchy (this post) Setting up Cabal, the FFI and c2hs Principles of FFI API design First steps in c2hs Marshalling with get an set Call and fun: marshalling redux What's c2hs? c2hs is a […]

  • June 11, 2010

Static Analysis for everyday (not-PhD) man

Bjarne Stroustrup once boasted, "C++ is a multi-paradigm programming language that supports Object-Oriented and other useful styles of programming. If what you are looking for is something that forces you to do things in exactly one way, C++ isn't it." But as Taras Glek wryly notes, most of the static analysis and coding standards for […]

  • June 9, 2010