@@ -74,18 +74,18 @@ import qualified Data.Text.Lazy as LT
7474-- | Exception thrown if conversion from a SQL value to a Haskell
7575-- value fails.
7676data ResultError = Incompatible { errSQLType :: String
77− , errSQLField :: Maybe String
77+ , errSQLField :: String
7878 , errHaskellType :: String
7979 , errMessage :: String }
8080 -- ^ The SQL and Haskell types are not compatible.
8181 | UnexpectedNull { errSQLType :: String
82− , errSQLField :: Maybe String
82+ , errSQLField :: String
8383 , errHaskellType :: String
8484 , errMessage :: String }
8585 -- ^ A SQL @NULL@ was encountered when the Haskell
8686 -- type did not permit it.
8787 | ConversionFailed { errSQLType :: String
88− , errSQLField :: Maybe String
88+ , errSQLField :: String
8989 , errHaskellType :: String
9090 , errMessage :: String }
9191 -- ^ The SQL value could not be parsed, or could not
@@ -231,12 +231,12 @@ ff :: BuiltinType -> String -> (B8.ByteString -> Either String a)
231231 -> Field -> Maybe B8.ByteString -> Ok a
232232ff pgType hsType parse f mstr
233233 | typeOid f /= builtin2oid pgType
234− = left (Incompatible (B8.unpack (typename f)) (fmap B8.unpack (name f)) hsType "")
234+ = left (Incompatible (B8.unpack (typename f)) (maybe "" B8.unpack (name f)) hsType "")
235235 | Nothing <- mstr
236− = left (UnexpectedNull (B8.unpack (typename f)) (fmap B8.unpack (name f)) hsType "")
236+ = left (UnexpectedNull (B8.unpack (typename f)) (maybe "" B8.unpack (name f)) hsType "")
237237 | Just str <- mstr
238238 = case parse str of
239− Left msg -> left (ConversionFailed (B8.unpack (typename f)) (fmap B8.unpack (name f)) hsType msg)
239+ Left msg -> left (ConversionFailed (B8.unpack (typename f)) (maybe "" B8.unpack (name f)) hsType msg)
240240 Right val -> return val
241241{-# INLINE ff #-}
242242
@@ -284,10 +284,10 @@ doFromField f _ _ _ = returnError UnexpectedNull f ""
284284-- exception value and returns it in a 'Left . SomeException'
285285-- constructor.
286286returnError :: forall a err . (Typeable a, Exception err)
287− => (String -> Maybe String -> String -> String -> err)
287+ => (String -> String -> String -> String -> err)
288288 -> Field -> String -> Ok a
289289returnError mkErr f = left . mkErr (B.unpack (typename f))
290− (fmap B.unpack (name f))
290+ (maybe "" B.unpack (name f))
291291 (show (typeOf (undefined :: a)))
292292
293293atto :: forall a. (Typeable a)