Updated README to fix a typo and add some clarificaiton about directories
[advent-of-code-16.git] / README.md
1 ---
2 title: "Advent of Code 2016"
3 output: html_document
4 css: modest.css
5 ---
6 Code to solve the [Advent of Code](http://adventofcode.com/2016/) puzzles. This year, I'm trying to use the puzzles as a prompt to learn [Haskell](https://wiki.haskell.org/Haskell).
7
8 [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.
9
10 # Toolchain
11
12 I'm using the basic Haskell Platform installation, togeher with `Stack` to manage the packages and dependencies (install with
13 ```
14 $ sudo aptitude install haskell-platform haskell-stack
15 ```
16 ).
17
18 I have one package for each day, to 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.
19
20 To work on a project, `cd` into that project's directory.
21
22 Compile with
23 ```
24 stack build
25 ```
26 or
27 ```
28 stack build adventofcode1601
29 ```
30
31 Run with
32 ```
33 stack exec advent01
34 ```
35
36 Run interactively with
37 ```
38 stack ghci adventofcode1601:exe:advent01
39 ```
40
41 To profile, use
42 ```
43 stack build --executable-profiling --library-profiling --ghc-options="-fprof-auto -rtsopts" adventofcode1601
44 ```
45 then run with
46 ```
47 stack exec -- advent01 +RTS -p -hy
48 ```
49
50 # Readme
51
52 Build this readme file wth
53 ```
54 pandoc -s README.md > README.html
55 ```
56
57 ### Earlier instructions, for compiling before use of Stack
58
59 I'm also using some extra libraries. Before installing, run `cabal update` then set `library-profiling: True` in `~/.cabal/config` . Then install the packages with
60 ```
61 $ cabal install MissingH
62 $ cabal install parsec-numbers
63 $ cabal install cryptonite
64 $ cabal install pqueue
65 ```
66
67 Compile the code with
68 ```
69 ghc --make advent01.hs
70 ```
71
72 then run it as
73 ```
74 advent01
75 ```
76
77 If you're profiling, compile and run with
78 ```
79 ghc -O2 --make advent01.hs -prof -auto-all -caf-all -fforce-recomp -rstopts
80 time ./advent01 +RTS -p -hy
81 ```
82
83 and create the profile picture with `h2ps advent01.hp` .
84
85 (Using the [Modest style](https://github.com/markdowncss/modest).)