Taking advantage of a neat trick for using $ rather than a lambda
[advent-of-code-17.git] / README.html
index 6f80db8e882bb84de24ad5ddd8cbb9eb2cda0bec..58b7faf5fb3ced72624c6e226b7d913bee9839d3 100644 (file)
 </div>
 <p>Code to solve the <a href="http://adventofcode.com/2017/">Advent of Code</a> puzzles. This year, I'm using the puzzles to develop my skills in <a href="https://wiki.haskell.org/Haskell">Haskell</a>.</p>
 <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>Run it with</p>
+<pre><code>stack exec jupyter -- notebook</code></pre>
 <h1 id="readme">Readme</h1>
 <p>Build this readme file wth</p>
 <pre><code>pandoc -s README.md &gt; README.html</code></pre>