mirror of
https://github.com/khibino/haskell-relational-record.git
synced 2024-12-01 13:52:12 +03:00
Use applicative.
This commit is contained in:
parent
f01f710ac7
commit
b291f48a11
@ -24,7 +24,7 @@ import Language.Haskell.TH (TypeQ)
|
||||
import qualified Data.List as List
|
||||
import Data.Char (toUpper)
|
||||
import Data.Map (fromList)
|
||||
import Control.Applicative ((<|>))
|
||||
import Control.Applicative ((<$>), (<|>))
|
||||
import Control.Monad (guard)
|
||||
import Control.Monad.Trans.Class (lift)
|
||||
import Control.Monad.Trans.Maybe (MaybeT)
|
||||
@ -69,7 +69,7 @@ getPrimaryKey' conn lchan scm' tbl' = do
|
||||
let tbl = map toUpper tbl'
|
||||
scm = map toUpper scm'
|
||||
primCols <- runQuery' conn primaryKeyQuerySQL (scm, tbl)
|
||||
let primaryKeyCols = normalizeColumn `fmap` primCols
|
||||
let primaryKeyCols = normalizeColumn <$> primCols
|
||||
putLog lchan $ "getPrimaryKey: primary key = " ++ show primaryKeyCols
|
||||
|
||||
return primaryKeyCols
|
||||
|
@ -21,7 +21,7 @@ import Language.Haskell.TH (TypeQ)
|
||||
|
||||
import Data.Char (toLower)
|
||||
import Data.Map (fromList)
|
||||
import Control.Applicative ((<|>))
|
||||
import Control.Applicative ((<$>), (<|>))
|
||||
import Control.Monad (guard)
|
||||
import Control.Monad.Trans.Class (lift)
|
||||
import Control.Monad.Trans.Maybe (MaybeT)
|
||||
@ -76,7 +76,7 @@ getPrimaryKey' conn lchan scm' tbl' = do
|
||||
return []
|
||||
[keyLen] -> do
|
||||
primCols <- runQuery' conn (primaryKeyQuerySQL keyLen) (scm, tbl)
|
||||
let primaryKeyCols = normalizeColumn `fmap` primCols
|
||||
let primaryKeyCols = normalizeColumn <$> primCols
|
||||
putLog lchan $ "getPrimaryKey: primary key = " ++ show primaryKeyCols
|
||||
return primaryKeyCols
|
||||
_:_:_ -> do
|
||||
|
@ -17,7 +17,7 @@ module Database.HDBC.Schema.SQLServer (
|
||||
import qualified Database.Relational.Schema.SQLServerSyscat.Columns as Columns
|
||||
import qualified Database.Relational.Schema.SQLServerSyscat.Types as Types
|
||||
|
||||
import Control.Applicative ((<|>))
|
||||
import Control.Applicative ((<$>), (<|>))
|
||||
import Control.Monad (guard)
|
||||
import Control.Monad.Trans.Class (lift)
|
||||
import Control.Monad.Trans.Maybe (MaybeT)
|
||||
@ -59,7 +59,7 @@ getPrimaryKey' :: IConnection conn
|
||||
-> String
|
||||
-> IO [String]
|
||||
getPrimaryKey' conn lchan scm tbl = do
|
||||
prims <- catMaybes `fmap` runQuery' conn primaryKeyQuerySQL (scm,tbl)
|
||||
prims <- catMaybes <$> runQuery' conn primaryKeyQuerySQL (scm,tbl)
|
||||
let primColumns = map normalizeColumn prims
|
||||
putLog lchan $ "getPrimaryKey: keys=" ++ show primColumns
|
||||
return primColumns
|
||||
|
Loading…
Reference in New Issue
Block a user