@@ -32,6 +32,7 @@ module Database.PostgreSQL.Simple.Types
3232import Blaze.ByteString.Builder (toByteString)
3333import Control.Arrow (first)
3434import Data.ByteString (ByteString)
35+import Data.Hashable (Hashable(hashWithSalt))
3536import Data.Monoid (Monoid(..))
3637import Data.String (IsString(..))
3738import Data.Typeable (Typeable)
@@ -127,11 +128,17 @@ newtype Identifier = Identifier {fromIdentifier :: ByteString}
127128instance IsString Identifier where
128129 fromString = Identifier . toByteString . Utf8.fromString
129130
131+instance Hashable Identifier where
132+ hashWithSalt i (Identifier t) = hashWithSalt i t
133+
130134-- | Wrap text for use as (maybe) qualified identifier, i.e. a table
131135-- with schema, or column with table.
132136data QualifiedIdentifier = QualifiedIdentifier (Maybe ByteString) ByteString
133137 deriving (Eq, Ord, Read, Show, Typeable)
134138
139+instance Hashable QualifiedIdentifier where
140+ hashWithSalt i (QualifiedIdentifier q t) = hashWithSalt i (q, t)
141+
135142-- | Wrap a list for use as a PostgreSQL array.
136143newtype PGArray a = PGArray {fromPGArray :: [a]}
137144 deriving (Eq, Ord, Read, Show, Typeable, Functor)