-- | Get booking settings, 'Nothing' when booking is not configured or the user does not exist.
clientGetBookingSettingsMaybe :: Username -> ClientM (Maybe BookingSettings)
clientGetBookingSettingsMaybe username =
(Just <$> clientGetBookingSettings username)
`catchError` ( \err -> case err of
FailureResponse _ response ->
if responseStatusCode response == HTTP.notFound404
then pure Nothing
else throwError err
err -> throwError err
)
I get this lint:
smos-client/src/Smos/Client.hs:(80,20)-(85,42): Suggestion: Use lambda-case
Found:
\ err
-> case err of
FailureResponse _ response
-> if responseStatusCode response == HTTP.notFound404 then
pure Nothing
else
throwError err
err -> throwError err
Perhaps:
\case
FailureResponse _ response
-> if responseStatusCode response == HTTP.notFound404 then
pure Nothing
else
throwError err
err -> throwError err
But if I apply this hint, the first occurrance of err is now no longer a bound variable.
Given this code:
I get this lint:
But if I apply this hint, the first occurrance of
err
is now no longer a bound variable.