Code Monkey home page Code Monkey logo

haskell-ghc-mod's Introduction

haskell-ghc-mod atom package

This package is primarily intended as backend for ide-haskell.

Haskell Ghc-Mod opens pipe to ghc-modi and queries types, info and checks for errors. It uses temporary files to feed them into ghc-mod (since it does not read from stdin)

If ghc-mod/ghc-modi is not in your PATH, set full path to those in config.

Dependencies

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).

Supported ghc-mod versions are from 4.1.0 to 5.2.1.2, and 5.4.x. 5.3.x might work, but is not officially supported.

Quick setup is as follows:

$ cabal update
$ cabal install ghc-mod

After this process finishes, you'll have ghc-mod, ghc-modi and hlint available in $HOME/.cabal/bin/ directory.

Please note, that for ghc>=7.10 and/or cabal>=1.22, you need ghc-mod>=5.3.0.0. Ghc-mod versions before 5.3.0.0 won't work.

User interface is provided by ide-haskell

Installation

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

Configuration

Only configuration options you will likely need to set are ghcModPath and, for ghc-mod<5.4.0.0, ghcModiPath. Both need to be set to full path to ghc-mod and ghc-modi programs respectively, if those are not in your PATH.

Note, that ghc-mod>=5.4.0.0 doesn't use ghcModiPath setting (instead running ghc-mod in interactive mode directly).

There can be some problems with ghc-modi upstream, most notably, it does not work on paths with whitespace. If you experience problems, try disabling ghc-modi by setting enableGhcModi to false (or uncheck tick in settings). This will be slower, but may work better on some configurations.

If you are on OSX, or have ghc installed with non-standard prefix, you may also consider adding path to directory containing ghc/ghci executable to additionalPathDirectories configuration option. It is a comma-separated list of directories that will be added to your search path when invoking ghc-mod. For example, if you have ghc installed to /usr/local, then you would add /usr/local/bin to additionalPathDirectories.

On OSX, if you start Atom from Finder or with desktop icon, it doesn't inherit environment variables specified in your user shell (in .profile, .bashrc, etc). You can copy PATH settings from your shell to additionalPathDirectories, if you'd like to run Atom in this way.

Keybindings

Haskell-ghc-mod 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 haskell-ghc-mod:

'atom-text-editor[data-grammar~="haskell"]':
  '': 'haskell-ghc-mod:check-file'
  '': 'haskell-ghc-mod:lint-file'
  'ctrl-alt-t': 'haskell-ghc-mod:show-type' #this is an example binding
  'ctrl-alt-i': 'haskell-ghc-mod:show-info' #this is an example binding
  'ctrl-alt-T': 'haskell-ghc-mod:insert-type' #this is an example binding
  '': 'haskell-ghc-mod:show-info-fallback-to-type'
  '': 'haskell-ghc-mod:insert-import'

'atom-workspace':
  '': 'haskell-ghc-mod:shutdown-backend'

Service-hub API

Since 1.0.0, haskell-ghc-mod provides haskell-completion-backend service.

NOTE: Prior to 1.0.0, ide-backend service was provided. It has been scrapped in favor of ide-haskell's UPI.

You can find description in completion-backend.coffee

haskell-ghc-mod's People

Contributors

crazymykl avatar lierdakil avatar roughsketch avatar wolftune avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.