Permalink
Browse files

Refactoring; make use of the fact that Maybe is a monad

  • Loading branch information...
1 parent 05524ed commit 03cce170da7e0f10281733d168dafd9484591b47 @norm2782 committed Nov 1, 2011
Showing with 1 addition and 3 deletions.
  1. +1 −3 src/Snap/Snaplet/Auth/Backends/Hdbc.hs
@@ -255,9 +255,7 @@ authQuery (HdbcAuthManager pool tbl _) (qry, vals) = withResource pool $
stmt <- prepare conn' qry
_ <- execute stmt vals
fetchRowMap stmt
- case res of
- Nothing -> return Nothing
- Just mp -> return $ Just $ mkUser tbl mp
+ return $ (return . mkUser tbl) =<< res
mkUser :: AuthTable -> Map String SqlValue -> AuthUser
mkUser tbl mp =

0 comments on commit 03cce17

Please sign in to comment.