mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-12-12 12:09:08 +03:00
Cleaning up TH symbol imports.
This commit is contained in:
parent
791833b03a
commit
dce3d7fd2a
@ -22,7 +22,7 @@ import Data.Char (toUpper, toLower)
|
||||
import Data.Map (Map, fromList)
|
||||
import qualified Data.Map as Map
|
||||
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 Database.HDBC (IConnection, SqlValue)
|
||||
@ -129,7 +129,7 @@ $(defineRecordAndTableDefault
|
||||
[derivingShow])
|
||||
|
||||
|
||||
mapFromSqlDefault :: Map String (Q Type)
|
||||
mapFromSqlDefault :: Map String TypeQ
|
||||
mapFromSqlDefault =
|
||||
fromList [("VARCHAR", [t|String|]),
|
||||
("CHAR", [t|String|]),
|
||||
@ -148,7 +148,7 @@ normalizeField = map toLower
|
||||
notNull :: Columns -> Bool
|
||||
notNull = (== "N") . nulls
|
||||
|
||||
getType :: Map String (Q Type) -> Columns -> (String, Q Type)
|
||||
getType :: Map String TypeQ -> Columns -> (String, TypeQ)
|
||||
getType mapFromSql rec =
|
||||
(normalizeField $ colname rec,
|
||||
mayNull $ mapFromSql Map.! typename rec)
|
||||
@ -217,7 +217,7 @@ getFields' :: IConnection conn
|
||||
-> conn
|
||||
-> String
|
||||
-> String
|
||||
-> IO ([(String, Q Type)], [Int])
|
||||
-> IO ([(String, TypeQ)], [Int])
|
||||
getFields' tmap conn scm' tbl' = do
|
||||
let tbl = map toUpper tbl'
|
||||
scm = map toUpper scm'
|
||||
|
@ -13,7 +13,7 @@ module Database.HDBC.Schema.PostgreSQL (
|
||||
driverPostgreSQL
|
||||
) where
|
||||
|
||||
import Language.Haskell.TH (Q, Type)
|
||||
import Language.Haskell.TH (TypeQ)
|
||||
import qualified Language.Haskell.TH.Name.Extra as TH
|
||||
|
||||
import Data.Int (Int16, Int32, Int64)
|
||||
@ -42,7 +42,7 @@ import qualified Language.SQL.Keyword as SQL
|
||||
import Database.HDBC.Schema.Driver
|
||||
(TypeMap, Driver, getFieldsWithMap, getPrimaryKey, emptyDriver)
|
||||
|
||||
mapFromSqlDefault :: Map String (Q Type)
|
||||
mapFromSqlDefault :: Map String TypeQ
|
||||
mapFromSqlDefault =
|
||||
fromList [("bool", [t| Bool |]),
|
||||
("char", [t| String |]),
|
||||
@ -82,7 +82,7 @@ type Column = (PgAttribute, PgType)
|
||||
notNull :: Column -> Bool
|
||||
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) =
|
||||
(normalizeField $ Attr.attname pgAttr,
|
||||
mayNull $ mapFromSql ! Type.typname pgType)
|
||||
@ -186,7 +186,7 @@ getFields' :: IConnection conn
|
||||
-> conn
|
||||
-> String
|
||||
-> String
|
||||
-> IO ([(String, Q Type)], [Int])
|
||||
-> IO ([(String, TypeQ)], [Int])
|
||||
getFields' tmap conn scm' tbl' = do
|
||||
let scm = map toLower scm'
|
||||
tbl = map toLower tbl'
|
||||
|
Loading…
Reference in New Issue
Block a user