Skip to main content

Posts

Showing posts from January, 2007

Macros for Haskell? Done.

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 know: 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...

hoogle.el

Here is a short emacs helper for Haskell coders. It allows you to hoogle lookup the symbol currently under your cursor. Drop hoogle.el into your ~/(x)emacs dir, and add (require 'hoogle) (define-key haskell-mode-map [?\C-c ?h] 'hoogle-lookup) to your init.el . For educational purposes, here is the function that does all the (pretty-simple) magic. (defun hoogle-lookup (p) (interactive "p") (let ((symbol-name (thing-at-point 'symbol))) (unless (and (= 1 p) (stringp symbol-name)) (setq symbol-name (read-from-minibuffer "Hoogle lookup name: " "" nil nil 'hoogle-history))) (browse-url (concat hoogle-url-base symbol-name))))