X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=README.md;h=1556de04b324a05dc69a15a02432930ab26087b8;hb=1362ef699897009fbcfce9ce43a606c18224fdfd;hp=1561e11922dff3fe4ec5fa903d954c2956e4c9d3;hpb=519affb87dbd87b031b97c464b4d639ca1fcb2cc;p=advent-of-code-17.git diff --git a/README.md b/README.md index 1561e11..1556de0 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ The [Stack documentation](https://docs.haskellstack.org/en/stable/README/) and [ # Toolchain -I'm using the basic Haskell Platform installation, togeher with `Stack` to manage the packages and dependencies (install with +I'm using the basic Haskell Platform installation, togeher with `stack` to manage the packages and dependencies (install with ``` $ sudo aptitude install haskell-platform haskell-stack ``` @@ -20,30 +20,19 @@ $ sudo aptitude install haskell-platform haskell-stack ## Creating the repository and project Create the repository as normal: create the project in Gitolite, clone it, and insert the `.gitignore` and `README.md` files. -Within the project directory, there will be one package for each day. This will save time waiting for `stack` to check every executable before compiling what's changed. Each package needs a separate directory tree and a separate `.cabal` file. +There's just one package, with the code in sub-directories of the `src` directory. Each day will generate one (or more) entries in the `adventofcode17.cabal` file. -## Creating the first package -Then create the basic `stack` project with it. This will create a new directory. Note that this new directory name can't have a hyphen-delimited word that's just digits, so the initial project will have to be `adventofcode1701` +Create the basic `stack` project. This will create a new directory. Note that this new directory name can't have a hyphen-delimited word that's just digits, so the project will have to be `advent-of-code` ``` -stack new adventofcode1701 simple +stack new advent-of-code --bare simple ``` -This project will be demoted to being a package, but one that will hold the overall project. +Modify the `stack.yaml` file as needed, such as adding the `ghc-options` stanza. -Then create the top-level `stack.yaml` file to hold the overall project information. +## Creating subsequent days -``` -stack init -``` - -Modify this top-level `stack.yaml` file as needed, such as adding the `ghc-options` stanza. You can then delete `adventofcode1701/stack.yaml`. - -## Creating subsequent packages - -Each package needs a separate directory tree and a separate `.cabal` file. - -To work on a project, `cd` into that project's directory. +Each day lives in a separate directory within the `src` directory. It will also need it's own stanza in `advent-of-code.cabal`. Compile with ``` @@ -51,7 +40,7 @@ stack build ``` or ``` -stack build adventofcode1701 +stack build advent01 ``` Run with @@ -61,7 +50,7 @@ stack exec advent01 Run interactively with ``` -stack ghci adventofcode1701:exe:advent01 +stack ghci advent-of-code:exe:advent01 ``` To profile, use @@ -73,11 +62,26 @@ then run with stack exec -- advent01 +RTS -p -hy ``` +# Packages + +Stack is using the [9.14-lts resolver](https://www.stackage.org/lts-9.14) for packages, so make sure you read the [correct documentation for the packages included in it](https://www.stackage.org/lts-9.14/docs). + +When you use a new package, use + +``` +stack solver +``` +to see how the `stack.yaml` file needs to change, and +``` +stack solver --update-yaml +``` +to implement the changes. + # IHaskell Install following the [IHaskell instructions](https://github.com/gibiansky/IHaskell). -To run, change into the package's directory (after modifying the `.cabal` file) and run it with +Run it with ``` stack exec jupyter -- notebook