+-- |> parseWWWFormURLEncoded "aaa=bbb&ccc=ddd"
+-- > ==> [("aaa", "bbb"), ("ccc", "ddd")]
+parseWWWFormURLEncoded ∷ Ascii → [(ByteString, ByteString)]
+parseWWWFormURLEncoded src
+ -- THINKME: We could gain some performance by using attoparsec
+ -- here.
+ | src ≡ "" = []
+ | otherwise = do pairStr ← splitBy (\ c → c ≡ ';' ∨ c ≡ '&') (A.toString src)
+ let (key, value) = break (≡ '=') pairStr
+ return ( unescape key
+ , unescape $ case value of
+ ('=':val) → val
+ val → val
+ )
+ where
+ unescape ∷ String → ByteString
+ unescape = BS.pack ∘ unEscapeString ∘ map plusToSpace