git.iko.soy/typeable/postgresql-simple
on master help sign in
Optimize `toJSONField` to use `ToJSON.toEncoding`
da248e5cydparser
src/Database/PostgreSQL/Simple/ToField.hs+2−3
@@ -318,14 +318,13 @@ instance ToField UUID where
318instance ToField JSON.Value where
318instance ToField JSON.Value where
319 toField = toField . JSON.encode
319 toField = toField . JSON.encode
320
320
321−-- | Convert a Haskell value to a JSON 'JSON.Value' using
321+-- | Convert a Haskell value to JSON using 'JSON.toEncoding'.
322−-- 'JSON.toJSON' and convert that to a field using 'toField'.
323--
322--
324-- This can be used as the default implementation for the 'toField'
323-- This can be used as the default implementation for the 'toField'
325-- method for Haskell types that have a JSON representation in
324-- method for Haskell types that have a JSON representation in
326-- PostgreSQL.
325-- PostgreSQL.
327toJSONField :: JSON.ToJSON a => a -> Action
326toJSONField :: JSON.ToJSON a => a -> Action
328−toJSONField = toField . JSON.toJSON
327+toJSONField = toField . JSON.encode
329
328
330-- | Surround a string with single-quote characters: \"@'@\"
329-- | Surround a string with single-quote characters: \"@'@\"
331--
330--