implemented Helpers.incParamBy

This commit is contained in:
2021-09-22 19:01:10 -04:00
parent 515109f45d
commit 06b768ce15
2 changed files with 36 additions and 0 deletions

View File

@@ -29,6 +29,7 @@ module Helpers (
editHost,
dropParam,
editParam,
incParamBy,
incStrBy
) where
@@ -119,6 +120,17 @@ editParam pName f url = do
) $ params url
Just url { params = params' }
-- | Increment a parameter of a 'Url' by a given amount (if possible)
incParamBy
:: Integer
-- ^ the amount to increment by
-> String
-- ^ the parameter
-> Url
-- ^ the 'Url' to edit
-> Maybe Url
incParamBy n p = editParam p $ incStrBy n
-- | Increment a 'String' representation of an 'Integer' by a given
-- amount (if possible)
incStrBy