X-Git-Url: https://git.njae.me.uk/?a=blobdiff_plain;f=README.md;h=7b831f2215ffe46de645d00f3146285c08526de7;hb=da7ce507eaddb2c950ec7c08b3fe91d10e49bfeb;hp=f7151b3343de5e14b7c2d78cb9195d5d8fb49c8a;hpb=78319b93c9cbce071c99eb5b7355ab7e76535031;p=advent-of-code-21.git diff --git a/README.md b/README.md index f7151b3..7b831f2 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,7 @@ Code to solve the [Advent of Code](http://adventofcode.com/2020/) 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. - +The [Cabal user guide](https://cabal.readthedocs.io/en/latest/index.html) and [How I Start: Haskell](http://howistart.org/posts/haskell/1/) are good sources of using the tools. # Toolchain @@ -38,7 +37,7 @@ Modify the `advent-of-code21.cabal` file as needed, such as updating the Cabal v ## Creating subsequent days -Each day lives in a separate directory, with its own `package.yaml` file and code in the `src` directory. (I based this configuration from [mstksg's setup](https://github.com/mstksg/advent-of-code-2018).) +Each day lives in a separate directory, with code in the `src` directory. Compile with ``` @@ -56,7 +55,7 @@ cabal run advent01 If you want to pass in additional RTS parameters, do it like this: ``` -stack exec -- advent01 +RTS -K0 -RTS +cabal run advent01 -- +RTS -K0 -RTS ``` Run interactively with @@ -70,16 +69,34 @@ stack ghci advent01:exe:advent01 if the first form is ambiguous. To profile, use + ``` -stack build --executable-profiling --library-profiling --ghc-options="-fprof-auto -rtsopts" advent01 +cabal run advent01 --enable-profiling -- +RTS -N -p -s -hT ``` -then run with + +Or, you can simplify the RTS options by adding them to a new stanza in the cabal file: + ``` -stack exec --profile -- advent01 +RTS -p -hy +executable advent01prof + import: common-extensions, build-directives + main-is: advent01/Main.hs + build-depends: text, containers, linear, array, pqueue, mtl, lens + ghc-options: -O2 + -Wall + -threaded + -rtsopts "-with-rtsopts=-N -p -s -hT" ``` + +then running + +``` +cabal run advent01prof --enable-profiling +``` + + Generate the profile graph with ``` -stack exec hp2ps advent01.hp +hp2ps -M advent01.hp ``` For Cabal, look at [profiling with Cabal sandboxes](https://nikita-volkov.github.io/profiling-cabal-projects/) @@ -87,8 +104,6 @@ For Cabal, look at [profiling with Cabal sandboxes](https://nikita-volkov.github # Packages -Stack is using the [14.16-lts resolver](https://www.stackage.org/lts-16.25) for packages, so make sure you read the [correct documentation for the packages included in it](https://www.stackage.org/lts-16.25/docs). - Packages I used a lot: * [Containers](https://hackage.haskell.org/package/containers) (and some [better documentation](https://haskell-containers.readthedocs.io/en/latest/intro.html)); [Unordered containers](https://hackage.haskell.org/package/unordered-containers) is a mostly-equivalent alternative.