Liskell at the International Lisp Conference 2007, Cambridge, UK Thu May 17 20:05:30 CEST 2007

It's been over a month since I returned from Cambridge and still I have not found time to blog an epilogue for this trip.

First, here is the material: Liskell presentation-ILC 2007.mov.torrent. This is a screencast of my talk at the International Lisp Conference 2007; one of the two presentations I have given in Cambridge. Notice that this talk was prepared for a Lisp audience, so my job was to highlight the features of Haskell. The other talk in Cambridge was at Microsoft Research and I plan to make this talk available in a similar style (but with the objective to sell Lisp ideas to a Haskell audience).

A few remarks:

  • The implementation of cond as defmacro is a pedagogical code mock-up. It operates on the wrong data structure. The Liskell paper has a correct implementation of cond as defmacro.
  • There are a few errors in the codec stream for qtrle. For some reasons, my recent sync with ffmpeg subversion HEAD caused this trouble. There are only 3-4 errors, and they are usually corrected in a few seconds with the next P frame in the stream.
  • Levelator rox. I spent about 2 hours finding suitable settings for mastering my voice track in Audacity with no useful results at all. The first try with Levelator was a perfect mastering. Lovely.
  • The liskell-mode you see in this video is just a tiny minor mode wrapping haskell-mode with scheme indention. A video on how to set up this development environment is also on my todo list. Grab liskell-mode.el.
Audio and video recordings of the original session are available. But unfortunately, the video is incomplete and the quality is insufficient for reading anything from the projection, also the background noise of the audio recording is quite high. I recommend to download the screencast above. The slides and source code files are available here.

And finally a few photos in my semi-private flickr stream.


Posted by clemens | Permalink | Categories: Liskell

liskell.org Mon May 14 13:47:47 CEST 2007

Liskell — my favorite Lisp+Haskell pet — has a new website, namely http://liskell.org. There you will find a new branch of Liskell based on GHC-6.6 and a new Liskell development mailing list liskell-devel@liskell.org.


Posted by clemens | Permalink | Categories: Liskell

Liskell docs, finally Thu Feb 22 14:23:26 CET 2007

As the ACM SIGPLAN template gave my Latex document much more space, I decided — instead of writing a separate piece of documentation — to enrich my ILC07 submission with more interesting chapters about meta-programming and the Liskell prelude. This paper is much richer in content as the original (about half the content is new) and it finally starts to explain the mechanisms behind defmacro and how you can use them in the Haskell/Liskell world. So if you are interested in Liskell, the revised paper certainly deserves a second look.


Posted by clemens | Permalink | Categories: Liskell

Pattern guards in Liskell Tue Feb 13 13:21:07 CET 2007

Yes, I'm working on documentation this very moment, but after seeing A missing Haskell feature on Planet Haskell, I was unable to resist. I need my daily dosage of coding.

Here is working Liskell syntax sugar for pattern guards as described by Neil Mitchell.

(defmacro (~= pts)
  `(let (((comp ,pts) True)
         ((comp _) False))
     comp))
It can be used right-away as in:
(all (~= Star _) ([] (Star "x") (Atom)))       -> False
(all (~= Star _) ([] (Star "x") (Star "foo"))) -> True
To give you a brief idea why this works: The function body of defmacro is called with a list (called pts) that is bound to ([] (PSym "Star") (PSym "_")) which is equivalent to [PSym "Star", PSym "_"] written in Haskell syntax. This parse tree part is substituted into the backquoted code template at ,pts, resulting in the parse tree:
(let (((comp (Star _) True))          | let comp (Star _) = True 
      ((comp _)       False))         |     comp _        = False
  comp)                               | in comp
The Haskell equivalent of the generated Liskell parse tree is shown on the right hand side for our Planet Haskell readers. This generated parse tree is the result of the compile-time "~=" macro transformation, and instead of the original (~= Star _) expression the generated parse tree is compiled to object code.

You can compile Star.lsk with "ghc Star.lsk -o Star -main-is Star -package LskPrelude".

(For those who already have a local Liskell branch, please pull the latest changes and redo ./darcs-all get. I moved the LskPrelude into a separate new core package. Also I vastly simplified the parse tree type, so the Liskell paper is not correct anymore wrt this.)


Posted by clemens | Permalink | Categories: Liskell

Macros for Haskell? Done. Wed Jan 31 14:41:00 CET 2007

Why is Lisp special? Because of macros. This changes today.

For the last three month, I have been working on Liskell, a language extension for GHC. Some people might be tempted to call it a new language because of documents talking about language definition. But in fact, it is just a new dress for something we already embosomed: Haskell.

Liskell brings symbolic expression (aka Lisp syntax) to Haskell. This is no Lisp interpreter written in Haskell, but GHC itself becomes the part that processes Lisp like syntax. After parsing, the Liskell extension transforms this sexp parse tree into a regular Haskell parse tree, as it would result from any regular Haskell file. From then it takes the regular path through type inference, desugaring, compiling core. So, if there was not another important thing, this would just be a new syntax for Haskell.

Within Liskell, we get parse tree transformers, a generalization of macros. Before the conversion to the Haskell parse tree takes place, you are free to do any arbitrary manipulation to the Lisp-styled parse tree of sexps by injecting your own parse tree transformers into the compiler. The possibilities with such a facility ranges from minor syntactic sugar transformations such as field syntax, 'deriving' syntax or another do-notation expansion, to more grave extensions to Liskell, such as embedded sub-languages. An example for the latter is my embedded Prolog version, that can be seen in a little appetizer (Flash Video, 99mb, direct, torrent (preferred). To play mplayer, for Windows especially: FLV Player.).

The official page is http://clemens.endorphin.org/liskell. The material I release for the moment is my darcs repository of GHC containing Liskell and a modified testsuite containing a small set of regression tests and the Liskell Prelude. The Liskell Prelude defines a lot of syntax sugar, so this might be the first place to look for reasonable first-steps examples into meta-programming. But before jumping into meta-programming, you might want to look at the basic language first. The Liskell page contains a draft for a Liskell paper submitted for ILC07 and it also features a 15 minute tour of Liskell syntax.

How fast the documentation grows, depends on the community reaction and your feedback. For the moment, please be content with the basics, I hope to introduce you to meta-programming in a more systematic way next week.


Posted by clemens | Permalink | Categories: Liskell