@@ -1,8 +1,6 @@
1{-# LANGUAGE CPP, BangPatterns, DoAndIfThenElse, RecordWildCards #-}
1{-# LANGUAGE CPP, BangPatterns, DoAndIfThenElse, RecordWildCards #-}
2{-# LANGUAGE DeriveDataTypeable, DeriveGeneric #-}
2{-# LANGUAGE DeriveDataTypeable, DeriveGeneric #-}
3{-# LANGUAGE GeneralizedNewtypeDeriving #-}
3{-# LANGUAGE GeneralizedNewtypeDeriving #-}
4−{-# LANGUAGE ExistentialQuantification #-}
5−{-# LANGUAGE InstanceSigs #-}
7------------------------------------------------------------------------------
5------------------------------------------------------------------------------
@@ -83,25 +81,6 @@ data Connection = Connection {
83instance Eq Connection where
81instance Eq Connection where
84 x == y = connectionHandle x == connectionHandle y
82 x == y = connectionHandle x == connectionHandle y
86−-- | Superclass for postgresql exceptions
87−data SomePostgreSqlException = forall e. Exception e => SomePostgreSqlException e
90−postgresqlExceptionToException :: Exception e => e -> SomeException
91−postgresqlExceptionToException = toException . SomePostgreSqlException
93−postgresqlExceptionFromException :: Exception e => SomeException -> Maybe e
94−postgresqlExceptionFromException x = do
95− SomePostgreSqlException a <- fromException x
98−instance Show SomePostgreSqlException where
99− showsPrec :: Int -> SomePostgreSqlException -> ShowS
100− showsPrec p (SomePostgreSqlException e) = showsPrec p e
102−instance Exception SomePostgreSqlException where
103− displayException (SomePostgreSqlException e) = displayException e
105data SqlError = SqlError {
84data SqlError = SqlError {
106 sqlState :: ByteString
85 sqlState :: ByteString
107 , sqlExecStatus :: ExecStatus
86 , sqlExecStatus :: ExecStatus
@@ -113,10 +92,7 @@ data SqlError = SqlError {
113fatalError :: ByteString -> SqlError
92fatalError :: ByteString -> SqlError
114fatalError msg = SqlError "" FatalError msg "" ""
93fatalError msg = SqlError "" FatalError msg "" ""
116−instance Exception SqlError where
95+instance Exception SqlError
117− toException = postgresqlExceptionToException
118− fromException = postgresqlExceptionFromException
121-- | Exception thrown if 'query' is used to perform an @INSERT@-like
97-- | Exception thrown if 'query' is used to perform an @INSERT@-like
122-- operation, or 'execute' is used to perform a @SELECT@-like operation.
98-- operation, or 'execute' is used to perform a @SELECT@-like operation.
@@ -125,9 +101,7 @@ data QueryError = QueryError {
125 , qeQuery :: Query
101 , qeQuery :: Query
126 } deriving (Eq, Show, Typeable)
102 } deriving (Eq, Show, Typeable)
128−instance Exception QueryError where
104+instance Exception QueryError
129− toException = postgresqlExceptionToException
130− fromException = postgresqlExceptionFromException
132-- | Exception thrown if a 'Query' could not be formatted correctly.
106-- | Exception thrown if a 'Query' could not be formatted correctly.
133-- This may occur if the number of \'@?@\' characters in the query
107-- This may occur if the number of \'@?@\' characters in the query
@@ -138,9 +112,7 @@ data FormatError = FormatError {
138 , fmtParams :: [ByteString]
112 , fmtParams :: [ByteString]
139 } deriving (Eq, Show, Typeable)
113 } deriving (Eq, Show, Typeable)
141−instance Exception FormatError where
115+instance Exception FormatError
142− toException = postgresqlExceptionToException
143− fromException = postgresqlExceptionFromException
145data ConnectInfo = ConnectInfo {
117data ConnectInfo = ConnectInfo {
146 connectHost :: String
118 connectHost :: String