ささきしき

チラシ

Haskellやるぞー

奏汰です.
今夏,某海鮮丼屋さんでアルバイトをするために,今からでもHaskellをしっかりお勉強しようと思います.

ということで,まずはインストール覚え書きをば.ぶっちゃけほとんど参考先ママですけども.ええ.
細かいこと分かってないので,かなり冗長的かもしれません.悪しからず.
あ,使用環境はHomebrew on OSX 10.10.3 です.

環境確認

まずはHomebrewのアップデートしときましょう.

$ cd ~
$ brew update
error: Your local changes to the following files would be overwritten by merge:
(略)

error: The following untracked working tree files would be overwritten by merge:
(略)

Please move or remove them before you can merge.
Aborting
Error: Failure while executing:
    git pull -q origin refs/heads/master:refs/remotes/origin/master

は?(威圧)

まま,慌てなさんな慌てなさんな.ここは先生に診てもらいましょうね.

$ brew doctor
Please note that these warnings are just used to help the Homebrew maintainers
with debugging if you file an issue. If everything you use Homebrew for is
working fine: please don't worry and just ignore them. Thanks!

Warning: The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. Some versions of the
"InstantOn" component of Airfoil are known to do this.

You should probably change the ownership and permissions of /usr/local
back to your user account.

Warning: You have uncommitted modifications to Homebrew
If this a surprise to you, then you should stash these modifications.
Stashing returns Homebrew to a pristine state but can be undone
should you later need to do so for some reason.
    cd /usr/local/Library && git stash && git clean -d -f

…えーと,

  • /usr/localパーミッション設定見直し
  • 未コミットのファイル変更があるので,cd /usr/local/Library && git stash && git clean -d -fでリログ

ですね.ありがとう先生.

$ su chmod 775 /usr/local/
$ su cd /usr/local/Library && git stash && git clean -d -f
(略)
$ brew doctor
Your system is ready to brew.
$ brew update
$ cd ~
$ brew install ghc
==> Downloading https://homebrew.bintray.com/bottles/ghc-7.10.1.yosemite.bottle.1.tar.gz
######################################################################## 100.0%
==> Pouring ghc-7.10.1.yosemite.bottle.1.tar.gz
🍺  /usr/local/Cellar/ghc/7.10.1: 5414 files, 821M

よしよし.引き続いて入れていきましょう.

$ brew install cabal-install
==> Downloading https://homebrew.bintray.com/bottles/cabal-install-1.22.2.0.yosemite.bottle.tar.gz
######################################################################## 100.0%
==> Pouring cabal-install-1.22.2.0.yosemite.bottle.tar.gz
==> Caveats
Bash completion has been installed to:
  /usr/local/etc/bash_completion.d
==> Summary
🍺  /usr/local/Cellar/cabal-install/1.22.2.0: 6 files, 19M

$ cabal update
Config file path source is default config file.
Config file /Users/nkgm/.cabal/config not found.
Writing default configuration to /Users/nkgm/.cabal/config
Downloading the latest package list from hackage.haskell.org

$ cabal install cabal-install
(略)
Building cabal-install-1.22.4.0...
Installed cabal-install-1.22.4.0

よーし終わり.GHCi立ち上げてみましょう.

$ ghci
GHCi, version 7.10.1: http://www.haskell.org/ghc/  :? for help
ghci> 1+1
2
ghci> :quit
Leaving GHCi.

やったぜ.

参考

qiita.com