Hoogle Search
Within LTS Haskell 24.38 (ghc-9.10.3)
Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.
fromForm :: FromForm a => Form -> Either Text ahttp-api-data Web.Internal.FormUrlEncoded Parse Form into a value.
gFromForm :: GFromForm t f => Proxy t -> FormOptions -> Form -> Either Text (f x)http-api-data Web.Internal.FormUrlEncoded No documentation available.
gToForm :: GToForm t f => Proxy t -> FormOptions -> f x -> Formhttp-api-data Web.Internal.FormUrlEncoded No documentation available.
genericFromForm :: (Generic a, GFromForm a (Rep a)) => FormOptions -> Form -> Either Text ahttp-api-data Web.Internal.FormUrlEncoded A Generic-based implementation of fromForm. This is used as a default implementation in FromForm. Note that this only works for records (i.e. product data types with named fields):
data Person = Person { name :: String , age :: Int } deriving (Generic)In this implementation each field's value gets decoded using parseQueryParam. Two field types are exceptions:- for values of type Maybe a an entry is parsed if present in the Form and the is decoded with parseQueryParam; if no entry is present result is Nothing;
- for values of type [a] (except [Char]) all entries are parsed to produce a list of parsed values;
data Post = Post { title :: String , subtitle :: Maybe String , comments :: [String] } deriving (Generic, Show) instance FromForm Post>>> urlDecodeAsForm "comments=Nice%20post%21&comments=%2B1&title=Test" :: Either Text Post Right (Post {title = "Test", subtitle = Nothing, comments = ["Nice post!","+1"]})genericToForm :: (Generic a, GToForm a (Rep a)) => FormOptions -> a -> Formhttp-api-data Web.Internal.FormUrlEncoded A Generic-based implementation of toForm. This is used as a default implementation in ToForm. Note that this only works for records (i.e. product data types with named fields):
data Person = Person { name :: String , age :: Int } deriving (Generic)In this implementation each field's value gets encoded using toQueryParam. Two field types are exceptions:- for values of type Maybe a an entry is added to the Form only when it is Just x and the encoded value is toQueryParam x; Nothing values are omitted from the Form;
- for values of type [a] (except [Char]) an entry is added for every item in the list; if the list is empty no entries are added to the Form;
data Post = Post { title :: String , subtitle :: Maybe String , comments :: [String] } deriving (Generic, Show) instance ToForm Post>>> urlEncodeAsFormStable Post { title = "Test", subtitle = Nothing, comments = ["Nice post!", "+1"] } "comments=Nice%20post%21&comments=%2B1&title=Test"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})