/emacs-module

Wrappers around emacs-module.h to write Emacs modules in Haskell

Primary LanguageHaskellOtherNOASSERTION

A Haskell package for writing Emacs modules

https://img.shields.io/badge/license-BSD_3-green.svg?dummy https://travis-ci.org/sergv/emacs-module.svg?branch=master

Why would anyone want to write Emacs modules in Haskell?

Emacs Lisp is not a young language and can go quite a long way, but it has a couple of issues that are not going to be solved any time soon:

  • It’s dynamically typed which makes refactoring large extensions a pain
  • It’s intepreted and is quite slow. It might be argued that editors don’t need much computing power, but from time to time computation-intensive tasks to occur. For example, fuzzy matching provided by the cool flx.el package and used by great ivy.el package to quickly find things.
  • Somewhat related to the previous point, there’s virtually no support for parallelising computataions. There’re adavances on adding threads to Emacs lisp, but this only provides concurrency, but no parallelism.

Haskell is well known for solving points 1 and 3 outlined above. For me it also solves point 2 by providing enough performance and adding parallelism on top of it.

If you think this might be a good idea and would like to see what this package can do for you, you can look at part of my emacs config that uses this package to implement things like

  • Rewrite of flx.el that leverages parallelism
  • Fast search across filesystem
  • Concurrrent grep reimplementation (yeah, it’s dubious since things like ripgrep exist)

FAQ

How do I start writing my own extensions?

Some day there will be a proper tutorial for using this package. For the time being the best place to start is this package’s tests.

What about Windows?

No out-of-the-box Windows support due to Cabal not being able to build a dll from foreign-library specification in a cabal file. But dll can be built by hand using vanilla ghc.

Supported GHC versions

Tested with GHC 8.0.2, 8.2.2, 8.4.2.