-
Install Stack
-
Open a terminal
-
Clone this repository by running
git clone https://github.com/opqdonut/ifp2018-exercises.git -
Change directory to the cloned repository
cd ifp2018-exercises -
Download dependencies by running
stack build -
Then check you can actually run the tests with:
stack runhaskell W0Test.hsThis should print
Everything seems to be OK!. If you see any errors, you might have a problem with your Haskell installation. -
Now you can edit
W1.hsand see how well you did by runningstack runhaskell W1Test.hs
-
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
nwithstack runhaskell WnTest.hs(or justrunhaskell WnTest.hsif you're not using stack) -
A typical test failure looks like this:
Testing 11 *** Failed! Falsifiable (after 1 test): 0 0 Expected 1, got 3 FAILThis means that the function from exercise 11 failed the test when the two arguments were 0 and 0. The result should have been 1, but it was 3.
I'm sorry if the test failures aren't always understandable :/
- You can also play around with your solutions interactively by
running
stack exec ghci Wn.hs(orghci Wn.hs). This is a good idea for instance when you don't understand the test failures. - Use the
:reloadcommand to reload the file if you've made changes. - You can use the
:typecommand to get the type of an expression, for example:type tail "asdf"