DarkMatter in Cyberspace
  • Home
  • Categories
  • Tags
  • Archives

Setup Haskell Develop Environment in Atom


IDE-Haskell is a good choice for haskell editor.

Installation

$ cabal update
$ cabal install ghc-mod stylish-haskell
$ ghc-mod --version
ghc-mod version 5.5.0.0 compiled by GHC 7.10.2

Download Atom 1.5 (atom-amd64.deb), install it with sudo dpkg -i atom-amd64.deb, and run:

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

Open Atom, Ctrl-Shift-P, open "View Installed Packages", click "Settings" of haskell-ghc-mod, input full path of ghc-mod and ghc-modi in "Ghc Mod Path" and "Ghc Modi Path", here "/home/leo/.cabal/bin/ghc-mod" and "/home/leo/.cabal/bin/ghc-modi".

Click "Settings" of ide-haskell, input full path of stylish-haskell in "Stylish Haskell Path", here it's "/home/leo/.cabal/bin/stylish-haskell".

Restart Atom, open a folder contains haskell .hs files to use ide-haskell.

GHCi in Atom

Click "Settings" of ide-haskell-repl, set "Command Args" to "ghci", and "Command Path" to "/usr/bin/stack", when you use stack. (This works fine in Atom 1.5). Set "Command Args" to "repl", and "Command Path" to "/home/leo/.local/bin/cabal", when you use cabal. (This doesn't work in Atom 1.5).

To load chapter 2 of "Learning Haskell Data Analysis" into ide-haskell-repl, you must install required libraries with stack:

stack install csv HDBC sqlite HDBC-sqlite3

Then open file "LearningDataAnalysis02.hs" in Atom, click [Haskell IDE -> Open REPL] in main menu, now module "LearningDataAnalysis02" is loaded into ghci. Input parseCSVFromFile "all_week.csv" in repl box, press Shift+Enter to evluate it.

See all keybindings in "Keybindings" of ide-haskell-repl in Atom package settings.

Discussion

Ensure ghc-mod version > 5.4. Do NOT install it with apt-get, because its version is 3.x. See https://github.com/atom-haskell/haskell-ghc-mod#configuration for details.

If you only install stack instead of cabal, you can install Haskell package with stack install ghc-mod stylish-haskell.



Published

Mar 4, 2016

Last Updated

Mar 4, 2016

Category

Tech

Tags

  • atom 2
  • haskell 11

Contact

  • Powered by Pelican. Theme: Elegant by Talha Mansoor