Use applicative.

This commit is contained in:
Kei Hibino 2015-11-10 18:22:59 +09:00
parent f01f710ac7
commit b291f48a11
3 changed files with 6 additions and 6 deletions

View File

@ -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

View File

@ -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

View File

@ -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