1
1
mirror of https://github.com/qfpl/applied-fp-course.git synced 2024-11-30 02:14:01 +03:00
Commit Graph

58 Commits

Author SHA1 Message Date
Sean Chalmers
889c1dd658 Minor adjustments. Fix some remaining capitalisation issues for runDB 2018-02-09 11:33:59 +10:00
Andrew McCluskey
0c167bc499 Widen optparse-applicative bounds
0.13.2 is what I get on my nixos 17.09
2018-02-07 09:49:47 +10:00
Sean Chalmers
f69fc1bf39 Upgrade CI so we test building with stack as well 2018-02-02 09:59:55 +10:00
Sean Chalmers
05d60abd4b
Merge pull request #23 from endgame/hide-constructors
Move Topic/CommentText into their own modules to hide constructors
2018-02-01 17:21:32 +11:00
Sean Chalmers
03c7fe3cc4
Merge branch 'master' into relax-hspec-wai-bounds 2018-02-01 14:17:12 +11:00
Alistair Burrowes
1f5de69fdb Update to stackage LTS 10 (GHC 8.2.2)
Includes some version bumps required for the stackage version.
2018-01-31 12:20:33 +11:00
Jack Kelly
1cbdafd62d Move Topic/CommentText into their own modules to hide constructors 2018-01-30 18:06:42 +11:00
Sean Chalmers
ac25d90ddf Relaxing version bounds for hspec-wai, adding upper bound. 2018-01-28 21:53:17 +10:00
Sean Chalmers
2a35db9d5b Keeping in sync with latest updates to master 2018-01-27 15:32:27 +10:00
Sean Chalmers
6e41c254d8 Added some tests, renamed the throwLeft function, added some better wording for Level06 AppM 2018-01-27 15:04:36 +10:00
Sean Chalmers
f3d80ddd58 Fix tests of level06, new type error after arg swap 2018-01-25 11:32:27 +10:00
Sean Chalmers
08b9f3382f Update wording for level 6 AppM exercise 2018-01-25 10:47:24 +10:00
Sean Chalmers
0533234839 First cut of the new transformer exercises 2018-01-24 15:35:52 +10:00
Sean Chalmers
d1c95fba53 Fix snafu'd partialConf construction and Aeson imports 2018-01-22 12:29:03 +10:00
Sean Chalmers
959eb576aa Issue Fixes & More feedback driven development
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.
2018-01-22 11:40:11 +10:00
Sean Chalmers
dd51be0edf Remove the interpolated table exercise from example Postgres modules 2018-01-16 13:42:31 +10:00
Sean Chalmers
cd77f68897 Merged PR for adding stack.yml files and typo fixes.
Merge branch 'master' of github.com:qfpl/applied-fp-course
2018-01-16 12:47:25 +10:00
Sean Chalmers
ef0b4aa3f5 Updates based on course run feedback.
Levels 3,4, and 5 have been reordered for a better flow and more constructive
exercises.

All levels should now build on GHC versions: {7.10.3, 8.0.2, 8.2.2}

TravisCI integration added for GHC version build testing.

Probably broke a whole bunch of things in the process. *sadface*

Squashed commit of the following:

commit 203a71de3b6df2525160e76622ce846053719ddf
Author: Sean Chalmers <sean.chalmers@data61.csiro.au>
Date:   Tue Jan 16 12:33:23 2018 +1000

    Updated instructor notes, added important section for things to mention/ask

commit c8934debe9742d8ef7112ee661af7ebd3c58c7fa
Author: Sean Chalmers <sean.chalmers@data61.csiro.au>
Date:   Tue Jan 16 12:14:24 2018 +1000

    Attempt to fix weird doctest bug for level05

    One more try at travis config for the time being.

commit 85cd8a23d0d180bbd49dc5b4a40361c1bae3921d
Author: Sean Chalmers <sean.chalmers@data61.csiro.au>
Date:   Tue Jan 16 11:59:08 2018 +1000

    Deps updates and instructor notes added

commit 7898c2294f9303b89e82dd95a9714cbf6546f9b4
Author: Sean Chalmers <sean.chalmers@data61.csiro.au>
Date:   Mon Jan 15 21:20:55 2018 +1000

    Removed import of Conf from Tests on level 03

commit 9c387e90ec4142bb02dd70bdee8752b7d5779c01
Author: Sean Chalmers <sean.chalmers@data61.csiro.au>
Date:   Mon Jan 15 20:52:24 2018 +1000

    Removed other cabal check, add FirstApp.Conf to level 3 exposed modules

commit 2fe47b1cb46c240a9f5da6286af161724f334806
Author: Sean Chalmers <sean.chalmers@data61.csiro.au>
Date:   Mon Jan 15 18:40:14 2018 +1000

    Bump doctest bounds

commit 7ede0c8b9f50fa12c6d240a9778672a75ad44bfe
Author: Sean Chalmers <sean.chalmers@data61.csiro.au>
Date:   Mon Jan 15 18:16:53 2018 +1000

    Added semigroups as a dependency

commit 0d4c8e6539172487f9e2d239b74c8675ccf557dd
Author: Sean Chalmers <sean.chalmers@data61.csiro.au>
Date:   Mon Jan 15 17:48:09 2018 +1000

    CI Fixes

    - Remove sdist packaging test from travis.yml as we're not going to ever put
      these on hackage.

    - Move lower bound on time library out further for older GHCs.

commit 20053d48780451edc8b8072bf23cfd3801935795
Author: Sean Chalmers <sean.chalmers@data61.csiro.au>
Date:   Mon Jan 15 16:11:45 2018 +1000

    Expanding notes

commit 8d2e40012585828ede4ca8d506f71d504df690f9
Author: Sean Chalmers <sean.chalmers@data61.csiro.au>
Date:   Mon Jan 15 15:55:30 2018 +1000

    Expanded bounds for base & time to try to cover more GHC versions. Updated project paths in travis script

commit d4cf006bed5cc925084a26afad159ef6442b1a4c
Author: Sean Chalmers <sean.chalmers@data61.csiro.au>
Date:   Mon Jan 15 15:35:49 2018 +1000

    Removed older GHC versions that won't be tested against for now

commit 6543e1368ca179331ac25b141482b8cdb1a14d55
Author: Sean Chalmers <sean.chalmers@data61.csiro.au>
Date:   Mon Jan 15 14:56:21 2018 +1000

    Generated Travis.yml using multi-ghc-travis. Added tested-with setting to cabal files. Added cabal project file.

commit b2ccf351abaebf62a33eef2f1f062eb081c31a29
Author: Sean Chalmers <sean.chalmers@data61.csiro.au>
Date:   Mon Jan 15 14:34:52 2018 +1000

    Updated Level 07

    Use the new config structure.

    Expand the number of functions that need to be reworked because of the
    change to using ExceptT. Most involve copying previous answers, unsure
    if this will be a problem for people that aren't keeping up...

commit 6628e221488c1ed16b06b759009a4d7613bba5ea
Author: Sean Chalmers <sean.chalmers@data61.csiro.au>
Date:   Mon Jan 15 13:52:29 2018 +1000

    Update Level06

    Expand on what is to be completed in level 06 with respect to refactoring
    functions to run in a ReaderT.

    Added the new Conf structure

commit 2cbc9ff269d3e204d340a266ab472d27fbf51e7e
Author: Sean Chalmers <sean.chalmers@data61.csiro.au>
Date:   Mon Jan 15 10:59:30 2018 +1000

    Some minor adjustments for levels 6 & 7, fell out of sequence of larger changes

commit 3e964efc0b3c999930c2bfe8c69b13b63967da45
Author: Sean Chalmers <sean.chalmers@data61.csiro.au>
Date:   Mon Jan 15 10:55:52 2018 +1000

    Reordered Levels {3,4,5}.

    The new order is:
    3) Testing (was #4)
    4) Database (was #5)
    5) Config (was #3)

    This flows better with an expected wind down into the testing level
    which is not very complex. Before increasing in difficulty again with
    the Database and then external config level.

    Still TODO:
    - Find what I missed when rewriting the parts of these levels that fell
    out of sync with the new ordering.

    - Update levels 6 & 7 to use the new configuraton structure from #5.

commit 67451fffd23b06fe7ae24905c11b1e8e3b8bf279
Author: Sean Chalmers <sean.chalmers@data61.csiro.au>
Date:   Mon Jan 15 09:03:46 2018 +1000

    Fix time package version bound.

    Time version bound upped to 1.8.* for sqlite* packages.

    Stubbed out prepareAppReqs on level07.
    Removed lingering Table type on the db config.

commit de7ba8c88c83b5a4cf898f9f882f60721d804b07
Author: Sean Chalmers <sean.chalmers@data61.csiro.au>
Date:   Mon Jan 15 08:45:41 2018 +1000

    Apply latest round of changes from feedback.

    !DONE drop the "do your own thing" from the README regarding build environments
    !DONE notes about how to test the end points using CURL (4-5 requests, mix of okay & fail)
    !DONE move 'parseOptions' towards the bottom of the file (because we export it)
    !DONE add import of Data.Bifunctor (first) to Conf
    !DONE use 'try' instead of 'catch' for readObject
    !DONE add comments for some tests to write for the application
    !DONE - testing empty comments etc
    !DONE - make the test for helloMsg the last test
    !DONE change the instructions in the readme for level05 to go from DB/Types to Types to DB
    !DONE remove the Table name interpolation from the Level05
    !DONE add the SQL into the functions for people.
    !DONE change the capitalisation of the Db/DB to be consistent across files (level05)
    !DONE fix instruction for modFieldLabel to not include camel-casing instructions
    !DONE add more information to the level05 Main.hs for 'prepareAppReqs' function.
    !DONE add explicit import for IOError (System.IO.Error)
    !DONE move the optparse-applicative out, students won't complete this section. Mention it as a thing to look at.
    !DONE Remove 'Conf.Conf' from 'handleRequest' from level >=5
    !DONE Add instruction to the end of AppM to send people onwards to FirstApp/Main.
    !DONE Add type signatures to the functions in the where clause in the FirstApp/Main (level06)
    !DONE Add type signature to 'toStartUpErr' function in level07
    !DONE !IMPORTANT! Remove/Fill in the 'flushTopic' function

commit f40cf697fd7ea87ecf187ce3368ccfcde61cdadf
Author: Sean Chalmers <sean.chalmers@data61.csiro.au>
Date:   Wed Jan 10 17:11:35 2018 +1000

    Start trying to rearrange conf to be a bit more friendly
2018-01-16 12:36:57 +10:00
Alex Mason
174d5f8624 Add stack.yaml files for all directories. 2018-01-10 10:33:56 +10:00
Sean Chalmers
bfa7c5511c Fixed typo in PostgreSQL module 2017-12-13 17:23:47 +10:00
Andrew McCluskey
4af4c3c845 Level05 tweaks 2017-10-05 05:38:50 +00:00
Sean Chalmers
94711343b6 modFieldLabel in level05+ is 'almost' just the identity.
But that was largely due to missing field prefixes in the Comment record for
that level. Field prefixes added back in and added some doctests and changed the
wording for that section to explain a bit more of what is going on.
2017-10-05 14:35:39 +10:00
Sean Chalmers
59a516d481 Updated DB for more clarity about withTable.
Added doctests and a shout out to what is going on with "$$tablename$$" in the
``withTable`` function.

Updated the level04 tests file to be a bit more defined and provide an example
of a test that Hspec.Wai lets you write. Information was very thin on the ground
in that file so it would have been too difficult without assistance.

Provided a bit more information about cool things that ``ghcid`` can do that I
didn't know about. :D

Fixes #9, #7, #5
2017-10-05 09:18:18 +10:00
Sean Chalmers
83b954fb5d Update SQL Injection Risk Comment.
The application only kinda-sorta has an SQL injection risk given that the config
has to be compromised and the application restarted to load the new config. Even
in a learning application like this one it's worth mentioning but still going to
be far from your biggest problem if someone has that level of access to your
servers.

Fixes #8
2017-10-05 08:53:25 +10:00
Sean Chalmers
418ce19e02 Overhauled nix file setup to be more like the other QFPL projects.
- Regenerated the individual nix files.
- Removed the shell.nix files

Just running ``$ nix-build`` in levels greater than 2 currently
doesn't succeed, still working on this. The nix-shell environments
work as expected for all levels.
2017-09-18 10:14:29 +10:00
Sean Chalmers
7b5ca8c97a Image now loads via HTTPS.
Image link in README should no longer trigger 'insecure content' warnings,
the link was reading from a non-HTTPS source.

Other rewordings and minor refactors
2017-09-14 14:01:47 +10:00
Sean Chalmers
eae7f839d5 Removes a function that was just constructors
Fixes #2
2017-09-12 15:42:07 +10:00
Sean Chalmers
9bab205678 Merge branch 'master' of gitlab.com:qfpl/applied-fp-course 2017-09-12 13:41:26 +10:00
Sean Chalmers
4401cd65c9 Added -fwarn-missing-import-lists to GHC options. Fixed resulting errors 2017-09-12 13:28:27 +10:00
Tony Morris
5666f74aa1 update copyright notice 2017-09-12 11:51:26 +10:00
Tony Morris
ad0208776e LICENSE -> LICENCE 2017-09-12 11:47:41 +10:00
Sean Chalmers
00e02a3f9d Rebuilt Conf File Read Handling
Made the error management for loading the JSON config file work as one might
expect it should. Expanded the error reporting expectations to include specific
file reading and JSON decoding errors.

The difficulties that will be had in handling the multiple either values will
motivate latter sections RE ExceptT (EitherT) transformers. However there is
nothing here that should be beyond people that do not know how transformers
work.

Added more doctests to the different moving parts to make things a bit clearer.
Added doctests to the cabal files and included a 'doctests.hs' to the tests
section.

default.nix files have been updated with the bonus dependency.
2017-09-12 11:21:27 +10:00
Sean Chalmers
ec1bb07dae Add guidance about handling requests without persistent storage.
There is no persistent storage in the application by the time we're expecting
students to write ``Response`` handling functions. So add some more guidance
that we only expect placeholder values to be used, this wasn't sufficiently
clear. Fixes #3

Updated the latter placeholder values to match the guidance offered, for
consistency.

Updated the configuration ``helloMsg`` value and some of the tests to be a bit
more sensible, even if only a little.
2017-09-11 10:29:56 +10:00
Sean Chalmers
71a5c2f275 Issue fixes.
Reworded ``Error`` blurb to direct people to try to write other functions and
see what errors are needed. Fixes #1

Changed the ``Port`` type to ``Word16`` to be more precise about what values we
allow for a port number. Add a helper function to take a ``Conf`` to the ``Int``
value that Wai requires. Fixes #4
2017-09-11 09:46:17 +10:00
Sean Chalmers
0dbad01d36 Removed some unnecessary comments/code 2017-09-06 09:35:33 +10:00
Sean Chalmers
b0f95deae9 Fixed a bug, reworded a bit, refactored a bit 2017-09-06 09:19:49 +10:00
Sean Chalmers
96a81b095a Formatting tweaks 2017-09-05 16:41:30 +10:00
Sean Chalmers
934f63497d Restructure part of the Conf.hs to provide more to do and with added guidance 2017-09-05 16:36:42 +10:00
Sean Chalmers
dc42b2091f Wording/formatting updates 2017-09-05 16:13:38 +10:00
Sean Chalmers
b69770bdbc Name changes to Applied name.
Wording and phrasing updates. Some functions changed around a bit to
be slightly less 'weird'.
2017-09-05 13:53:05 +10:00
Sean Chalmers
d59af985cb Updated layout of cabal files. Turned off some warnings for unused matches 2017-09-04 11:35:33 +10:00
Sean Chalmers
0aa03de8f1 Typo fixes, word changes to reduce the silly. 2017-09-04 11:04:52 +10:00
Sean Chalmers
58b7b7b575 Use correct content-type header.
The ContentType header text for JSON was incorrect as 'text/json',
and it has been updated to 'application/json'.
2017-09-04 10:41:45 +10:00
Sean Chalmers
942d093011 Formatting Adjustments
Just making things consistent across the various levels.
2017-09-04 10:20:31 +10:00
Sean Chalmers
05d9ce923d Updated Response Builder Functions
Changed up the Response builder functions to be consistent with
the need to pass in the ContentType when constructing the response.
2017-09-04 09:29:38 +10:00
Sean Chalmers
a16b8d5849 All projects now compile without error. Certain warnings have been suppressed at a module level. Some types have been added back in to grease the wheels of getting underway 2017-09-01 14:27:41 +10:00
Sean Chalmers
7ee4a56bbe Updated ghc-options to remove -Werror, update to match options used by original fp-course 2017-09-01 11:26:26 +10:00
Sean Chalmers
f41ee50c75 change changelog files to lowercase 2017-09-01 11:17:26 +10:00
Sean Chalmers
30df1c9252 Banishing some words.
'Simply' and 'Just' are banned from instructional documentation, imo. Often, for
the people using these exercises, things are rarely either.
2017-08-31 15:39:58 +10:00
Sean Chalmers
86fc64c3dd Add some more guidance.
Added readme files to the individual exercises to help point people in the right
direction when they get started. Probably more useful to the people that are
wanting to try this by themselves.
2017-08-31 11:31:08 +10:00