ghc-mod: Happy Haskell Hacking

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain] [Publish]

ghc-mod is a backend program to enrich Haskell programming in editors. It strives to offer most of the features one has come to expect from modern IDEs in any editor. ghc-mod provides a library for other haskell programs to use as well as a standalone program for easy editor integration. All of the fundamental functionality of the frontend program can be accessed through the library however many implementation details are hidden and if you want to significantly extend ghc-mod you should submit these changes upstream instead of implementing them on top of the library.

[Skip to Readme]


Versions 0.1.0, 0.2.0, 0.3.0, 0.4.0, 0.4.1, 0.4.2, 0.4.3, 0.4.4, 0.5.1, 0.5.2, 0.5.3, 0.5.4, 0.5.5, 0.6.0, 0.6.1, 0.6.2, 1.0.0, 1.0.1, 1.0.2, 1.0.3, 1.0.4, 1.0.5, 1.0.6, 1.0.7, 1.0.8, 1.10.0, 1.10.1, 1.10.2, 1.10.3, 1.10.4, 1.10.5, 1.10.6, 1.10.7, 1.10.8, 1.10.9, 1.10.10, 1.10.11, 1.10.12, 1.10.13, 1.10.14, 1.10.15, 1.10.16, 1.10.17, 1.10.18, 1.11.0, 1.11.1, 1.11.2, 1.11.3, 1.11.4, 1.11.5, 1.12.0, 1.12.1, 1.12.2, 1.12.3, 1.12.4, 1.12.5, 2.0.0, 2.0.1, 2.0.2, 2.0.3, 2.1.0, 2.1.1, 2.1.2, 3.0.0, 3.0.1, 3.0.2, 3.1.0, 3.1.1, 3.1.2, 3.1.3, 3.1.4, 3.1.5, 3.1.6, 3.1.7, 4.0.0, 4.0.1, 4.0.2, 4.1.0, 4.1.1, 4.1.2, 4.1.3, 4.1.4, 4.1.5, 4.1.6, 5.0.0, 5.0.1,,,,,,,,,,,,,,,,,
Change log ChangeLog
Dependencies base (>= && <4.11), binary, bytestring, cabal-helper (>= && <0.9), containers, deepseq, directory, djinn-ghc (>= && <0.1), extra (>=1.4 && <1.6), fclabels (>=2.0 && <2.1), filepath, ghc (>=7.8 && <8.4), ghc-boot, ghc-mod, ghc-paths (>= && <0.2), ghc-syb-utils (>=0.2.3 && <0.3), haskell-src-exts (>=1.18 && <1.20), hlint (>=2.0.8 && <2.1), monad-control (>=1 && <1.1), monad-journal (>=0.4 && <0.8), mtl, old-time, optparse-applicative (>= && <0.14), pipes (>=4.1 && <4.4), process, safe (>=0.3.9 && <0.4), semigroups (>=0.10.0 && <0.19), split (>=0.2.2 && <0.3), syb (>=0.5.1 && <0.8), template-haskell, temporary (>= && <1.3), text (>= && <1.3), time, transformers, transformers-base (>=0.4.4 && <0.5) [details]
License AGPL-3.0-only[multiple license files]
Author Kazu Yamamoto <>, Daniel Gröber <>, Alejandro Serrano <>, Nikolay Yakimov <>
Maintainer Daniel Gröber <>
Category GHC, Development
Home page
Source repo head: git clone
Uploaded by DanielG at 2018-01-22T00:23:21Z



Manual Flags


Enable/disable shelltest test-suite


Use -f <flag> to enable a flag, or -f -<flag> to disable that flag. More info


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees

Readme for ghc-mod-

[back to package description]

ghc-mod: Happy Haskell Hacking

build status

ghc-mod provides editors/IDEs with support for Haskell compiler features. It supports both Cabal and Stack based projects and integrations exist for Emacs, Vim, Atom, IntelliJ and VSCode.


Using ghc-mod in your Development Environment

To use ghc-mod in your development environment of choice you need two things:

Using ghc-mod as an IDE Backend Program

We provide two modes of operation for frontends: interactive and single shot mode. The former is accessed by calling $ ghc-mod legacy-interactive. This will sit and wait for you to type a command, exiting when an empty line is entered. Interactive mode is pretty much always faster than single shot mode, since it gives ghc-mod the ability to cache the compiler session between commands. On the other hand, it needs more memory because it keeps these things cached.

Single shot mode is pretty much only there for (backwards) compatibility with Vim, since it only recently got the ability to talk to background processes without installing some external plugin. You can use single shot mode by simply calling the sub-commands of the ghc-mod program. Since recompiling large projects can be really, really slow, you really should prefer interactive mode.

As a rule of thumb, all commands available in single shot mode are available in interactive mode. A list of the former can be obtained by running $ ghc-mod --help.

If you're developing a new ghc-mod frontend, we'd love to hear from you! Please open an issue or e-mail the maintainer. Also, we invite you to add installation and configuration instructions to Frontend.

Using ghc-mod as a Library

Internally, ghc-mod uses the Glasgow Haskell Compiler's API to implement most of its functionality.

In order to provide a hassle-free experience to users, ghc-mod tries hard to automatically, and correctly, detect and, if necessary, tweak the environment GHC needs. It also handles some of the more cumbersome parts of getting a working compiler session up and running.

This functionality can be very useful to all kinds of Haskell development tools. Therefore, we want to expose all the useful abstractions ghc-mod provides.

Right now the ghc-mod API is pretty messy; a result of major internal rewrite and reorganization coupled with too little time for cleanups over the course of almost 100 releases! We would like to make a cut during v6.0 or so and completely redo the API, but we need more input from downstream tool writers to do that properly, see Library API Redesign.

For example, The Haskell Refactorer (HaRe) uses the build environment abstraction ghc-mod provides so it can concentrate on its core functionality instead of worrying about build environments and compiler session setup.

Recently the haskell-ide-engine project has sprung up, and if you're planning to write any kind of tool that needs editor integration eventually you should definitely look into that. haskell-ide-engine uses ghc-mod at its core, so you'll want to be familliar with it either way.

API "documentation" is here: Hackage docs.

Reporting Bugs

Please report bugs on the GitHub issue tracker for ghc-mod:

Including general environment information like the operating system (distribution, version) you're using and the output of $ ghc-mod debug run in your project directory is probably a good idea.


If you have any problems, suggestions, comments swing by #ghc-mod (web client) on Freenode. If you're reporting a bug please also create an issue here (GitHub issue tracker) so we have a way to contact you if you don't have time to stay.

Do hang around for a while if no one answers, and repeat your question if you still haven't gotten any answer after a day or so (the maintainer was probably asleep). You're most likely to get an answer during the day in GMT+1.