Hoogle Search

Within LTS Haskell 24.45 (ghc-9.10.3)

Note that Stackage only displays results for the latest LTS and Nightly snapshot. Learn more.

  1. class ToFormKey k

    http-api-data Web.Internal.FormUrlEncoded

    Typeclass for types that can be used as keys in a Form-like container (like Map).

  2. defaultFormOptions :: FormOptions

    http-api-data Web.Internal.FormUrlEncoded

    Default encoding FormOptions.

    FormOptions
    { fieldLabelModifier = id
    }
    

  3. fromForm :: FromForm a => Form -> Either Text a

    http-api-data Web.Internal.FormUrlEncoded

    Parse Form into a value.

  4. gFromForm :: GFromForm t f => Proxy t -> FormOptions -> Form -> Either Text (f x)

    http-api-data Web.Internal.FormUrlEncoded

    No documentation available.

  5. gToForm :: GToForm t f => Proxy t -> FormOptions -> f x -> Form

    http-api-data Web.Internal.FormUrlEncoded

    No documentation available.

  6. genericFromForm :: (Generic a, GFromForm a (Rep a)) => FormOptions -> Form -> Either Text a

    http-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;
    Here's an example:
    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"]})
    

  7. genericToForm :: (Generic a, GToForm a (Rep a)) => FormOptions -> a -> Form

    http-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;
    Here's an example:
    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"
    

  8. parseFormKey :: FromFormKey k => Text -> Either Text k

    http-api-data Web.Internal.FormUrlEncoded

    Parse a key of a Form.

  9. toForm :: ToForm a => a -> Form

    http-api-data Web.Internal.FormUrlEncoded

    Convert a value into Form.

  10. toFormKey :: ToFormKey k => k -> Text

    http-api-data Web.Internal.FormUrlEncoded

    Render a key for a Form.

Page 503 of many | Previous | Next