コードの整理とプロジェクトのビルド stackを使ってプロジェクトをビルドする プロジェクトの構造を理解する 作成者
入門Haskellプログラミング (Will Kurt(著)、株式会社クイープ(監修、翻訳)、翔泳社)のUNIT6(コードの整理とプロジェクトのビルド)、LESSON 35(stackを使ってプロジェクトをビルドする)、35.2(プロジェクトの構造を理解する)、クイックチェック 35-1の解答を求めてみる。
palindrome-checker/package.yaml
name: palindrome-checker
version: 0.1.0.0
github: "githubuser/palindrome-checker"
license: BSD3
author: "kamimura"
maintainer: "example@example.com"
copyright: "2022 kamimura"
extra-source-files:
- README.md
- CHANGELOG.md
# Metadata used when publishing your package
# synopsis: Short description of your package
# category: Web
# To avoid duplicated efforts in documentation and dealing with the
# complications of embedding Haddock markup inside cabal files, it is
# common to point users to the README.md file.
description: Please see the README on GitHub at <https://github.com/githubuser/palindrome-checker#readme>
dependencies:
- base >= 4.7 && < 5
ghc-options:
- -Wall
- -Wcompat
- -Widentities
- -Wincomplete-record-updates
- -Wincomplete-uni-patterns
- -Wmissing-export-lists
- -Wmissing-home-modules
- -Wpartial-fields
- -Wredundant-constraints
library:
source-dirs: src
executables:
palindrome-checker-exe:
main: Main.hs
source-dirs: app
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
dependencies:
- palindrome-checker
tests:
palindrome-checker-test:
main: Spec.hs
source-dirs: test
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
dependencies:
- palindrome-checker
palindrome-checker/palindrome-checker.cabal
name: palindrome-checker
version: 0.1.0.0
github: "githubuser/palindrome-checker"
license: BSD3
author: "kamimura"
maintainer: "example@example.com"
copyright: "2022 kamimura"
extra-source-files:
- README.md
- CHANGELOG.md
# Metadata used when publishing your package
# synopsis: Short description of your package
# category: Web
# To avoid duplicated efforts in documentation and dealing with the
# complications of embedding Haddock markup inside cabal files, it is
# common to point users to the README.md file.
description: Please see the README on GitHub at <https://github.com/githubuser/palindrome-checker#readme>
dependencies:
- base >= 4.7 && < 5
ghc-options:
- -Wall
- -Wcompat
- -Widentities
- -Wincomplete-record-updates
- -Wincomplete-uni-patterns
- -Wmissing-export-lists
- -Wmissing-home-modules
- -Wpartial-fields
- -Wredundant-constraints
library:
source-dirs: src
executables:
palindrome-checker-exe:
main: Main.hs
source-dirs: app
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
dependencies:
- palindrome-checker
tests:
palindrome-checker-test:
main: Spec.hs
source-dirs: test
ghc-options:
- -threaded
- -rtsopts
- -with-rtsopts=-N
dependencies:
- palindrome-checker
入出力結果(Terminal, Zsh)
% stack new palindrome-checker -p "author-name:kamimura"
Downloading template "new-template" to create project "palindrome-checker" in palindrome-checker/ ...
The following parameters were needed by the template but not provided: author-email, category, copyright, github-username
You can provide them in /Users/…/.stack/config.yaml, like this:
templates:
params:
author-email: value
category: value
copyright: value
github-username: value
Or you can pass each one as parameters like this:
stack new palindrome-checker new-template -p "author-email:value" -p "category:value" -p "copyright:value" -p "github-username:value"
Looking for .cabal or package.yaml files to use to init the project.
Using cabal packages:
- palindrome-checker/
Selecting the best among 21 snapshots...
* Matches https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/24.yaml
Selected resolver: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/24.yaml
Initialising configuration using resolver: https://raw.githubusercontent.com/commercialhaskell/stackage-snapshots/master/lts/19/24.yaml
Total number of user packages considered: 1
Writing configuration to file: palindrome-checker/stack.yaml
All done.
/Users/…/.stack/templates/new-template.hsfiles: 6.70 KiB downloaded...
%