@@ -40,6 +40,7 @@ import Data.ByteString.Builder ( stringUtf8 )
4040import qualified Data.ByteString as B
4141import Data.Text (Text)
4242import qualified Data.Text as T
43+import Data.Tuple.Only (Only(..))
4344import Database.PostgreSQL.LibPQ (Oid(..))
4445import Database.PostgreSQL.Simple.Compat (toByteString)
4546
@@ -93,23 +94,6 @@ instance Monoid Query where
9394 {-# INLINE mappend #-}
9495 mconcat xs = Query (B.concat (map fromQuery xs))
9596
96−-- | A single-value \"collection\".
97−--
98−-- This is useful if you need to supply a single parameter to a SQL
99−-- query, or extract a single column from a SQL result.
100−--
101−-- Parameter example:
102−--
103−-- @query c \"select x from scores where x > ?\" ('Only' (42::Int))@
104−--
105−-- Result example:
106−--
107−-- @xs <- query_ c \"select id from users\"
108−--forM_ xs $ \\('Only' id) -> {- ... -}@
109−newtype Only a = Only {
110− fromOnly :: a
111− } deriving (Eq, Ord, Read, Show, Typeable, Functor)
112−
11397-- | Wrap a list of values for use in an @IN@ clause. Replaces a
11498-- single \"@?@\" character with a parenthesized list of rendered
11599-- values.