Skip to content

Instantly share code, notes, and snippets.

@IMOKURI
Last active August 29, 2015 14:19
Show Gist options
  • Save IMOKURI/fe746f8038b836ed5c7f to your computer and use it in GitHub Desktop.
Save IMOKURI/fe746f8038b836ed5c7f to your computer and use it in GitHub Desktop.
Haskellのプロジェクトの始め方

プロジェクト名のディレクトリを作る。

なにはともあれ。

.cabalファイルを作成する。

cabal init

.cabalファイルを修正する。

  • description, copyrightの追加。
  • ghc-options: -Wall の追加。
  • source-repository の追加。(*1)
  • Libraryの場合、 exposed-modules: の追加。

など。

(*1)

source-repository head
  type:                git
  location:            git@github.com:IMOKURI/projectName.git

sandboxを作成する。

cabalのバージョンが1.18より小さければ、バージョンアップしておく。 cabal install cabal-install

他プロジェクトで使用していたsandboxを転用する場合は、 .cabal-sandbox ディレクトリをコピーしておく。

cabal sandbox init

GitHubにレポジトリを作成する。

Initialize this repository with a README はチェックしない。

gitを初期化する。

git init

リモートレポジトリを登録する。

git remote add origin git@github.com:IMOKURI/projectName.git

.gitignoreファイルを作成する。

dist
cabal-dev
*.o
*.hi
*.chi
*.chs.h
.virtualenv
.hpc
.hsenv
.cabal-sandbox/
cabal.sandbox.config
cabal.config
*.prof
*.hp
*.aux

codingする。

ごにょごにょ

build確認。

cabal install -j --only-dependencies --enable-tests
cabal build
cabal test

Travis CI連携。

.travis.ymlファイルを作成する。

READMEを更新する。

忘れずに。

コミット。

git add --all
git commit -m "Commit message"
git push -u origin master

参考

What I Wish I Knew When Learning Haskell
How I Start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment