Magic Haskell code completions in Vim!

7/05/2011

UPDATE: This project is on hold for now. Many people have pointed out that the snipMate VIM plugin can probably handle many of these completions. I may make a collection of those at some point, but I no longer have much interest in finishing this.

I’m trying something new: putting code-in-progress up on github while I work on it. So! I love haskell so freaking much I’ve started creating a vimscript to improve the typeability of the language in the vim editor, and the working name is: haskomplete.vim

The script looks at the context of your cursor and fills in stuff when you type CTRL-H. For instance, this:

func1, func2

becomes…

func1, func2 :: ^
func1 = undefined
func2 = undefined

…with the cursor positioned where I show the carat.

Check out the README.md on github for installation details.

I’ve only implemented a few of my planned completions so far. I’ll give another shout when it’s more complete.

In the meantime please send me a pull request with bug fixes, your own awesome completions, etc. or just tell me how much you think you might love it. I would love if this became something of a community project.

4 Comments

PEZ: the Potentially-Excellent Zipper library release

19/04/2011

I’m happy to announce the release of a zipper library I named PEZ! I’ve been learning and building this silly library almost as long as I’ve been learning haskell. It’s not as great as it could be, but I’m releasing it now because it’s about time.

You can check it out with a:

cabal install pez

The library provides a generic zipper that can be used on all types in the Typeable class, for which the user defines (or generates) lenses from the excellent fclabels package.

Since Typeable instances are deriveable in GHC and fclabels lenses can be generated with a line of TH code, this makes for a very pain-free and intuitive zipper.

The Typeable class gives us the ability to move up and down through complex mutually-recursive structures, even “down through” reversible computations!

The lenses from ‘fclabels’ give us a way of referring to elements in data types in a way that is composable, allowing us to store our history as continuations and provide powerful mechanisms for “saving” a path through a data structure.

There is more to do: in particular I haven’t yet examined any of the performance characteristics of the approach I take, but please try it out and let me know how it works for you!

No Comments

New version of directory-tree on hackage

13/02/2011

In response to a request and my own review I’ve modified my directory-tree package as follows:

0.10.0

  • Eq and Ord instances now compare on free “contents” type variable
  • we provide `equalShape` function for comparison of shape and filenames
    of arbitrary trees (ignoring free “contents” variable)
  • provide a comparingShape used in sortDirShape
  • provide a `sortDirShape` function that sorts a tree, taking into
    account the free file “contents” data

Now that equality and comparison functions that ignore the contents of Files are out of the Eq and Ord instances, we can make those types of comparisons on DirTrees of different types.

You can pick it up with a

$ cabal install directory-tree

No Comments