Haskellを使用するための準備 - Haskellとのやり取り:GHCI
入門Haskellプログラミング (Will Kurt(著)、株式会社クイープ(監修、翻訳)、翔泳社)の LESSON 1(Haskellを使用するための準備)、1.3(Haskellとのやり取り:GHCI)、クイックチェック1-2の解答を求めてみる。
コード
main = do
print "Hello kamimura!"
入出力結果(Terminal, Zsh)
% ghci hello.hs
GHCi, version 9.4.8: https://www.haskell.org/ghc/ :? for help
macro 'doc' overwrites builtin command. Use ':def!' to overwrite.
(0.00 secs, 0 bytes)
(0.00 secs, 0 bytes)
Loaded GHCi configuration from /Users/kamimura/.ghc/ghci.conf
[1 of 2] Compiling Main ( hello.hs, interpreted )
Ok, one module loaded.
(0.01 secs,)
*Main
λ> main
"Hello kamimura!"
it :: ()
(0.01 secs, 88,312 bytes)
*Main
λ> :q
Leaving GHCi.
% ghci
GHCi, version 9.4.8: https://www.haskell.org/ghc/ :? for help
macro 'doc' overwrites builtin command. Use ':def!' to overwrite.
(0.00 secs, 0 bytes)
(0.00 secs, 0 bytes)
Loaded GHCi configuration from /Users/kamimura/.ghc/ghci.conf
Prelude
λ> :l hello
[1 of 2] Compiling Main ( hello.hs, interpreted )
Ok, one module loaded.
(0.02 secs,)
*Main
λ> main
"Hello kamimura!"
it :: ()
(0.01 secs, 81,760 bytes)
*Main
λ> :l hello.hs
[1 of 2] Compiling Main ( hello.hs, interpreted )
Ok, one module loaded.
(0.00 secs,)
*Main
λ> main
"Hello kamimura!"
it :: ()
(0.00 secs, 78,496 bytes)
*Main
λ> :load hello
[1 of 2] Compiling Main ( hello.hs, interpreted )
Ok, one module loaded.
(0.01 secs,)
*Main
λ> main
"Hello kamimura!"
it :: ()
(0.00 secs, 78,496 bytes)
*Main
λ> :l hello.hs
[1 of 2] Compiling Main ( hello.hs, interpreted )
Ok, one module loaded.
(0.00 secs,)
*Main
λ> main
"Hello kamimura!"
it :: ()
(0.00 secs, 78,496 bytes)
*Main
λ> :quit
Leaving GHCi.
%