Taking advantage of a neat trick for using $ rather than a lambda
[advent-of-code-17.git] / README.md
index 11880e96e5a49e626c10d5f00274a71cfc581c1d..1556de04b324a05dc69a15a02432930ab26087b8 100644 (file)
--- a/README.md
+++ b/README.md
@@ -7,9 +7,11 @@ Code to solve the [Advent of Code](http://adventofcode.com/2017/) puzzles. This
 
 [Learn you a Haskell](http://learnyouahaskell.com/chapters), [Introduction to Haskell 98](https://www.haskell.org/tutorial/index.html), and [Hackage](https://hackage.haskell.org/) are good resources.
 
+The [Stack documentation](https://docs.haskellstack.org/en/stable/README/) and [How I Start: Haskell](http://howistart.org/posts/haskell/1/) are good sources of using the tools. 
+
 # 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
 ```
@@ -18,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. 
-
-## 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`
-
-```
-stack new adventofcode1701 simple
-```
-
-This project will be demoted to being a package, but one that will hold the overall project. 
+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.
 
-Then create the top-level `stack.yaml` file to hold the overall project information.
+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 init
+stack new advent-of-code --bare simple
 ```
 
-Modify this top-level `stack.yaml` file as needed, such as adding the `ghc-options` stanza. You can then delete `adventofcode1701/stack.yaml`
+Modify the `stack.yaml` file as needed, such as adding the `ghc-options` stanza
 
-## Creating subsequent packages
+## Creating subsequent days
 
-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
 ```
@@ -49,7 +40,7 @@ stack build
 ```
 or 
 ```
-stack build adventofcode1701
+stack build advent01
 ```
 
 Run with
@@ -59,7 +50,7 @@ stack exec advent01
 
 Run interactively with
 ```
-stack ghci adventofcode1701:exe:advent01
+stack ghci advent-of-code:exe:advent01
 ```
 
 To profile, use 
@@ -71,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