Place where sepulci live
25 August 2012 | Tags: haskell, emacs
haskell-mode is amazing piece of software but unfortunately it lacks documentation which describe available features. Without it only way to discover such features is to look into source code. This is time consuming process although rewarding. I describe here things I found in the current git. Some of functions are not imported by default so module where they defined should be imported manually.
Jumping to import list to add/remove/tweak something is very frequent activity. Finding import is not that difficult they are always in the beginning of the file. Real problem is find place on which you worked before. Functions haskell-navigate-imports
and haskell-navigate-imports-return
fix that problem. First cycle though import list and second return you to place where you were before.
They are not binded to any key so one have to add them using hook. here is my choice of bindings:
(require 'haskell-navigate-imports)
(add-hook-list 'haskell-mode-hook (lambda () (
(local-set-key (kbd "M-[") 'haskell-navigate-imports)
(local-set-key (kbd "M-]") 'haskell-navigate-imports-return)))
Another very useful feature is quick adding/removing SCC (Set Cost Centre) annotations which are often necessary to get accurate profiling information. While -auto-all
option annotate every top level declaration itβs not always enough.
Just as their names suggest function haskell-mode-insert-scc-at-point
and haskell-mode-kill-scc-at-point
insert and remove SCC pragmas without tiresome typing. Of course they work best when binded to some key chain.
Last item in the list is function for changing indentation of complete code blocks. Here is example of indenting where block by two spaces:
This functionality provided by haskell-move-nested
. This function is not binded to anything too nor could used interactively with M-x
. Here are bindings suggested by documentation: