LoginSignup
25
29

More than 5 years have passed since last update.

VimでHaskellしよう

Last updated at Posted at 2015-09-16

はじめに

手続き型言語やオブジェクト指向言語でも関数型プログラミングっぽい要素が取り入れられるようになってきた昨今、より関数型プログラミングへの理解を深めようと思いHaskellを始めることにしました。

環境は以下の通りです。

  • Mac OS X 10.10.4
  • zsh 5.0.5

Haskellをインストール

下記をインストールします。

$ brew update
$ brew install ghc
$ brew install cabal-install
  • gch (Glasgow Haskell Compiler) 7.10.2
  • cabal (Cabal build system) 1.22.6.0

Vimをアップデート

後述するプラグインの中で、Vimが最新のものでないと動作しないものがあるのでVimをアップーデートします。

$ brew install vim
$ vim --version
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Sep 12 2015 10:18:48)
  • vim 7.4

Haskellの外部コマンドをインストール

Vimのプラグインと合わせて使用する外部コマンドをインストールしておきます。

  • ghc-mod

その前にcabalをアップデートしておきましょう

$ cabal update

ghc-mod

型情報を参照できる外部コマンドです。

$ cabal install ghc-mod

10分ほどかかります。

  • ghc-mod 5.3.0.0

Pathを通す

どうやら下記にインストールされているようなのでPathを通しておきます。

export PATH="$HOME/Library/Haskell/bin:$PATH"

Vimのプラグインをインストールする

.vimrcにプラグインリストを追加します。
NeoBundleを使用します。

NeoBundleFetch 'Shougo/neobundle.vim'
NeoBundle 'Shougo/neocomplcache'
NeoBundle 'Shougo/neosnippet'
NeoBundle 'Shougo/neosnippet-snippets'
NeoBundle 'Shougo/unite.vim'
NeoBundle 'thinca/vim-quickrun'
NeoBundle 'thinca/vim-ref'
NeoBundle 'kana/vim-filetype-haskell'
NeoBundle 'eagletmt/ghcmod-vim'
NeoBundle 'ujihisa/neco-ghc'
NeoBundle 'osyo-manga/vim-watchdogs'
NeoBundle 'ujihisa/ref-hoogle'
NeoBundle 'ujihisa/unite-haskellimport'

VimでNeoBundleInstallします

:NeoBundleInstall

さあはじめよう!

これで快適なHaskellライフが送れると信じて、頑張りましょう!

25
29
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
25
29