神刀安全网

Intero (Haskell Development Environment) for Emacs

Intero for Emacs

Complete interactive development program for Haskell

“I just tried this and it works. It just works. I have never had this experience with Haskell + Emacs. Thank you so much for this.”

Install package

Use Emacs’s built in package manager. Add the following to your .emacs :

;; If you don't have MELPA in your package archives: (require 'package) (add-to-list   'package-archives   '("melpa" . "http://melpa.org/packages/") t) (package-initialize) (package-refresh-contents)  ;; Install Intero (package-install 'intero) (add-hook 'haskell-mode-hook 'intero-mode)

Modern and backwards compatible

Tested on GHC 8.0.1, GHC 7.10.3, GHC 7.10.2, and GHC 7.8.4.

Backwards compatibility will be maintained as far back as is possible.

General backend

The Intero backend used by the Emacs mode is a fork of GHCi, it behaves like your old friend GHCi, but with more features.

Support for other editors is not promised, but patches are welcome.

Designed for Stack

Intero works best with Stack. Tested on a variety of Hackage projects, internal client projects, from small to huge.

If your project works with Stack, it almost definitely works with Intero.

Intero (Haskell Development Environment) for Emacs

Automatically installing

The Emacs mode automatically installs the proper Intero backend program in your stack environment. Not globally!

Each Stack project can have a separate GHC or LTS version, Intero takes care of this by installing a fresh copy in each LTS version.

After installing, it automatically boots up Intero and starts checking the current file.

Intero (Haskell Development Environment) for Emacs

On the fly type checking

Intero works with and configures the marvelous Flycheck package out of the box. Giving check as-you-type, on a keybinding of your change, and/or on save.

Errors can be seen by going to the location of the error, or by hitting C-c ! l to see a list of errors.

One can also jump to errors: C-c ! n for next error, C-c ! p for previous error.

Intero (Haskell Development Environment) for Emacs

Easy target switching

Working on the test suite now? Just hit M-x intero-targets and enter a stack target.

In the example on the right, the target is weigh:test:weigh-test , but we can write :weigh-test for short because it’s unambiguous.

Intero restarts with those targets configured, and re-runs the flychecker. Everything is now good to go!

There will be interactive completion for targets in the future.

Intero (Haskell Development Environment) for Emacs

Completion as you type

Intero works with the Company package out of the box. Auto-complete as-you-type is based on identifiers that are locally defined in the declaration, in the module, or imported within the module.

Continues to remember its completions through type errors. In the future, completion will be type-driven.

Intero (Haskell Development Environment) for Emacs

Jump to definition

After a module has been type checked, you can jump to the definition of any locally defined or imported identifier.

Uses the standard Emacs keybinding for jumping, M-. . Remembers locations even when a module no longer compiles.

Intero (Haskell Development Environment) for Emacs

Type of selection

You can hit C-c C-t to display the type of the identifier at point, or select any text to see the type.

Remembers type information even when a module no longer compiles.

Intero (Haskell Development Environment) for Emacs

Next steps

What are you waiting for? Give it a try.

转载本站任何文章请注明:转载至神刀安全网,谢谢神刀安全网 » Intero (Haskell Development Environment) for Emacs

分享到:更多 ()

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址