コードの整理とプロジェクトのビルド Monad型クラス QuickCheckを使ったプロパティテスト 新しいプロジェクトを開始する
入門Haskellプログラミング (Will Kurt(著)、株式会社クイープ(監修、翻訳)、翔泳社)のUNIT6(コードの整理とプロジェクトのビルド)、LESSON36(QuickCheckを使ったプロパティテスト)、36.1(新しいプロジェクトを開始する)、クイックチェック 37-1の解答を求めてみる。
コード
src/Lib.hs
module Lib where
-- module Lib
-- ( someFunc,
-- )
-- where
someFunc :: IO ()
someFunc = putStrLn "someFunc"
入出力結果(Terminal, Zsh)
% stack setup
stack will use a sandboxed GHC it installed
For more information on paths, see 'stack path' and 'stack exec env'
To use this GHC and packages outside of a project, consider using:
stack ghc, stack ghci, stack runghc, or stack exec
% stack build
Building all executables for `palindrome-testing' once. After a successful build of all of them, only specified executables will be rebuilt.
palindrome-testing> configure (lib + exe)
Configuring palindrome-testing-0.1.0.0...
palindrome-testing> build (lib + exe)
Preprocessing library for palindrome-testing-0.1.0.0..
Building library for palindrome-testing-0.1.0.0..
[1 of 2] Compiling Lib
[2 of 2] Compiling Paths_palindrome_testing
Preprocessing executable 'palindrome-testing-exe' for palindrome-testing-0.1.0.0..
Building executable 'palindrome-testing-exe' for palindrome-testing-0.1.0.0..
[1 of 2] Compiling Main
[2 of 2] Compiling Paths_palindrome_testing
Linking .stack-work/dist/x86_64-osx/Cabal-3.2.1.0/build/palindrome-testing-exe/palindrome-testing-exe ...
palindrome-testing> copy/register
Installing library in /Users/…/palindrome-testing/.stack-work/install/x86_64-osx/160203b3c1b5851ee38cefff1898f2ea31f9dd27504c585eee0da67dd7dc8bb2/8.10.7/lib/x86_64-osx-ghc-8.10.7/palindrome-testing-0.1.0.0-ArexdrWdtZoJlI5LW2VA53
Installing executable palindrome-testing-exe in /Users/…/palindrome-testing/.stack-work/install/x86_64-osx/160203b3c1b5851ee38cefff1898f2ea31f9dd27504c585eee0da67dd7dc8bb2/8.10.7/bin
Registering library for palindrome-testing-0.1.0.0..
% stack exec palindrome-testing-exe
someFunc
%