@@ -60,7 +60,7 @@ import Network.IP.Addr
6060import Text.Read (readMaybe)
6161
6262import qualified Data.ByteString.Lazy as Lazy
63−import qualified Data.ByteString as Strict hiding (unpack)
63+import qualified Data.ByteString as Strict hiding (pack, unpack)
6464import qualified Data.Text.Lazy as Lazy
6565import qualified Data.Text as Strict
6666import qualified Data.Vector as Vector
@@ -123,7 +123,16 @@ instance (HasOid pg, ToParam x pg)
123123 => ToParam (Vector (Maybe x)) ('PGvararray pg) where
124124 toParam = K . Encoding.nullableArray_vector
125125 (oid @pg) (unK . toParam @x @pg)
126−
126+instance
127+ ( IsEnumType x
128+ , Show x
129+ -- , SameLabels (DatatypeInfoOf y) labels
130+ --
131+ -- uncomment above constraint when GHC issue #11671 is fixed
132+ -- Allow labels starting with uppercase with OverloadedLabels
133+ -- https://ghc.haskell.org/trac/ghc/ticket/11671?cversion=0&cnum_hist=8
134+ ) => ToParam x ('PGenum labels) where
135+ toParam = K . Encoding.text_strict . Strict.pack . show
127136-- | A `ToColumnParam` constraint lifts the `ToParam` encoding
128137-- of a `Type` to a `ColumnType`, encoding `Maybe`s to `Null`s. You should
129138-- not define instances of `ToColumnParam`, just use the provided instances.