Rotating Header Image

Literate Haskell and C

Fun little fact that came up today in #haskell on IRC. You can have haskell code and C code in the same file (actually, you can do this with any language that allows multiline comments).

/* c and lhs file

> module Foo where
> main = print "Haskell"


int main() {
return 0;

Be Sociable, Share!

One Comment

  1. Miles says:

    Indeed: that was one of the techniques Jerome Quelin used for his famous four-language Perl Golf entry a few years ago. And here’s an eight-language version he wrote later!

Leave a Reply

Your email address will not be published. Required fields are marked *


You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>