コードの整理とプロジェクトのビルド QuickCheckを使ったプロパティテスト さまざまな種類のテスト stack, ghci
入門Haskellプログラミング (Will Kurt(著)、株式会社クイープ(監修、翻訳)、翔泳社)のUNIT6(コードの整理とプロジェクトのビルド)、LESSON 36(QuickCheckを使ったプロパティテスト)、36.2(さまざまな種類のテスト)、クイックチェック 36-2の解答を求めてみる。
入出力結果(Terminal, Zsh)
% stack ghci
Using main module: 1. Package `palindrome-testing' component palindrome-testing:exe:palindrome-testing-exe with main-is file: /Users/…/palindrome-testing/app/Main.hs
The following GHC options are incompatible with GHCi and have not been passed to it: -threaded
Configuring GHCi with the following packages: palindrome-testing
* * * * * * * *
Warning: Multiple files use the same module name:
* Paths_palindrome_testing found at the following paths
* /Users/…/palindrome-testing/.stack-work/dist/x86_64-osx/Cabal-3.4.1.0/build/autogen/Paths_palindrome_testing.hs (palindrome-testing:lib)
* /Users/…/palindrome-testing/.stack-work/dist/x86_64-osx/Cabal-3.4.1.0/build/palindrome-testing-exe/autogen/Paths_palindrome_testing.hs (palindrome-testing:exe:palindrome-testing-exe)
* * * * * * * *
GHCi, version 9.0.2: 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/…/.ghc/ghci.conf
[1 of 3] Compiling Lib ( /Users/…/palindrome-testing/src/Lib.hs, interpreted )
/Users/…/palindrome-testing/src/Lib.hs:1:1: warning: [-Wmissing-export-lists]
The export item ‘module Lib’ is missing an export list
|
1 | module Lib where
| ^
[2 of 3] Compiling Main ( /Users/…/palindrome-testing/app/Main.hs, interpreted )
/Users/…/palindrome-testing/app/Main.hs:3:1: warning: [-Wunused-imports]
The import of ‘Lib’ is redundant
except perhaps to import instances from ‘Lib’
To import instances alone, use: import Lib()
|
3 | import Lib
| ^^^^^^^^^^
[3 of 3] Compiling Paths_palindrome_testing ( /Users/…/palindrome-testing/.stack-work/dist/x86_64-osx/Cabal-3.4.1.0/build/autogen/Paths_palindrome_testing.hs, interpreted )
Ok, three modules loaded.
Loaded GHCi configuration from /private/var/folders/wj/52wjq8dn0fj1qltsnx3xxpnh0000gn/T/haskell-stack-ghci/959789a9/ghci-script
*Main Lib Paths_palindrome_testing
λ> isPalindrome "sam I mas"
True
it :: Bool
(0.01 secs, 704,296 bytes)
*Main Lib Paths_palindrome_testing
λ> :q
Leaving GHCi.
%