hasksyn: Haskell Syntax for Vim

During my (ongoing) vim experiment, I found myself missing some of the amenities of haskell-mode for emacs. Namely great syntax highlighting and pretty good indentation. vim2hs looked reasonably nice, but did not handle indentation. It also made scrolling very slow, perhaps because it just does too many fancy things. haskellmode-vim had slightly worse syntax highlighting and was also a bit slow; it also did not have much of an indentation story. In response, I wrote hasksyn, which has both go…

Heresy

Don't tell anyone, but I decided to try to use vim as my primary editor for a week. I have actually used both vim and emacs for years, but I usually only used vim for viewing files and emacs for editing them. This week is vim full time. I like emacs, but it has been doing something annoying that I haven't quite been able to track down. There is some keystroke that is very much like "save file" that I keep hitting that seems to just lock up my emacs window. To recover, I inevitably …

A Hoopl Experience

Introduction I have read about Generalized Algebraic Data Types (GADTs) before, at least as implemented in GHC. The standard type-safe expression evaluator was interesting, but it never left much of an impression on me. Last week, I ran into them in real code for the first time while I was playing with hoopl, a library for representing control-flow graphs and performing dataflow analysis and graph rewriting. The use of GADTs in the hoopl code was enlightening and now I think I have a reasonabl…

Installing llvm-tools

In my last post I neglected to provide installation instructions. For most systems, it should be fairly straightforward: Ensure that dot, llvm-config, ghc, and cabal are in your PATH. The first is provided by the Haskell Platform. The 2012 releases should work. Additionally, ensure that ~/.cabal/bin is in your PATH, since the binaries will be installed there (and it may need to be in your path during the build process, too). Run the following script: REPOSITORIES="hbgl-experimental…

A Handy LLVM Tool (ViewIRGraph)

I realized that I forgot to mention another repository related to my last post: llvm-tools. As the name suggests, this repository contains some useful tools based on my llvm-analysis library. The most interesting tool for people who aren't me is ViewIRGraph, which makes it easy to visualize several interesting program graphs (anything supported by llvm-analysis). The help output gives a reasonable breakdown: ViewIRGraph - View different graphs for LLVM IR modules in a variety of formats U…

Program Analysis with LLVM in Haskell

Introduction I have had the code on github for quite some time, so it seems like I should say something about my LLVM program analysis tools. The primary repository is llvm-analysis, which provides a Haskell interface for analyzing the LLVM IR. The LLVM IR is a high-level assembly language for a virtual machine with infinite registers. This is a virtual machine as in a piece of hardware that does not exist rather than a JVM-style virtual machine that programs run on. LLVM IR is converted dir…

Divide and Conquer with Monad Par

Recently I decided to parallelize part of my set constraint solver ifscs, which I plan to write more about eventually. At one point, the constraint solver has a large set to process where each element is really independent: a prefect situation for simple coarse-grained parallelism. I had a good experience using monad-par at another place in my code, so I decided to try my luck again. After a bit of fooling around, I came up with the following: import Control.DeepSeq import Control.Monad.Par.S…

An Emacs Function for LLVM Assembly

I finally decided to use the power of emacs to automate a task that I perform at least a dozen times per day: converting a snippet of C source code into LLVM IR assembly. The command to do this is simple: clang -emit-llvm -c -o - file.c | opt -S The only annoying part about using the command was finding a spare terminal and finding the input file on the file system (and then remembering where I put that terminal when I wanted to refer to it later). Enter emacs. It took a while to navigate th…

New Phone Time

I have been using a Palm Pre (Plus) for a while. It is a great device; the form factor is excellent with a hardware keyboard and I really like WebOS. Unfortunately, the build quality is not so great so it always felt a bit cheap. Additionally, it was also always kind of on the slow side (it took much longer for it to render HTML than it took to download it, and many other operations were slower still). HP basically killed off WebOS and there is no new hardware on that front, so that basically…

Presentation Software

Lately, I have been making my presentation slides with LaTeX beamer. I use SVGs created with inkscape (and my handy wacom tablet) for most diagrams and the minted package (which eventually calls pygments) for syntax highlighted source code listings. This combination works well and produces very nice PDFs that I can present with evince. Unfortunately, the compile time for a large presentation is excessive and makes incremental updates a bit of a pain. It is also wasteful since I am not using ma…