Update to persistent 2.0

Enable catching Scotty exceptions inside 'SqlPersistA' by updating to
persistent 2.0, making 'SqlPersistA' an instance of 'MonadError'.
Without 'SqlPersistA' being an instance of 'MonadError', any Scotty
exception raised within a lifted 'ActionE' has to be handled in the same
'ActionE', as it will not propagate to the 'SqlPersistA'.

Remove 'NoLoggingT' from the 'SqlPersistA' stack and instead use it with
'withPostgresqlPool' and 'withSqlitePool', as that's where persistent
now requires a 'MonadLogger' instance. Remove the 'MonadThrow' instance
for 'ActionE' as it's no longer required by persistent.

Use the FlexibleContexts extension for the new type signature of
'jsonKey'. Remove FlexibleInstances, which was needed for the
'MonadThrow' instance.

Signed-off-by: Stian Ellingsen    <stian@plaimi.net>
Reviewed-by:   Alexander Berntsen <alexander@plaimi.net>
Signed-off-by: Alexander Berntsen <alexander@plaimi.net>
Integrate custom errors with parametre parsing

Add 'errMissingParam' for parametres that are missing from a request.

Implement 'paramE' as a replacement for 'param', raising
'errInvalidParam' and 'errMissingParam' as necessary.

Add 'rescueMissing', which wraps the value of an 'ActionE' in a 'Maybe',
returning 'Nothing' if 'errMissingParam' was raised. Rewrite
'maybeParam' in terms of 'rescueMissing'.

Signed-off-by: Stian Ellingsen    <stian@plaimi.net>
Reviewed-by:   Alexander Berntsen <alexander@plaimi.net>
Signed-off-by: Alexander Berntsen <alexander@plaimi.net>
Deduplicate database lookup for clock parametre

Add 'clockParam', which looks up a given parametre and then does a
database query for a clock matching the parametre value. Replace the
clock lookup code in 'timespans' and 'postTimespan' with this function.

Require plailude >=0.3.0 for 'erretreat', which facilitates using
'rescueMissing' on 'clockParam'.

Signed-off-by: Stian Ellingsen    <stian@plaimi.net>
Reviewed-by:   Alexander Berntsen <alexander@plaimi.net>
Signed-off-by: Alexander Berntsen <alexander@plaimi.net>