1
1
mirror of https://github.com/qfpl/applied-fp-course.git synced 2024-11-22 19:34:33 +03:00
Applied Functional Programming Course - Move from exercises to a working app!
Go to file
Sean Chalmers 93b40fa374 Fixes #55
Adds instructions for uncommenting the tests.
2018-05-23 11:26:27 +10:00
exe Full Course Layout Change with a shuffle. (#54) 2018-05-08 09:02:51 +10:00
files Full Course Layout Change with a shuffle. (#54) 2018-05-08 09:02:51 +10:00
src Fixes #55 2018-05-23 11:26:27 +10:00
tests Fixes #55 2018-05-23 11:26:27 +10:00
.gitignore Make the json config file loading exercises a bit more realistic. 2018-01-25 16:17:36 +10:00
.travis.yml Full Course Layout Change with a shuffle. (#54) 2018-05-08 09:02:51 +10:00
applied-fp-course.cabal Full Course Layout Change with a shuffle. (#54) 2018-05-08 09:02:51 +10:00
applied-fp-course.nix Full Course Layout Change with a shuffle. (#54) 2018-05-08 09:02:51 +10:00
cabal.project Full Course Layout Change with a shuffle. (#54) 2018-05-08 09:02:51 +10:00
changelog.md Full Course Layout Change with a shuffle. (#54) 2018-05-08 09:02:51 +10:00
default.nix Full Course Layout Change with a shuffle. (#54) 2018-05-08 09:02:51 +10:00
FUTURE_PLANS.md Issue Fixes & More feedback driven development 2018-01-22 11:40:11 +10:00
INSTRUCTOR_NOTES.md Updated instructor notes. 2018-05-09 13:51:39 +10:00
LICENCE Added LICENCE in accordance with CoC 2017-09-12 11:46:04 +10:00
README.md Full Course Layout Change with a shuffle. (#54) 2018-05-08 09:02:51 +10:00
stack.yaml Full Course Layout Change with a shuffle. (#54) 2018-05-08 09:02:51 +10:00

Applied Functional Programming Course

Build Status

This is a brand new course, so there are going to be rough edges. We invite you to submit issues or pull requests if you find errors or have suggestions on how to improve it.

This course is designed to be run in a class room with instructors, but we would like to make it suitable for self-study as well. Although undertaking this course outside of the workshops will increase the difficulty somewhat, we do not discourage it and invite suggestions on how to make the course more approachable.

If you do attempt this on your own and find yourself completely lost, then you may come find us on IRC on Freenode in #qfpl or #fp-course.

You:

  • Have completed, or are capable of completing, the Data61 FP Course.
  • Have a few months self-study to your name.
  • Want to know how to build larger applications with statically typed FP.
  • Are willing to accept that a web application is a sufficient choice.
  • Can write the canonical function of type: Applicative f => [f a] -> f [a]

We:

  • Have constructed a sequence of goals of increasing difficulty.
  • Have provided a framework within which to apply these goals.
  • Have included relevant components of larger applications:
    • Package dependencies
    • Project configuration
    • Application testing & building
    • Encoding / Decoding messages (JSON & Binary)
    • Persistent storage integration
    • App state & configuration management
    • Error handling & reporting
  • Will utilise both type & test driven development techniques.
  • Will explain architectural and design trade-offs when appropriate.

Setup build tools:

Each level is a self-contained Haskell module, containing incomplete, or as yet undefined, data types and functions.

We recommend using either a cabal sandbox, or a nix-shell, depending on your preference.

To use a sandbox:

$ cd path/to/applied-fp-course
$ cabal sandbox init
$ cabal install --only-dependencies --enable-tests
$ cabal build
$ $EDITOR README.md

We do recommend using cabal sandboxes as they provide a contained Haskell environment for a given project. Easy to clean up, and package versions won't conflict with any other sandboxed project you may be working on.

If you're using a version of Cabal that is >=2.0 (use cabal --version to find out), then you can use the new-* commands and you don't need a sandbox:

$ cd path/to/applied-fp-course
$ cabal new-configure --enable-tests
$ cabal new-build <levelN>-exe
$ $EDITOR src/<LevelN>/README.md

The normal cabal build commands should then work as expected.

To use the Nix Shell:

$ cd path/to/applied-fp-course
$ nix-shell
$ cabal new-build <levelN>-exe
$ $EDITOR src/<LevelN>/README.md

Once that completes you will be in a nix-shell environment with all the tools required to build the application for that level. Note that the levels build on each other, so you can go to the highest level and enter a nix-shell there, you will then have all the required tools for every level.

The shell.nix is not provided, so if you have a different work-flow you can utilise the derivation from the applied-fp-course.nix.

Stack

Stack yaml configuration is provided and checked by our CI system for successful builds. However the authors do not use stack, so we cannot promise to be able to resolve stack related issues that may arise. Though we will do our best. :)

Please note...

These lessons are designed to be completed with an instructor as part of the Data61 Applied Functional Programming Course. You are of course welcome to clone the repository and give it a try, but you may find the tasks more difficult. If you have any questions we can be contacted in the Freenode #qfpl or #fp-course IRC channel. You can use the free WebChat client.

Subsequent lessons may contain spoilers, don't cheat yourself out of the experience!

There is a README.md file in each Level module folder that will provide instructions about what the goal is for that specific level.

  • Level 01 : Simple Hello World web app.
  • Level 02 : Define our application spec with types!
  • Level 03 : Testing & Tools (hspec & ghcid)
  • Level 04 : Database layer (sqlite-simple)
  • Level 05 : Better Error Handling Through ExceptT
  • Level 06 : Add some flexible configuration
  • Level 07 : ReaderT & Refactoring

-- Coming Soon...

  • Level 08 : (Bonus Round) Lenses & Refactoring

-- Maybe...

  • Level 09 : Add session controls (login, logout) and a protected route. So we can have something that resembles application state. For the purposes of modelling the state machine and implementing some property based tests.