+make_https :: URL -> URL
+make_https url =
+ case parse_result of
+ Nothing -> url -- Shrug?
+ Just uri ->
+ if http uri then
+ show $ uri { uriScheme = "https:" }
+ else
+ url -- Leave non-http URLs alone.
+ where
+ parse_result = parseURIReference url
+
+
+
+add_trailing_slash :: URL -> URL
+add_trailing_slash url =
+ case parse_result of
+ Nothing -> url -- Shrug?
+ Just uri ->
+ let old_path = uriPath uri in
+ if isSuffixOf "/" old_path then
+ url -- It already had a trailing slash
+ else
+ show $ uri { uriPath = old_path ++ "/" }
+ where
+ parse_result = parseURIReference url
+
+