Я изо всех сил пытаюсь поймать ошибки postgressq в своих обработчиках. Ниже приведен упрощенный пример.
import qualified Control.Monad.CatchIO as CI (try,MonadCatchIO)
import qualified Snap.Snaplet.PostgresqlSimple as D
logConfirmMessages' :: ConfirmLog -> Handler App (AuthManager App) ()
logConfirmMessages' ms = do
let (s,i,d) = ms
let log = T.unpack s ++ "," ++ T.unpack i ++ "," ++ show d ++ ","
result <- liftIO $
CI.try $
(D.execute "update cr_trades set status=? where email=? and trade_dt=?" ms)
:: Handler App (AuthManager App) (Either D.SqlError Int64)
case result of
Left e -> logTNmsg $ log ++ show e
Right r -> logTNmsg $ log ++ show r
Ошибка, которую я получаю:
* No instance for (D.HasPostgres IO)
arising from a use of `D.execute'
* In the second argument of `($)', namely
`(D.execute
"update cr_trades set status=? where email=? and trade_dt=?" ms)'
In the second argument of `($)', namely
`CI.try
$ (D.execute
"update cr_trades set status=? where email=? and trade_dt=?" ms)'
In a stmt of a 'do' block:
result <- liftIO
$ CI.try
$ (D.execute
"update cr_trades set status=? where email=? and trade_dt=?" ms) ::
Handler App (AuthManager App) (Either D.SqlError Int64)
Любые указатели? Заранее спасибо.