Subscribed unsubscribe Subscribe Subscribe

Haskell GHCインストール

Scalaを勉強しなおすために、まずHaskellを勉強してからの方がScalaを理解しやすいという話を聞いたので、Haskellの勉強を始めることにしました。ということでまずはHaskellコンパイラGHC(The Glasgow Haskell Compiler)をインストールしました。yumであっさりインストールできてしまいました。

# yum install ghc
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.iij.ad.jp
 * epel: ftp.tsukuba.wide.ad.jp
 * extras: ftp.iij.ad.jp
 * remi: rpms.famillecollet.com
 * updates: ftp.iij.ad.jp
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package ghc.x86_64 0:6.10.4-3.el5 set to be updated
--> Processing Dependency: gmp-devel for package: ghc
--> Processing Dependency: libgmp.so.3()(64bit) for package: ghc
--> Running transaction check
---> Package gmp.x86_64 0:4.1.4-10.el5 set to be updated
---> Package gmp-devel.x86_64 0:4.1.4-10.el5 set to be updated
--> Finished Dependency Resolution

Dependencies Resolved

========================================================================================================================
 Package                      Arch                      Version                           Repository               Size
========================================================================================================================
Installing:
 ghc                          x86_64                    6.10.4-3.el5                      epel                     43 M
Installing for dependencies:
 gmp                          x86_64                    4.1.4-10.el5                      base                    201 k
 gmp-devel                    x86_64                    4.1.4-10.el5                      base                    569 k

Transaction Summary
========================================================================================================================
Install       3 Package(s)
Upgrade       0 Package(s)

Total download size: 44 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): gmp-4.1.4-10.el5.x86_64.rpm                                                               | 201 kB     00:00
(2/3): gmp-devel-4.1.4-10.el5.x86_64.rpm                                                         | 569 kB     00:00
(3/3): ghc-6.10.4-3.el5.x86_64.rpm                                                               |  43 MB     00:07
------------------------------------------------------------------------------------------------------------------------
Total                                                                                   5.5 MB/s |  44 MB     00:08
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing     : gmp                                                                                              1/3
  Installing     : gmp-devel                                                                                        2/3
  Installing     : ghc                                                                                              3/3

Installed:
  ghc.x86_64 0:6.10.4-3.el5

Dependency Installed:
  gmp.x86_64 0:4.1.4-10.el5                               gmp-devel.x86_64 0:4.1.4-10.el5

Complete!

コマンドが存在することを確認します。

# which ghci
/usr/bin/ghci
# which ghc
/usr/bin/ghc

バージョンの確認。

# ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.10.4

対話モードで起動してみます。

# ghci
GHCi, version 6.10.4: http://www.haskell.org/ghc/  :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer ... linking ... done.
Loading package base ... linking ... done.
Prelude>
Prelude> :q
Leaving GHCi.
#

ひとまずコンパイラのインストールは問題なくできたようです。