implemented Handlers.i

This commit is contained in:
2021-09-22 18:19:51 -04:00
parent 34ac2a2a00
commit 515109f45d
2 changed files with 29 additions and 1 deletions

View File

@@ -28,7 +28,8 @@ module Helpers (
makeHttps,
editHost,
dropParam,
editParam
editParam,
incStrBy
) where
import qualified Data.List as L
@@ -118,6 +119,18 @@ editParam pName f url = do
) $ params url
Just url { params = params' }
-- | Increment a 'String' representation of an 'Integer' by a given
-- amount (if possible)
incStrBy
:: Integer
-- ^ the amount to increment by
-> String
-- ^ the 'String' to increment
-> Maybe String
incStrBy n str = case reads str of
[(m, "")] -> Just $ show $ n + m
_ -> Nothing
subToUrl :: T.Text -> Maybe Url
subToUrl text = case T.splitOn "://" text of
[protT, raw] -> do