+ where
+ unescape ∷ String → ByteString
+ unescape = BS.pack ∘ unEscapeString ∘ map plusToSpace
+
+ plusToSpace ∷ Char → Char
+ plusToSpace '+' = ' '
+ plusToSpace c = c
+
+-- |> splitPathInfo "http://example.com/foo/bar"
+-- > ==> ["foo", "bar"]
+splitPathInfo ∷ URI → [Text]
+splitPathInfo uri
+ = let reqPathStr = uriPath uri
+ reqPath = [unEscapeString x | x ← splitBy (≡ '/') reqPathStr, (¬) (null x)]
+ in
+ map (T.decodeUtf8 ∘ BS.pack) reqPath
+
+-- |> show3 5
+-- > ==> "005"
+show3 ∷ Integral n ⇒ n → AsciiBuilder
+{-# INLINEABLE show3 #-}
+show3 = A.unsafeFromBuilder ∘ go
+ where
+ go i | i ≥ 0 ∧ i < 10 = B.fromByteString "00" ⊕ BT.digit i
+ | i ≥ 0 ∧ i < 100 = B.fromByteString "0" ⊕ BT.integral i
+ | i ≥ 0 ∧ i < 1000 = BT.integral i
+ | otherwise = error ("show3: the integer i must satisfy 0 <= i < 1000: " ⧺ show i)