+ unescape ∷ String → ByteString
+ unescape = BS.pack ∘ unEscapeString ∘ (plusToSpace <$>)
+
+ plusToSpace ∷ Char → Char
+ plusToSpace '+' = ' '
+ plusToSpace c = c
+
+-- |>>> uriHost "http://example.com/foo/bar"
+-- "example.com"
+uriHost ∷ URI → Host
+{-# INLINE uriHost #-}
+uriHost = CI.mk ∘ cs ∘ uriRegName ∘ fromJust ∘ uriAuthority
+
+-- |>>> uriPathSegments "http://example.com/foo/bar"
+-- ["foo", "bar"]
+uriPathSegments ∷ URI → Path
+uriPathSegments uri
+ = let reqPathStr = uriPath uri
+ reqPath = [ unEscapeString x
+ | x ← splitBy (≡ '/') reqPathStr, (¬) (null x) ]
+ in
+ BS.pack <$> reqPath
+
+-- |>>> trim " ab c d "
+-- "ab c d"
+trim ∷ String → String
+trim = reverse ∘ f ∘ reverse ∘ f
+ where
+ f = dropWhile isSpace
+
+infixr 5 ⊲
+-- | (⊲) = ('<|')
+--
+-- U+22B2, NORMAL SUBGROUP OF
+(⊲) ∷ Sequence α a ⇒ a → α → α
+(⊲) = (<|)