More tweaks to cabal and readme file
authorNeil Smith <neil.git@njae.me.uk>
Sun, 3 Dec 2017 11:47:03 +0000 (11:47 +0000)
committerNeil Smith <neil.git@njae.me.uk>
Sun, 3 Dec 2017 11:47:03 +0000 (11:47 +0000)
README.html
README.md
advent-of-code.cabal [new file with mode: 0644]
adventofcode17.cabal [deleted file]

index 50c66bbc575addd1a0f6aa99df0d77f06f23a5b2..58b7faf5fb3ced72624c6e226b7d913bee9839d3 100644 (file)
 <p><a href="http://learnyouahaskell.com/chapters">Learn you a Haskell</a>, <a href="https://www.haskell.org/tutorial/index.html">Introduction to Haskell 98</a>, and <a href="https://hackage.haskell.org/">Hackage</a> are good resources.</p>
 <p>The <a href="https://docs.haskellstack.org/en/stable/README/">Stack documentation</a> and <a href="http://howistart.org/posts/haskell/1/">How I Start: Haskell</a> are good sources of using the tools.</p>
 <h1 id="toolchain">Toolchain</h1>
-<p>I'm using the basic Haskell Platform installation, togeher with <code>Stack</code> to manage the packages and dependencies (install with</p>
+<p>I'm using the basic Haskell Platform installation, togeher with <code>stack</code> to manage the packages and dependencies (install with</p>
 <pre><code>$ sudo aptitude install haskell-platform haskell-stack</code></pre>
 <p>).</p>
 <h2 id="creating-the-repository-and-project">Creating the repository and project</h2>
 <p>Create the repository as normal: create the project in Gitolite, clone it, and insert the <code>.gitignore</code> and <code>README.md</code> files.</p>
-<p>Within the project directory, there will be one package for each day. This will save time waiting for <code>stack</code> to check every executable before compiling what's changed. Each package needs a separate directory tree and a separate <code>.cabal</code> file.</p>
-<h2 id="creating-the-first-package">Creating the first package</h2>
-<p>Then create the basic <code>stack</code> 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 <code>adventofcode1701</code></p>
-<pre><code>stack new adventofcode1701 simple</code></pre>
-<p>This project will be demoted to being a package, but one that will hold the overall project.</p>
-<p>Then create the top-level <code>stack.yaml</code> file to hold the overall project information.</p>
-<pre><code>stack init</code></pre>
-<p>Modify this top-level <code>stack.yaml</code> file as needed, such as adding the <code>ghc-options</code> stanza. You can then delete <code>adventofcode1701/stack.yaml</code>.</p>
-<h2 id="creating-subsequent-packages">Creating subsequent packages</h2>
-<p>Each package needs a separate directory tree and a separate <code>.cabal</code> file.</p>
-<p>To work on a project, <code>cd</code> into that project's directory.</p>
+<p>There's just one package, with the code in sub-directories of the <code>src</code> directory. Each day will generate one (or more) entries in the <code>adventofcode17.cabal</code> file.</p>
+<p>Create the basic <code>stack</code> 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 <code>advent-of-code</code></p>
+<pre><code>stack new advent-of-code --bare simple</code></pre>
+<p>Modify the <code>stack.yaml</code> file as needed, such as adding the <code>ghc-options</code> stanza.</p>
+<h2 id="creating-subsequent-days">Creating subsequent days</h2>
+<p>Each day lives in a separate directory within the <code>src</code> directory. It will also need it's own stanza in <code>advent-of-code.cabal</code>.</p>
 <p>Compile with</p>
 <pre><code>stack build</code></pre>
 <p>or</p>
-<pre><code>stack build adventofcode1701</code></pre>
+<pre><code>stack build advent01</code></pre>
 <p>Run with</p>
 <pre><code>stack exec advent01</code></pre>
 <p>Run interactively with</p>
-<pre><code>stack ghci adventofcode1701:exe:advent01</code></pre>
+<pre><code>stack ghci advent-of-code:exe:advent01</code></pre>
 <p>To profile, use</p>
 <pre><code>stack build --executable-profiling --library-profiling --ghc-options=&quot;-fprof-auto -rtsopts&quot; adventofcode1601</code></pre>
 <p>then run with</p>
 <pre><code>stack exec -- advent01 +RTS -p -hy</code></pre>
+<h1 id="packages">Packages</h1>
+<p>Stack is using the <a href="https://www.stackage.org/lts-9.14">9.14-lts resolver</a> for packages, so make sure you read the <a href="https://www.stackage.org/lts-9.14/docs">correct documentation for the packages included in it</a>.</p>
+<p>When you use a new package, use</p>
+<pre><code>stack solver</code></pre>
+<p>to see how the <code>stack.yaml</code> file needs to change, and</p>
+<pre><code>stack solver --update-yaml</code></pre>
+<p>to implement the changes.</p>
 <h1 id="ihaskell">IHaskell</h1>
 <p>Install following the <a href="https://github.com/gibiansky/IHaskell">IHaskell instructions</a>.</p>
-<p>To run, change into the package's directory (after modifying the <code>.cabal</code> file) and run it with</p>
+<p>Run it with</p>
 <pre><code>stack exec jupyter -- notebook</code></pre>
 <h1 id="readme">Readme</h1>
 <p>Build this readme file wth</p>
index 1561e11922dff3fe4ec5fa903d954c2956e4c9d3..1556de04b324a05dc69a15a02432930ab26087b8 100644 (file)
--- 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
diff --git a/advent-of-code.cabal b/advent-of-code.cabal
new file mode 100644 (file)
index 0000000..53e492c
--- /dev/null
@@ -0,0 +1,41 @@
+name:                advent-of-code
+version:             17.1.0.0
+-- synopsis:
+-- description:
+homepage:            https://github.com/neilnjae/advent-of-code-17#readme
+license:             BSD3
+license-file:        LICENSE
+author:              Neil Smith
+maintainer:          noone@njae.me.uk
+copyright:           2017 Neil Smith
+category:            None
+build-type:          Simple
+cabal-version:       >=1.10
+extra-source-files:  README.md
+
+library
+  hs-source-dirs:      src
+  build-depends:       base >= 4.7 && < 5
+  default-language:    Haskell2010
+
+executable advent01
+  hs-source-dirs:      src/advent01
+  main-is:             advent01.hs
+  default-language:    Haskell2010
+  build-depends:       base >= 4.7 && < 5
+                     , parsec
+
+executable advent01verbose
+  hs-source-dirs:      src/advent01
+  main-is:             advent01verbose.hs
+  default-language:    Haskell2010
+  build-depends:       base >= 4.7 && < 5
+                     , parsec
+
+executable advent02
+  hs-source-dirs:      src/advent02
+  main-is:             advent02.hs
+  default-language:    Haskell2010
+  build-depends:       base >= 4.7 && < 5
+                     , parsec
+                     , parsec-numbers
diff --git a/adventofcode17.cabal b/adventofcode17.cabal
deleted file mode 100644 (file)
index 0bb0202..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-name:                adventofcode17
-version:             0.1.0.0
--- synopsis:
--- description:
-homepage:            https://github.com/neilnjae/advent-of-code-17#readme
-license:             BSD3
-license-file:        LICENSE
-author:              Neil Smith
-maintainer:          noone@njae.me.uk
-copyright:           2017 Neil Smith
-category:            None
-build-type:          Simple
-cabal-version:       >=1.10
-extra-source-files:  README.md
-
-library
-  hs-source-dirs:      src
-  build-depends:       base >= 4.7 && < 5
-  default-language:    Haskell2010
-
-executable advent01
-  hs-source-dirs:      src/advent01
-  main-is:             advent01.hs
-  default-language:    Haskell2010
-  build-depends:       base >= 4.7 && < 5
-                     , parsec
-
-executable advent02
-  hs-source-dirs:      src/advent02
-  main-is:             advent02.hs
-  default-language:    Haskell2010
-  build-depends:       base >= 4.7 && < 5
-                     , parsec
-                     , parsec-numbers