git.iko.soy/typeable/http-api-data
on master help sign in
Simplify To/FromForm instances for lists
commit9b7a61d07f6287d3d02a70a37bad8316779221a8 authorNickolay Kudasov <nickolay.kudasov@gmail.com> dateMon 29 Aug 2016, 16:35 (10 years ago) parent4233ec9
1 file changed+2−2
src/Web/Internal/FormUrlEncoded.hs+2−2
src/Web/Internal/FormUrlEncoded.hs+2−2
@@ -102,7 +102,7 @@ class ToForm a where
102102 default toForm :: (Generic a, GToForm (Rep a)) => a -> Form
103103 toForm = genericToForm
104104
105−instance ToForm [(T.Text, T.Text)] where toForm = Form . M.fromList
105+instance ToForm [(T.Text, T.Text)] where toForm = fromList
106106instance ToForm (M.Map T.Text T.Text) where toForm = Form
107107instance ToForm Form where toForm = id
108108
@@ -191,7 +191,7 @@ class FromForm a where
191191 fromForm = genericFromForm
192192
193193instance FromForm Form where fromForm = return
194−instance FromForm [(T.Text, T.Text)] where fromForm = return . M.toList . unForm
194+instance FromForm [(T.Text, T.Text)] where fromForm = toList
195195instance FromForm (M.Map T.Text T.Text) where fromForm = return . unForm
196196
197197-- | A 'Generic'-based implementation of 'fromForm'.