959eb576aa
Fixes: #15, #13, #14, #11, #8 Add the IDEAS to a 'Suggestions' section in the FUTURE_PLANS file. * Updated the cabal instructions for level 03 * Removed the duplicated config loading in level 05 * Add the implementations for File.hs for levels 06 & 07 * Renamed the slightly misleading 'readObject' function * Fixed the capitalisation of init and close DB functions between levels 04 & 05. |
||
---|---|---|
.. | ||
bin | ||
src/FirstApp | ||
tests | ||
changelog.md | ||
default.nix | ||
level04.cabal | ||
level04.nix | ||
LICENCE | ||
README.md | ||
Setup.hs | ||
stack.yaml | ||
test.json |
Level 04
We need a place to store our Comments/Topics, so we're going to add a database to our application, specifically the SQLite database. We've chosen SQLite because it was the simplest to have up and running for the purposes of the course.
There is an example module included for using PostgreSQL, however the course will focus on the SQLite implementation.
For reference, the packages we will use to talk to our database are:
You will also need the SQLite database application installed and available on your system.
Also we will not necessarily provide all of the required imports any more, there may be other things you have to bring into scope.
The steps for this level:
src/FirstApp/DB/Types.hs
src/FirstApp/Types.hs
src/FirstApp/DB.hs
src/FirstApp/Main.hs
For the sake of simplicity, any configuration requirements will be hardcoded in
FirstApp/Conf.hs
for now. We will return to that in the next level.
NB: The PostgreSQL example module is in src/FirstApp/DB/PostgreSQL.hs
.