Hoogle Search
Within LTS Haskell 24.39 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
parseFormKey :: FromFormKey k => Text -> Either Text khttp-api-data Web.Internal.FormUrlEncoded Parse a key of a Form.
toForm :: ToForm a => a -> Formhttp-api-data Web.Internal.FormUrlEncoded Convert a value into Form.
toFormKey :: ToFormKey k => k -> Texthttp-api-data Web.Internal.FormUrlEncoded Render a key for a Form.
unForm :: Form -> HashMap Text [Text]http-api-data Web.Internal.FormUrlEncoded No documentation available.
urlDecodeAsForm :: FromForm a => ByteString -> Either Text ahttp-api-data Web.Internal.FormUrlEncoded This is a convenience function for decoding a application/x-www-form-urlencoded ByteString directly to a datatype that has an instance of FromForm. This is effectively fromForm <=< urlDecodeForm.
>>> urlDecodeAsForm "name=Dennis&age=22" :: Either Text Person Right (Person {name = "Dennis", age = 22})urlDecodeForm :: ByteString -> Either Text Formhttp-api-data Web.Internal.FormUrlEncoded Decode an application/x-www-form-urlencoded ByteString to a Form. Key-value pairs get decoded normally:
>>> urlDecodeForm "name=Greg&lastname=Weber" Right (fromList [("lastname","Weber"),("name","Greg")])Keys with no values get decoded to pairs with empty values.>>> urlDecodeForm "is_test" Right (fromList [("is_test","")])Empty keys are allowed:>>> urlDecodeForm "=foobar" Right (fromList [("","foobar")])The empty string gets decoded into an empty Form:>>> urlDecodeForm "" Right (fromList [])
Everything is un-escaped with unEscapeString:>>> urlDecodeForm "fullname=Andres%20L%C3%B6h" Right (fromList [("fullname","Andres L\246h")])Improperly formed strings result in an error:>>> urlDecodeForm "this=has=too=many=equals" Left "not a valid pair: this=has=too=many=equals"
urlEncodeAsForm :: ToForm a => a -> ByteStringhttp-api-data Web.Internal.FormUrlEncoded This is a convenience function for encoding a datatype that has instance of ToForm directly to a application/x-www-form-urlencoded ByteString. This is effectively urlEncodeForm . toForm. _NOTE:_ this encoding is unstable and may result in different key order (but not values). For a stable encoding see urlEncodeAsFormStable.
urlEncodeAsFormStable :: ToForm a => a -> ByteStringhttp-api-data Web.Internal.FormUrlEncoded This is a convenience function for encoding a datatype that has instance of ToForm directly to a application/x-www-form-urlencoded ByteString. This is effectively urlEncodeFormStable . toForm.
>>> urlEncodeAsFormStable Person {name = "Dennis", age = 22} "age=22&name=Dennis"urlEncodeForm :: Form -> ByteStringhttp-api-data Web.Internal.FormUrlEncoded Encode a Form to an application/x-www-form-urlencoded ByteString. _NOTE:_ this encoding is unstable and may result in different key order (but not values). For a stable encoding see urlEncodeFormStable.
urlEncodeFormStable :: Form -> ByteStringhttp-api-data Web.Internal.FormUrlEncoded Encode a Form to an application/x-www-form-urlencoded ByteString. For an unstable (but faster) encoding see urlEncodeForm. Key-value pairs get encoded to key=value and separated by &:
>>> urlEncodeFormStable [("name", "Julian"), ("lastname", "Arni")] "lastname=Arni&name=Julian"Keys with empty values get encoded to just key (without the = sign):>>> urlEncodeFormStable [("is_test", "")] "is_test"Empty keys are allowed too:>>> urlEncodeFormStable [("", "foobar")] "=foobar"However, if both key and value are empty, the key-value pair is ignored. (This prevents urlDecodeForm . urlEncodeFormStable from being a true isomorphism).>>> urlEncodeFormStable [("", "")] ""Everything is escaped with escapeURIString isUnreserved:>>> urlEncodeFormStable [("fullname", "Andres Löh")] "fullname=Andres%20L%C3%B6h"