|
| 1 | +# How to implement a Haskell concept exercise |
| 2 | + |
| 3 | +This document describes the steps required to implement a concept exercise for the Haskell track. As this document is generic, the following placeholders are used: |
| 4 | + |
| 5 | +- `<SLUG>`: the name of the exercise in kebab-case (e.g. `anonymous-methods`). |
| 6 | +- `<NAME>`: the name of the exercise in PascalCase (e.g. `AnonymousMethods`). |
| 7 | + |
| 8 | +Before implementing the exercise, please make sure you have a good understanding of what the exercise should be teaching (and what not). This information can be found in the exercise's GitHub issue. Concept exercises should be modelled after the CIS 194 Haskell course at Penn University, either the [Spring 2013][spring-2013] or [Fall 2016][fall-2016] version. |
| 9 | + |
| 10 | +To implement a concept exercise, the following files need to be created: |
| 11 | + |
| 12 | +``` |
| 13 | +languages |
| 14 | +└── Haskell |
| 15 | + └── exercises |
| 16 | + └── concept |
| 17 | + └── <SLUG> |
| 18 | + ├── .docs |
| 19 | + | ├── instructions.md |
| 20 | + | ├── introduction.md |
| 21 | + | ├── hints.md |
| 22 | + | └── after.md (optional) |
| 23 | + ├── .meta |
| 24 | + | |── config.json |
| 25 | + | |── design.md |
| 26 | + | └── <SLUG>.hs (example solution) |
| 27 | + ├── src |
| 28 | + | └── <NAME>.hs |
| 29 | + ├── test |
| 30 | + | └── Tests.hs |
| 31 | + ├── package.yaml |
| 32 | + └── stack.yaml |
| 33 | +``` |
| 34 | + |
| 35 | +## Step 1: add track-specific files |
| 36 | + |
| 37 | +These are files specific to the PureScript track: |
| 38 | + |
| 39 | +- `src/<NAME>.hs`: the stub implementation file, which is the starting point for students to work on the exercise. |
| 40 | +- `test/Main.hs`: the test suite. |
| 41 | +- `.meta/Example.hs`: an example implementation that passes all the tests. |
| 42 | +- `stack.yaml`: the stack project file. |
| 43 | +- `package.yaml`: the cabal package file. |
| 44 | + |
| 45 | +## Step 2: add common files |
| 46 | + |
| 47 | +How to create the files common to all tracks is described in the [how to implement a concept exercise document][how-to-implement-a-concept-exercise]. |
| 48 | + |
| 49 | +## Inspiration |
| 50 | + |
| 51 | +When implementing an exercise, it can be very useful to look at already implemented Haskell exercises. You can also check the exercise's [general concepts documents][reference] to see if other languages have already implemented an exercise for that concept. |
| 52 | + |
| 53 | +[reference]: ../../../reference |
| 54 | +[how-to-implement-a-concept-exercise]: ../../../docs/maintainers/generic-how-to-implement-a-concept-exercise.md |
| 55 | +[spring-2013]: https://www.seas.upenn.edu/~cis194/spring13/ |
| 56 | +[fall-2016]: https://www.seas.upenn.edu/~cis194/fall16/ |
0 commit comments