Permalink
Browse files

Hlint clean up

  • Loading branch information...
1 parent 671cf85 commit bec58cff3503819cca42fcc04a88ac30976ac487 @nurpax committed Feb 23, 2013
Showing with 9 additions and 8 deletions.
  1. +2 −0 .gitignore
  2. +2 −2 src/Snap/Snaplet/Auth/Backends/SqliteSimple.hs
  3. +5 −6 src/Snap/Snaplet/SqliteSimple.hs
View
@@ -8,3 +8,5 @@ example/snaplets/sqlite-auth/
example/snaplets/sqlite-simple/
test/.hpc
non-cabal-appdir/
+TAGS
+site_key.txt
@@ -85,7 +85,7 @@ initSqliteAuth sess db = makeSnaplet "sqlite-auth" desc datadir $ do
sqliteConn $ db ^# snapletValue
liftIO $ createTableIfMissing manager
rng <- liftIO mkRNG
- return $ AuthManager
+ return AuthManager
{ backend = manager
, session = sess
, activeUser = Nothing
@@ -169,7 +169,7 @@ upgradeSchema conn pam fromVersion = do
------------------------------------------------------------------------------
-- | Create the user table if it doesn't exist.
createTableIfMissing :: SqliteAuthManager -> IO ()
-createTableIfMissing SqliteAuthManager{..} = do
+createTableIfMissing SqliteAuthManager{..} =
withMVar pamConnPool $ \conn -> do
authTblExists <- tableExists conn $ tblName pamTable
unless authTblExists $ createInitialSchema conn pamTable
@@ -161,12 +161,11 @@ logErr err m = do
sqliteInit :: SnapletInit b Sqlite
sqliteInit = makeSnaplet "sqlite-simple" description datadir $ do
config <- getSnapletUserConfig
- (mci,errs) <- runWriterT $ do
- db <- logErr "Must specify db filename" $ C.lookup config "db"
- return $ db
+ (mci,errs) <- runWriterT $
+ logErr "Must specify db filename" $ C.lookup config "db"
let ci = fromMaybe (error $ intercalate "\n" errs) mci
tracing <- liftIO $ C.lookupDefault False config "enableSqlTracing"
- conn <- liftIO $ (S.open ci >>= setTracing tracing >>= newMVar)
+ conn <- liftIO (S.open ci >>= setTracing tracing >>= newMVar)
return $ Sqlite conn
where
description = "Sqlite abstraction"
@@ -207,7 +206,7 @@ query q params = withSqlite (\c -> S.query c q params)
--
-- See also 'withSqlite' for notes on concurrent access.
query_ :: (HasSqlite m, FromRow r) => S.Query -> m [r]
-query_ q = withSqlite (\c -> S.query_ c q)
+query_ q = withSqlite (`S.query_` q)
------------------------------------------------------------------------------
@@ -225,4 +224,4 @@ execute template qs = withSqlite (\c -> S.execute c template qs)
-- See also 'withSqlite' for notes on concurrent access.
execute_ :: (HasSqlite m, MonadCatchIO m)
=> S.Query -> m ()
-execute_ template = withSqlite (\c -> S.execute_ c template)
+execute_ template = withSqlite (`S.execute_` template)

0 comments on commit bec58cf

Please sign in to comment.