Installing Atom + Haskell extensions: an experiment

By Beerend Lauwers

I wanted to see how easy it would be to install the recommended Haskell plugins on Atom, using Stack.

This is not a tutorial or how-to. Your best bet for getting a working ghc-mod with Stack on Windows is:


Googling for “Atom Haskell” gives me this plugin: ide-haskell

From the page:

To install:

apm install language-haskell haskell-ghc-mod ide-haskell-cabal ide-haskell autocomplete-haskell

Attempt via bash shell

In git bash:

$ ./apm install language-haskell haskell-ghc-mod ide-haskell-cabal ide-haskell autocomplete-haskell
Installing language-haskell to C:\Users\blauwers\.atom\packages failed

language-haskell@1.4.12 postinstall C:\Users\blauwers\AppData\Local\Temp\apm-install-dir-115106-7516-4i9g01\node_modules\language-haskell
coffee src/

npm WARN addRemoteGit Error: Command failed:
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:658:15)
npm WARN addRemoteGit     at ChildProcess.emit (events.js:98:17)
npm WARN addRemoteGit     at maybeClose (child_process.js:766:16)
npm WARN addRemoteGit     at Socket.<anonymous> (child_process.js:979:11)
npm WARN addRemoteGit     at Socket.emit (events.js:95:17)
npm WARN addRemoteGit     at Pipe.close (net.js:466:12)
npm WARN addRemoteGit  git:// resetting remote C:\Users\blauwers\.atom\.apm\_git-remotes\git-github-com-michaelficarra-cscodegen-git-79ca3b9e because of error: { [Error: Command failed: ] killed: false, code: 1, signal: null }
npm ERR! git clone --template=C:\Users\blauwers\.atom\.apm\_git-remotes\_templates --mirror git:// C:\Users\blauwers\.atom\.apm\_git-remotes\git-github-com-michaelficarra-cscodegen-git-79ca3b9e: Cloning into bare repository 'C:\Users\blauwers\.atom\.apm\_git-remotes\git-github-com-michaelficarra-cscodegen-git-79ca3b9e'...
npm ERR! git clone --template=C:\Users\blauwers\.atom\.apm\_git-remotes\_templates --mirror git:// C:\Users\blauwers\.atom\.apm\_git-remotes\git-github-com-michaelficarra-cscodegen-git-79ca3b9e: fatal: unable to connect to
npm ERR! git clone --template=C:\Users\blauwers\.atom\.apm\_git-remotes\_templates --mirror git:// C:\Users\blauwers\.atom\.apm\_git-remotes\git-github-com-michaelficarra-cscodegen-git-79ca3b9e:[0:]: errno=No error
npm WARN optional dep failed, continuing cscodegen@git://
'coffee' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Users\\blauwers\\AppData\\Local\\atom\\app-1.1.0\\resources\\app\\apm\\bin\\node.exe" "C:\\Users\\blauwers\\AppData\\Local\\atom\\app-1.1.0\\resources\\app\\apm\\node_modules\\npm\\bin\\npm-cli.js" "--globalconfig" "C:\\Users\\blauwers\\.atom\\.apm\\.apmrc" "--userconfig" "C:\\Users\\blauwers\\.atom\\.apmrc" "install" "C:\\Users\\blauwers\\AppData\\Local\\Temp\\d-115106-7516-1e496pn\\package.tgz" "--target=0.30.7" "--arch=ia32" "--msvs_version=2012"
npm ERR! node v0.10.40
npm ERR! npm  v2.13.3

npm ERR! language-haskell@1.4.12 postinstall: `coffee src/`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the language-haskell@1.4.12 postinstall script 'coffee src/'.
npm ERR! This is most likely a problem with the language-haskell package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     coffee src/
npm ERR! You can get their info via:
npm ERR!     npm owner ls language-haskell
npm ERR! There is likely additional logging output above.

Woo. Okay, let’s try via Atom itself.

Via Atom GUI




Ok, that installed properly.




Oh dear. Googling gives me this: Github issue: install failed

Did you install it?


haskell-ghc-mod says:

You need to have ghc-mod, ghc-modi (part of Ghc-Mod) and hlint executables installed on your system. ghc-mod needs to be able to find hlint (eiter add hlint directory to PATH, or install both in the same cabal sandbox).

Okay, let’s build it via Stack:

Windows shell:

C:\Users\blauwers\AppData\Local\atom\bin>stack install ghc-mod
Run from outside a project, using implicit global config
Using resolver: lts-2.21 from global config file: C:\Users\blauwers\AppData\Roam
Caching build plan
Continuing despite missing tool: msys2
Setting codepage to UTF-8 (65001) to ensure correct output from GHC
Progress: 0/54
Completed all 54 actions.
Installation path C:\Users\blauwers\AppData\Roaming\local\bin\ not found in PATH environment variable
Copying from C:\Users\blauwers\AppData\Roaming\stack\snapshots\i386-windows\lts-2.21\7.8.4\bin\ghc-mod.exe 
    to C:\Users\blauwers\AppData\Roaming\local\bin\ghc-mod.exe
Copying from C:\Users\blauwers\AppData\Roaming\stack\snapshots\i386-windows\lts-2.21\7.8.4\bin\ghc-modi.exe 
    to C:\Users\blauwers\AppData\Roaming\local\bin\ghc-modi.exe

Copied executables to C:\Users\blauwers\AppData\Roaming\local\bin\:
- ghc-modi.exe
- ghc-mod.exe


Okay, I have to add that path to my PATH environment variable. Let’s test:

C:\Users\blauwers>ghc-mod --version
ghc-mod version compiled by GHC 7.8.4

NG BUG: user interrupt


Looks good! Atom still gives me those error messages, though, so let’s restart.

Okay, I get the green after a restart:

haskell-ghc-mod runs!

haskell-ghc-mod runs!


Installed without a hitch.




Same! I’m surprised.

Trying it out

I loaded up the code branch of the repository that generates this website in Atom as a project. After selecting site.hs, I get… Not much. A message that tells me the editor isn’t responding.

Let’s see if there are any known issues:

There can be some problems with ghc-modi upstream, most notably, it does not work on paths with whitespace.

Ah. Disabling it in the settings and restarting the plugin does seem to allow site.hs to load:

haskell-ghc-mod user error (ghc not found)

haskell-ghc-mod user error (ghc not found)


stack path tells me:

ghc-paths: C:\Users\blauwers\AppData\Local\Programs\stack\i386-windows

None of the bin folders of the GHC’s there are in my path, so more path pollution is in order!

Ok, having added GHC to my path and restarting Atom, I get these messages:



Here’s the error message:

launching operating system process cabal configure failed: cabal: readProcessWithExitCode: does not exist (No such file or directory)

Googling around gives me these results:


I think the best course of action is to nuke it all and start with a more recent version of ghc-mod, seeing as Stack support was only introduced in 5.4. I’ll revisit this another time.