decodeQuery :: String -> String
decodeQuery s = case s of
  "" -> ""
  '%' : h1 : h2 : r -> case readHex [h1, h2] of
      (i, "") : _ -> [decodePlus $ chr i]
      _ -> ['%', h1, h2]
    ++ decodeQuery r
  c : r -> decodePlus c : decodeQuery r
decodeQuery :: String -> String
decodeQuery s = case s of
  "" -> ""
  '%' : h1 : h2 : r -> case readHex [h1, h2] of
      (i, "") : _ -> [decodePlus $ chr i]
      _ -> ['%', h1, h2]
    ++ decodeQuery r
  c : r -> decodePlus c : decodeQuery r
decodeQuery s = case s of
  "" -> ""
  '%' : h1 : h2 : r -> case readHex [h1, h2] of
      (i, "") : _ -> [decodePlus $ chr i]
      _ -> ['%', h1, h2]
    ++ decodeQuery r
  c : r -> decodePlus c : decodeQuery r