Atom Packages Directory

a package directory for a text editor of the 21st Century

Ide Haskell

Install with:
    apm install ide-haskell
  

IDE-Haskell

Welcome to IDE-Haskell plugin for amazing Atom editor! This plugin is intended to help you with development in Haskell.

NOTE: You must install all this plugin’s dependencies in addition to installing this plugin. Jump to the Requirements section below and follow all setup instructions.

Implemented features

Haskell project autodetection

IDE-Haskell works only with Haskell projects. When you open a Haskell source file, IDE-Haskell will start automatically.

Errors, warnings and linter

After saving the current file the check and linter processes will be executed. After processes are finished, the results can be seen in output panel. You can see different kind of results by switching Errors, Warnings and Lints tab buttons. If you click on message’s file name in output panel, Atom will open this file and put cursor near problem that triggered output message.

Check results can also be seen in left editor gutter (near line numbers) as icons. If you hover mouse pointer over such an icon, a tooltip will be shown with problem description. Results are highlighted inside editor as well, so you can easily determine where the problem is.

errors

Get type/info

If you have haskell-ghc-mod or similar package installed, you can get type of any expression and get info on any symbol.

There are two options to do so.

First one is to hover mouse pointer over any Haskell source in editor, or any selection. By default, this will show type for expression/selecton under cursor. You can change this behavior to show info for symbol, or disable it completely in IDE-Haskell settings.

Another option is to use keyboard to get type/info under cursor. No default bindings are specified, but you can specify them in your Atom keymap.

See Configuration for more information.

typeinfo

typeins

Autocompletion

Autocompletion facilities have been moved to autocomplete-haskell package.

Please install it if you want autocompletion.

Code beautify

You can use stylish-haskell utility to indent pragmas, imports and data type definitions. Simply select Prettify from Haskel IDE menu to apply stylish-haskell to current file.

prettify

Build and test project

If you have ide-haskell-cabal or similar package installed, you can build, clean and test your project from ide-haskell (stack and cabal supported)

Requirements

The ide-haskell plugin assumes that you have a minimal Haskell toolchain installed on your system. You can install this toolchain by following the instructions here:

Atom plugin dependencies:

Only the language-haskell plugin is strictly required, but you will probably also want to install one of these other plugins as well:

Binary dependencies:

Installing binary dependencies with stack

The most reliable way to build these executable binaries is to use stack install.

Run the following commands from a command line terminal after you finish installing the minimal Haskell toolchain:

bash $ stack install stylish-haskell ... Copied executables to {STACK_INSTALL_PATH}: - stylish-haskell $ stack install ghc-mod ... Copied executables to {STACK_INSTALL_PATH}: - ghc-mod - ghc-modi $ stack install hlint ... Copied executables to {STACK_INSTALL_PATH}: - hlint

… where STACK_INSTALL_PATH depends on your operating system. For example, on OS X or Linux this path will usually be ~/.local/bin/.

First, make sure that STACK_INSTALL_PATH is on your executable search path (i.e. $PATH for OS X and Linux). However, this alone might not be enough for Atom to find your installed executables since Atom in some cases Atom does not correctly pick up the search path upon launch.

If Atom fails to find a required executable (such as stylish-haskell) you will get an error that reads something like this:

Ide-haskell could not spawn stylish-haskell

Error: spawn stylish-haskell ENOENT

If this happens, you will need to modify this package’s settings to point to the absolute path to where you installed stylish-haskell executable. For example, if your STACK_INSTALL_PATH were /home/johndoe/.local/bin/ then the absolute path to the executable would be /home/johndoe/.local/bin/stylish-haskell.

Installing binary dependencies with cabal

NOTE: You do not need to do this if you already installed with stack.

Alternatively, you can use cabal-install if you don’t want to use stack for some reason.

It is advisable to first create a cabal sandbox for the installation to avoid global package database pollution and conflicts. This will also make updating easy.

To create a sandbox, create a directory, f.ex.

bash mkdir $HOME/ghc-mod-sandbox

NOTE: Windows command line shell uses different syntax for environment variables, and there is usually no HOME defined anyway. I sincerely hope you can figure this out.

Then, cd into int:

bash cd $HOME/ghc-mod-sandbox

And run the following command

bash cabal sandbox init --sandbox=.

The last --sandbox=. part is to simplify paths.

Now you can install ghc-mod and stylish-haskell. In the same directory run

bash cabal install ghc-mod stylish-haskell Note: hlint will be pulled in as ghc-mod dependency.

Now you have ghc-mod and stylish-haskell installed. Binary files are in $HOME/ghc-mod-sandbox/bin. You can add this path to PATH, or put full path to executables in relevant ide-haskell and haskell-ghc-mod settings.

Don’t forget to replace $HOME with actual path to home directory for the latter option. On Linux, you can run

bash echo $HOME/ghc-mod-sandbox/bin/*

in the terminal to get actual paths to all executables, if not sure what those should look like. NOTE: Bear in mind this trick probably won’t work on Windows.

For example, assuming your HOME is /home/user:

Known conflicts

This package relies on grammar defined by language-haskell. Any other Haskell grammar packages (such as haskell-grammar) may conflict with it.

Installation

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

Configuration

Package is fully configurable via Edit → Preferences → Packages → ide-haskell → Settings

You will likely need to specify full paths to stylish-haskell, if it is not in your PATH, at the very least.

You might also want to look into configuring haskell-ghc-mod (haskell-ghc-mod README) and ide-haskell-cabal (ide-haskell-cabal README)

NOTE: Since version 1.0.0, some configuration options have been moved to backends, in particular, haskell-ghc-mod. Migration should be automatic, but please check if your configuration is correct just in case.

Keyboard shortcuts

NOTE: Since version 1.0.0, most commands are provided by backends, in particular, haskell-ghc-mod and ide-haskell-cabal. Please revise your keymap accordingly. Refer to (haskell-ghc-mod README) and (ide-haskell-cabal README) for details

Ide-Haskell comes with little pre-specified keybindings, so you will need to specify your own, if you want those.

You can edit Atom keybindings by opening ‘Edit → Open Your Keymap’. Here is a template for all commands, provided by ide-haskell:

```cson ‘atom-text-editor[data-grammar~=”haskell”]’: ‘escape’: ‘ide-haskell:close-tooltip’ #this is set by default ‘’:’ide-haskell:prettify-file’ ‘’:’ide-haskell:next-error’ ‘’:’ide-haskell:prev-error’

‘atom-text-editor[data-grammar~=”cabal”]’: ‘’: ‘ide-haskell:prettify-file’

‘atom-workspace’: ‘’: ‘ide-haskell:toggle-output’ ```

Changing output panel look

Changing output panel look can be achieved with Atom stylesheets. You can open your stylesheet with Edit → Stylesheet…

Syntax is Less. You can use the following selectors:

Please note, that to change font face in ide-haskell-item-description, you need to target it specifically, or use !important specifier.

For example, to change font size in whole panel:

less ide-haskell-panel { font-size: 18pt; }

Or only in output area:

less ide-haskell-panel-items { font-size: 18pt; }

To change font face in panel heading:

less ide-haskell-panel-heading { font-family: "Comic Sans MS"; }

To change font face in messages themselves:

less ide-haskell-item-description { font-family: "Fira Mono"; }

You are free to write any CSS, of course. Bear in mind, however, that any selectors not listed above are subject to sudden change.

API

Ide-haskell provides service-hub API with ide-haskell-upi service.

More information is available in lib/upi.coffee source file

TODO

Changelog

Changelog is available here.

IRC Chat

You can join #atom-haskell on FreeNode, and devs can usually be found there. Bear in mind that if someone’s on the channel, it doesn’t necessarily mean they aren’t AFK.

If you’re not familiar with IRC, you can use FreeNode’s webchat

License

Copyright © 2015 Alexander Chaika, Nikolay Yakimov

Contributors: * John Quigley * Ondřej Janošík * Luka Horvat * Gabriel Gonzalez * Daniel Beskin * Gabor Greif * Daniel Gröber

See the LICENSE.md for details.

Keywords: ide-haskell, ide, haskell Suggest keywords
Fork me on GitHub