BSD-3-Clause licensed by Neil Mitchell, jpmoresmau
Maintained by Neil Mitchell
This version can be pinned in stack with:ghcid-0.3.6@sha256:3a403a6f170cbec00720138692973989a06bd52b2abc4144d52133275be01f09,3009

Module documentation for 0.3.6

ghcid Hackage version Build Status

Either “GHCi as a daemon” or “GHC + a bit of an IDE”. To a first approximation, it opens ghci and runs :reload whenever your source code changes, formatting the output to fit a fixed height console. Unlike other Haskell development tools, ghcid is intended to be incredibly simple. In particular, it doesn’t integrate with any editors, doesn’t depend on GHC the library and doesn’t start web servers.

Acknowledgements: This project incorporates significant work from JPMoresmau, who is listed as a co-author.

Using it

Run cabal update && cabal install ghcid to install it as normal. Then run ghcid --height=8 --topmost "--command=ghci Main.hs". The height is the number of lines you are going to resize your console window to (defaults to height of the console). The topmost is to make the window sit above all others, which only works on Windows. The command is how you start your project in ghci. If you omit --command then it will default to ghci if you have a .ghci file in the current directory, otherwise it will default to cabal repl.

Personally, I always create a .ghci file at the root of all my projects, which usually reads something like:

:set -fwarn-unused-binds -fwarn-unused-imports
:set -isrc
:load Main

After that, resize your console and make it so you can see it while working in your editor. On Windows the console will automatically sit on top of all other windows. On Linux, you probably want to use your window manager to make it topmost or use a tiling window manager.

What you get

On every save you’ll see a list of the errors and warnings in your project. It uses ghci under the hood, so even relatively large projects should update their status pretty quickly. As an example:

Main.hs:23:10:
    Not in scope: `verbosit'
    Perhaps you meant `verbosity' (imported from System.Console.CmdArgs)
Util.hs:18:1: Warning: Defined but not used: `foo'

Or, if everything is good, you see:

All good

Please report any bugs you find.

FAQ

  • This isn’t as good as full IDE. I’ve gone for simplicity over features. It’s a point in the design space, but not necessarily the best point in the design space for you. For “real” IDEs see the Haskell wiki.
  • If I delete a file and put it back it gets stuck. Yes, that’s a bug in GHCi. If you see GHCi getting confused just kill ghcid and start it again.

Changes

Changelog for GHCiD

0.3.6
#24, don't error out if error/putStrLn are not imported
0.3.5
#19, put errors in bold
#9, display interesting information in the title bar
#7, reload if the .ghci or .cabal file changes
Use nubOrd
Require extra-1.1
0.3.4
#21, if you aren't waiting for any files, exit
0.3.3
#21, if the root file is missing, report an error
#20, avoid an O(n^2) nub
0.3.2
#18, reformat excessively long lines, add a --width flag
0.3.1
Ensure if there are lots of warnings, the first error gets shown
0.3
#11, ignore certain GHCi-only warnings
#13, fix version printing
#8, display Loading... when starting
Require the extra library
#14, figure out the terminal height automatically
0.2
#6, rewrite as a library
Remove duplicate error messages from cabal repl
0.1.3
#2, handle files that get deleted while loaded
#3, flesh out the test suite
#4, give a polite error if ghci does not start
#5, add --topmost flag to make the window topmost
0.1.2
Add a very simple test suite
Default to cabal repl if there is no .ghci file
#1, if there is an IOError just :reload
Say why you are reloading
0.1.1
Support arguments to --command
0.1
Initial version