Skip to content
Browse files

Changes for snap 0.10

  • Loading branch information...
1 parent 33cc572 commit 4b48bca725451c534d3fdee65f501d0d15e9e413 @mightybyte mightybyte committed Dec 12, 2012
Showing with 8 additions and 10 deletions.
  1. +1 −1 snap-extras.cabal
  2. +1 −2 src/Snap/Extras.hs
  3. +6 −7 src/Snap/Extras/FlashNotice.hs
View
2 snap-extras.cabal
@@ -42,7 +42,7 @@ Library
, data-lens >= 2.0
, digestive-functors >= 0.3
, digestive-functors-snap >= 0.3
- , directory-tree >= 0.10 && < 0.11
+ , directory-tree >= 0.10 && < 0.12
, errors >= 1.3.1 && < 1.4
, filepath
, heist >= 0.10
View
3 src/Snap/Extras.hs
@@ -12,7 +12,6 @@ module Snap.Extras
) where
-------------------------------------------------------------------------------
-import Data.Lens.Common
import Snap.Snaplet
import Snap.Snaplet.Heist
import Snap.Snaplet.Session
@@ -35,7 +34,7 @@ import Paths_snap_extras
-- Currently, we don't need to keep any state and simply return ().
initExtras :: HasHeist b
=> Snaplet (Heist b)
- -> Lens b (Snaplet SessionManager)
+ -> SnapletLens b SessionManager
-> SnapletInit b ()
initExtras heistSnaplet session =
makeSnaplet
View
13 src/Snap/Extras/FlashNotice.hs
@@ -13,7 +13,6 @@ module Snap.Extras.FlashNotice
-------------------------------------------------------------------------------
import Control.Monad
import Control.Monad.Trans
-import Data.Lens.Common
import Data.Text (Text)
import qualified Data.Text as T
import Snap.Snaplet
@@ -31,32 +30,32 @@ import Text.XmlHtml
-- for examples.
initFlashNotice
:: HasHeist b
- => Lens b (Snaplet SessionManager) -> Initializer b v ()
+ => SnapletLens b SessionManager -> Initializer b v ()
initFlashNotice session = do
addSplices [("flash", flashSplice session)]
-------------------------------------------------------------------------------
-- | Display an info message on next load of a page
-flashInfo :: Lens b (Snaplet SessionManager) -> Text -> Handler b b ()
+flashInfo :: SnapletLens b SessionManager -> Text -> Handler b b ()
flashInfo session msg = withSession session $ with session $ setInSession "_info" msg
-------------------------------------------------------------------------------
-- | Display an warning message on next load of a page
-flashWarning :: Lens b (Snaplet SessionManager) -> Text -> Handler b b ()
+flashWarning :: SnapletLens b SessionManager -> Text -> Handler b b ()
flashWarning session msg = withSession session $ with session $ setInSession "_warning" msg
-------------------------------------------------------------------------------
-- | Display a success message on next load of a page
-flashSuccess :: Lens b (Snaplet SessionManager) -> Text -> Handler b b ()
+flashSuccess :: SnapletLens b SessionManager -> Text -> Handler b b ()
flashSuccess session msg = withSession session $ with session $ setInSession "_success" msg
-------------------------------------------------------------------------------
-- | Display an error message on next load of a page
-flashError :: Lens b (Snaplet SessionManager) -> Text -> Handler b b ()
+flashError :: SnapletLens b SessionManager -> Text -> Handler b b ()
flashError session msg = withSession session $ with session $ setInSession "_error" msg
@@ -65,7 +64,7 @@ flashError session msg = withSession session $ with session $ setInSession "_err
--
-- Ex: <flash type='warning'/>
-- Ex: <flash type='success'/>
-flashSplice :: Lens b (Snaplet SessionManager) -> SnapletISplice b
+flashSplice :: SnapletLens b SessionManager -> SnapletISplice b
flashSplice session = do
typ <- liftM (getAttribute "type") getParamNode
let typ' = maybe "warning" id typ

0 comments on commit 4b48bca

Please sign in to comment.
Something went wrong with that request. Please try again.