Go to file
Julian Ospald 54ac5e6594
Raise minimum cabal-helper version
2018-06-15 15:16:09 +02:00
3rdparty Add latest cabal-helper 2018-06-15 15:15:45 +02:00
GhcMod/Exe Compatibility with GHC 8.2.1 2017-08-19 17:51:27 -04:00
bench Reorganize module namespace 2017-05-28 04:23:37 +02:00
core Add missing LICENSE file 2018-06-15 15:15:27 +02:00
doc Update MELPA URL 2015-11-01 13:57:14 +00:00
elisp Bump version to 5.8.0.0 2017-05-26 22:42:04 +02:00
scripts scripts: Add GHC 8.4 ci image 2018-04-24 01:13:13 +02:00
shelltest Change slogan 2017-03-07 00:25:46 +01:00
src Reorganize module namespace 2017-05-28 04:23:37 +02:00
test Disable doctest magic 2018-02-10 15:00:27 +01:00
test-elisp adding test cases for elisp. 2014-04-23 14:51:02 +09:00
.ghci .ghci for ghci-friendliness (testing) 2012-01-22 20:16:22 -08:00
.gitignore Gitingore test project stack.yaml 2016-08-28 23:19:12 +03:00
.gitlab-ci.yml ci: Upgrade to cabal new-build 2018-02-10 22:34:14 +01:00
.gitmodules Add latest cabal-helper 2018-06-15 15:15:45 +02:00
.travis.yml [Travis] Add doctest 2016-08-09 15:06:24 +03:00
COPYING.AGPL3 Change primary license to AGPL-3 2015-03-03 21:09:18 +01:00
COPYING.BSD3 Change primary license to AGPL-3 2015-03-03 21:09:18 +01:00
ChangeLog Add preliminary ChangeLog entry for 5.9 release 2017-12-29 06:33:30 +01:00
CodingStyle adding CodingStyle. 2014-08-12 15:00:56 +09:00
GhcMod.hs Reorganize module namespace 2017-05-28 04:23:37 +02:00
LICENSE Add back LICENSE file pointing to COPYING.* 2015-03-05 17:35:29 +01:00
README.md Some changes to the README for ease of reading. 2017-07-10 10:24:14 +02:00
Setup.hs Remove runhaskell shebang from Setup.hs 2017-10-16 15:33:56 +02:00
cabal.project Move the core functionality into new package ghc-mod-core 2018-02-10 11:23:20 +02:00
ghc-mod.cabal Raise minimum cabal-helper version 2018-06-15 15:16:09 +02:00
ghcmodHappyHaskellProgram-Dg.tex Update HCAR entry 2015-10-29 23:43:02 +01:00

README.md

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.

Overview

Using ghc-mod in your Development Environment

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

  • The ghc-mod program included in the package of the same name, see Installing
  • A ghc-mod frontend to integrate it into your development environment, see Frontend

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: https://github.com/DanielG/ghc-mod/issues

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.

IRC

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.