Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Snap 0.10 changes. #5

Merged
merged 2 commits into from

2 participants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 10 deletions.
  1. +6 −8 examples/Site.hs
  2. +2 −2 snaplet-acid-state.cabal
View
14 examples/Site.hs
@@ -10,10 +10,9 @@ module Main where
-- explicit imports
------------------------------------------------------------------------------
-import Prelude hiding ((.), id)
-import Control.Category ((.))
import Control.Monad.Reader (asks)
import Data.ByteString (ByteString)
+import Control.Lens (makeLenses, view, over)
import Data.SafeCopy (base, deriveSafeCopy)
import qualified Data.Text as T
import Data.Typeable (Typeable)
@@ -21,8 +20,7 @@ import Snap.Util.FileServe (serveDirectory)
import Snap (SnapletInit, Snaplet, Handler,
addRoutes, nestSnaplet, serveSnaplet,
defaultConfig, makeSnaplet,
- snapletValue, writeText,
- makeLens, getL, modL, modify)
+ snapletValue, writeText, modify)
import Snap.Snaplet.AcidState (Update, Query, Acid,
HasAcid (getAcidStore), makeAcidic, update, query, acidInit)
@@ -35,12 +33,12 @@ data PersistentState = PersistentState
{ _psCounter :: Int
} deriving (Show,Ord,Eq,Typeable)
-makeLens ''PersistentState
+makeLenses ''PersistentState
deriveSafeCopy 0 'base ''PersistentState
incCounter :: Update PersistentState ()
-incCounter = modify (modL psCounter (+1))
+incCounter = modify (over psCounter (+1))
myQuery :: Query PersistentState Int
myQuery = asks _psCounter
@@ -58,14 +56,14 @@ data App = App
type AppHandler = Handler App App
-makeLens ''App
+makeLenses ''App
------------------------------------------------------------------------------
-- | This instance is optional. It just allows you to avoid putting the call
-- "with acid" in front of your calls to query and update.
instance HasAcid App PersistentState where
- getAcidStore = getL (snapletValue . acid)
+ getAcidStore = view (acid.snapletValue)
------------------------------------------------------------------------------
View
4 snaplet-acid-state.cabal
@@ -1,5 +1,5 @@
name: snaplet-acid-state
-version: 0.2.2
+version: 0.2.3
synopsis: acid-state snaplet for Snap Framework
description: This snaplet makes it easy to use acid-state in a Snap
application.
@@ -27,7 +27,7 @@ Library
build-depends:
acid-state >= 0.6 && < 0.9,
base >= 4 && < 5,
- snap >= 0.6 && < 0.10,
+ snap >= 0.6 && < 0.11,
text >= 0.11 && < 0.12
ghc-options: -Wall -fwarn-tabs -funbox-strict-fields
Something went wrong with that request. Please try again.