git.iko.soy/typeable/http-api-data
on master help sign in
Simplify To/FromForm instances for lists
9b7a61dNickolay Kudasov
src/Web/Internal/FormUrlEncoded.hs+2−2
@@ -102,7 +102,7 @@ class ToForm a where
102 default toForm :: (Generic a, GToForm (Rep a)) => a -> Form
102 default toForm :: (Generic a, GToForm (Rep a)) => a -> Form
103 toForm = genericToForm
103 toForm = genericToForm
104
104
105−instance ToForm [(T.Text, T.Text)] where toForm = Form . M.fromList
105+instance ToForm [(T.Text, T.Text)] where toForm = fromList
106instance ToForm (M.Map T.Text T.Text) where toForm = Form
106instance ToForm (M.Map T.Text T.Text) where toForm = Form
107instance ToForm Form where toForm = id
107instance ToForm Form where toForm = id
108
108
@@ -191,7 +191,7 @@ class FromForm a where
191 fromForm = genericFromForm
191 fromForm = genericFromForm
192
192
193instance FromForm Form where fromForm = return
193instance 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
195instance FromForm (M.Map T.Text T.Text) where fromForm = return . unForm
195instance FromForm (M.Map T.Text T.Text) where fromForm = return . unForm
196
196
197-- | A 'Generic'-based implementation of 'fromForm'.
197-- | A 'Generic'-based implementation of 'fromForm'.