Skip to content

Commit

Permalink
Update example instances (fixes issue #23)
Browse files Browse the repository at this point in the history
  • Loading branch information
mightybyte committed Dec 3, 2014
1 parent 03547ef commit 6524235
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
3 changes: 2 additions & 1 deletion example/Site.hs
Expand Up @@ -8,7 +8,7 @@ module Main where
------------------------------------------------------------------------------
import Control.Applicative
import Control.Monad.Trans
import Control.Monad.Trans.Reader
import Control.Monad.Reader
import Control.Monad.State
import Data.ByteString (ByteString)
import Control.Lens
Expand Down Expand Up @@ -40,6 +40,7 @@ makeLenses ''App

instance HasPostgres (Handler b App) where
getPostgresState = with db get
setLocalPostgresState s = local (set (db . snapletValue) s)

------------------------------------------------------------------------------
-- | The application's routes.
Expand Down
1 change: 1 addition & 0 deletions src/Snap/Snaplet/PostgresqlSimple.hs
Expand Up @@ -39,6 +39,7 @@ Optionally, if you find yourself doing many database queries, you can eliminate
> instance HasPostgres (Handler b App) where
> getPostgresState = with db get
> setLocalPostgresState s = local (set (db . snapletValue) s)
With this code, our postHandler example no longer requires the 'with' function:
Expand Down

0 comments on commit 6524235

Please sign in to comment.