haskell-ex icon indicating copy to clipboard operation
haskell-ex copied to clipboard

(ARCHIVED) Haskell exercises I wrote for Haskell Learning Group

Haskell exercises

What is it

These are exercises for the Alpha study group (if you want to participate, first get into the Haskell Learning Group and then ask @neongreen). A new set is published every week, but you're encouraged to solve old sets too. If you can't solve a task, ask in the Slack channel and you'll be given hints.

The exercises are beginner-to-intermediate level. Expect to learn how to write algorithms, solve simple problems with Haskell, use common libraries, write sites, talk to databases, create interfaces, parse things, do weird type-level stuff, and more.

Workflow

Submitting Solutions

  1. Setup your namespace

For instance, if your Github handle is john and you are solving task table from week 3, create a branch called table/john and put your solution into week3/table/john:

$ git checkout -b table/john
$ mkdir -p week3/table/john

Recap:

  1. Branch <exercise-code>/<your-gh-handle>

  2. Folder week<n>/<exercise-code>/<your-gh-handle>

  3. Author your solution, get feedback

    Work in your namespace. It doesn't matter what you call your .hs file, but Main.hs is a good default.

    Create a pull request once you want feedback on your code and/or are ready to submit it.

    • Suggestion If you are not done then consider writing a task list in the description. This convention transparently communicates your progress.

    • Suggestion Feedback will probably result in additional tasks to do so updating the list may be desirable, but then again certain tasks may not be worth such detail. Use judgement, whatever helps.

  4. Iterate

    Discuss feedback with the reviewer. Integrate changes into your solution. Repeat as needed.

  5. Finish

    Once you and your reviewer are satisfied with your solution, merge! From then on you can make changes to your solution's code in the master branch (refactors, etc.).

Weekly Review

At the end of each week each exercise is explained by someone who has solved it.

Stuff that you should know if you're already in

  • Don't forget to use hlint on your code – it often gives good suggestions on how to improve it. (They aren't always good, however! If you're unsure, ask.)

  • You can see yours (and others') progress in this table.

Exercises

  • Week 6 (October 11–16)

      1. Write QuickCheck {quickcheck}
      1. Choosing a serialization method {serialize}
  • Week 5 (October 3–9)

      1. Write a quine {quine}
      1. Write a database engine {db}
  • Week 4 (September 19 – October 2)

      1. Draw a spiral {spiral}
      1. Justify text {justify}
      1. Trie {trie}
      1. Path finding {path}
      1. JSON printing {json-print}
  • Week 3 (September 12–18)

      1. Binary conversion {binary}
      1. Working with expressions {expr}
      1. Compute a moving average {average}
      1. XOR encryption {xor}
      1. Table formatting {table}
  • Week 2 (September 5–11)

      1. Merge sort {mergesort}
      1. Silly compression {compress}
      1. Big integers {bigint}
      1. Biased shuffle {shuffle}
      1. JSON extractor {jpath}
  • Week 1 (August 26 – September 4)

      1. Find scary words {scary}
      1. Calculate probability of winning using simulation {reposts}
      1. Write a tic-tac-toe game {tictactoe}
      1. Generate a maze using Wilson's algorithm {wilson}
      1. Solve a logic problem using brute-force {logic-brute}