git.iko.soy/typeable/postgresql-simple
on master help sign in
Refactor getTypeInfo to use new Char instance
commit4e1b449bbb81af328a84e4c66895c8ad62fc2a15 authorLeon P Smith <leon@melding-monads.com> dateTue 26 Mar 2013, 21:16 (14 years ago) parent0eb4438
2 files changed+2−4
src/Database/PostgreSQL/Simple/FromField.hs-boot+1 src/Database/PostgreSQL/Simple/TypeInfo.hs+1−4
src/Database/PostgreSQL/Simple/FromField.hs-boot+1
@@ -6,5 +6,6 @@ import Database.PostgreSQL.Simple.Types
66class FromField a
77
88instance FromField Oid
9+instance FromField Char
910instance FromField ByteString
1011instance FromField a => FromField (Maybe a)
src/Database/PostgreSQL/Simple/TypeInfo.hs+1−4
@@ -27,7 +27,6 @@ module Database.PostgreSQL.Simple.TypeInfo
2727 , TypeInfo(..)
2828 ) where
2929
30−import qualified Data.ByteString.Char8 as B8
3130import qualified Data.IntMap as IntMap
3231import Control.Concurrent.MVar
3332import Control.Exception (throw)
@@ -64,9 +63,7 @@ getTypeInfo' conn oid oidmap =
6463 (oidmap', typeInfo) <-
6564 case names of
6665 [] -> return $ throw (fatalError "invalid type oid")
67− [(typoid, typcategory_, typdelim_, typname, typelem_)] -> do
68− let !typcategory = B8.index typcategory_ 0
69− !typdelim = B8.index typdelim_ 0
66+ [(typoid, typcategory, typdelim, typname, typelem_)] -> do
7067 case typcategory of
7168 'A' -> do
7269 (oidmap', typelem) <- getTypeInfo' conn typelem_ oidmap