Cleaning up TH symbol imports.

This commit is contained in:
Kei Hibino 2013-05-09 17:46:12 +09:00
parent 791833b03a
commit dce3d7fd2a
2 changed files with 8 additions and 8 deletions

View File

@ -22,7 +22,7 @@ import Data.Char (toUpper, toLower)
import Data.Map (Map, fromList) import Data.Map (Map, fromList)
import qualified Data.Map as Map import qualified Data.Map as Map
import Data.Time (LocalTime, Day) import Data.Time (LocalTime, Day)
import Language.Haskell.TH (Q, Type) import Language.Haskell.TH (TypeQ)
import qualified Language.Haskell.TH.Name.Extra as TH import qualified Language.Haskell.TH.Name.Extra as TH
import Database.HDBC (IConnection, SqlValue) import Database.HDBC (IConnection, SqlValue)
@ -129,7 +129,7 @@ $(defineRecordAndTableDefault
[derivingShow]) [derivingShow])
mapFromSqlDefault :: Map String (Q Type) mapFromSqlDefault :: Map String TypeQ
mapFromSqlDefault = mapFromSqlDefault =
fromList [("VARCHAR", [t|String|]), fromList [("VARCHAR", [t|String|]),
("CHAR", [t|String|]), ("CHAR", [t|String|]),
@ -148,7 +148,7 @@ normalizeField = map toLower
notNull :: Columns -> Bool notNull :: Columns -> Bool
notNull = (== "N") . nulls notNull = (== "N") . nulls
getType :: Map String (Q Type) -> Columns -> (String, Q Type) getType :: Map String TypeQ -> Columns -> (String, TypeQ)
getType mapFromSql rec = getType mapFromSql rec =
(normalizeField $ colname rec, (normalizeField $ colname rec,
mayNull $ mapFromSql Map.! typename rec) mayNull $ mapFromSql Map.! typename rec)
@ -217,7 +217,7 @@ getFields' :: IConnection conn
-> conn -> conn
-> String -> String
-> String -> String
-> IO ([(String, Q Type)], [Int]) -> IO ([(String, TypeQ)], [Int])
getFields' tmap conn scm' tbl' = do getFields' tmap conn scm' tbl' = do
let tbl = map toUpper tbl' let tbl = map toUpper tbl'
scm = map toUpper scm' scm = map toUpper scm'

View File

@ -13,7 +13,7 @@ module Database.HDBC.Schema.PostgreSQL (
driverPostgreSQL driverPostgreSQL
) where ) where
import Language.Haskell.TH (Q, Type) import Language.Haskell.TH (TypeQ)
import qualified Language.Haskell.TH.Name.Extra as TH import qualified Language.Haskell.TH.Name.Extra as TH
import Data.Int (Int16, Int32, Int64) import Data.Int (Int16, Int32, Int64)
@ -42,7 +42,7 @@ import qualified Language.SQL.Keyword as SQL
import Database.HDBC.Schema.Driver import Database.HDBC.Schema.Driver
(TypeMap, Driver, getFieldsWithMap, getPrimaryKey, emptyDriver) (TypeMap, Driver, getFieldsWithMap, getPrimaryKey, emptyDriver)
mapFromSqlDefault :: Map String (Q Type) mapFromSqlDefault :: Map String TypeQ
mapFromSqlDefault = mapFromSqlDefault =
fromList [("bool", [t| Bool |]), fromList [("bool", [t| Bool |]),
("char", [t| String |]), ("char", [t| String |]),
@ -82,7 +82,7 @@ type Column = (PgAttribute, PgType)
notNull :: Column -> Bool notNull :: Column -> Bool
notNull = Attr.attnotnull . fst notNull = Attr.attnotnull . fst
getType :: Map String (Q Type) -> Column -> (String, Q Type) getType :: Map String TypeQ -> Column -> (String, TypeQ)
getType mapFromSql column@(pgAttr, pgType) = getType mapFromSql column@(pgAttr, pgType) =
(normalizeField $ Attr.attname pgAttr, (normalizeField $ Attr.attname pgAttr,
mayNull $ mapFromSql ! Type.typname pgType) mayNull $ mapFromSql ! Type.typname pgType)
@ -186,7 +186,7 @@ getFields' :: IConnection conn
-> conn -> conn
-> String -> String
-> String -> String
-> IO ([(String, Q Type)], [Int]) -> IO ([(String, TypeQ)], [Int])
getFields' tmap conn scm' tbl' = do getFields' tmap conn scm' tbl' = do
let scm = map toLower scm' let scm = map toLower scm'
tbl = map toLower tbl' tbl = map toLower tbl'