@@ -211,7 +211,8 @@ instance IsList Form where
211211-- instance 'ToForm' Person
212212-- @
213213--
214−-- The default implementation will use 'toQueryParam' for each field's value.
214+-- The default implementation of 'toForm' is 'genericToForm'.
215+-- It only works for records and it will use 'toQueryParam' for each field's value.
215216class ToForm a where
216217 -- | Convert a value into 'Form'.
217218 toForm :: a -> Form
@@ -243,6 +244,15 @@ data Proxy3 a b c = Proxy3
243244
244245-- | A 'Generic'-based implementation of 'toForm'.
245246-- This is used as a default implementation in 'ToForm'.
247+--
248+-- Note that this only works for records (i.e. product data types with named fields):
249+--
250+-- @
251+-- data Person = Person
252+-- { name :: String
253+-- , age :: Int
254+-- } deriving ('Generic')
255+-- @
246256genericToForm :: (Generic a, GToForm (Rep a)) => a -> Form
247257genericToForm = gToForm . from
248258
@@ -296,7 +306,8 @@ instance (Selector s, ToHttpApiData c) => GToForm (M1 S s (K1 i c)) where
296306-- instance 'FromForm' Person
297307-- @
298308--
299−-- The default implementation will use 'parseQueryParam' for each field's value.
309+-- The default implementation of 'fromForm' is 'genericFromForm'.
310+-- It only works for records and it will use 'parseQueryParam' for each field's value.
300311class FromForm a where
301312 -- | Parse 'Form' into a value.
302313 fromForm :: Form -> Either Text a
@@ -329,6 +340,15 @@ toEntriesByKey = traverse parseGroup . HashMap.toList . unForm
329340
330341-- | A 'Generic'-based implementation of 'fromForm'.
331342-- This is used as a default implementation in 'FromForm'.
343+--
344+-- Note that this only works for records (i.e. product data types with named fields):
345+--
346+-- @
347+-- data Person = Person
348+-- { name :: String
349+-- , age :: Int
350+-- } deriving ('Generic')
351+-- @
332352genericFromForm :: (Generic a, GFromForm (Rep a))
333353 => Form -> Either Text a
334354genericFromForm f = to <$> gFromForm f