From ad951acd4bf89dfbdcfa11cc66fe762559fa258a Mon Sep 17 00:00:00 2001 From: Joel Kaasinen Date: Mon, 5 Jun 2017 20:01:51 +0300 Subject: [PATCH] using stack --- .gitignore | 3 ++- README.md | 39 ++++++++++++++++++++++++++++++++++----- haskell-exercises.cabal | 8 ++++++++ stack.yaml | 2 ++ 4 files changed, 46 insertions(+), 6 deletions(-) create mode 100644 haskell-exercises.cabal create mode 100644 stack.yaml diff --git a/.gitignore b/.gitignore index e4e5f6c..fcc0206 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ -*~ \ No newline at end of file +*~ +.stack-work \ No newline at end of file diff --git a/README.md b/README.md index 7646b90..63445d0 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,35 @@ Opqdonut's Haskell Exercises ============================ -Quick Start ------------ +Quick Start using Stack +----------------------- + +1. Install [Stack](https://www.haskellstack.org/) + +2. Download dependencies by running + + $ stack build + +2. Then check you can actually run the tests with: + + $ stack runhaskell W0Test.hs + + This should print `Everything seems to be OK!`. If you see any errors, + you might not have a problem with your Haskell installation. + +3. Generate the exercise templates (files `W*.hs`): + + $ make + +4. Now you can edit `W1.hs` and see how well you did by running + + $ stack runhaskell W1Test.hs + +Alternative Quick Start using cabal +----------------------------------- + +In case you have problems with `stack`, here is a more old-fashioned +way to work with the exercises. 1. Install [The Haskell Platform](https://www.haskell.org/platform/) @@ -67,7 +94,8 @@ Working on the Excercises - Edit the Wn.hs files according to the instructions - Don't remove or change any type signatures (things like `foo :: String -> String`) that are already in the files -- Check your answers for week `n` with `runhaskell WnTest.hs` +- Check your answers for week `n` with `stack runhaskell WnTest.hs` + (or just `runhaskell WnTest.hs` if you're not using stack) - A typical test failure looks like this: Testing 11 @@ -84,8 +112,9 @@ Working on the Excercises I'm sorry if the test failures aren't always understandable :/ - You can also play around with your solutions interactively by - running `ghci Wn.hs`. This is a good idea for instance when you - don't understand the test failures. + running `stack exec ghci Wn.hs` (or `ghci Wn.hs`). + This is a good idea for instance when you don't understand the + test failures. Solutions --------- diff --git a/haskell-exercises.cabal b/haskell-exercises.cabal new file mode 100644 index 0000000..b7664b4 --- /dev/null +++ b/haskell-exercises.cabal @@ -0,0 +1,8 @@ +name: haskell-exercises +version: 0.0.1 +build-type: Simple +cabal-version: >= 1.10 + +library + build-depends: QuickCheck + default-language: Haskell2010 diff --git a/stack.yaml b/stack.yaml new file mode 100644 index 0000000..5667486 --- /dev/null +++ b/stack.yaml @@ -0,0 +1,2 @@ +resolver: lts-8.17 +install-ghc: true