Permalink
Browse files

Add getHeistState

  • Loading branch information...
mightybyte committed Nov 26, 2013
1 parent 63d454f commit f8655ec02822579d84efc345b65b7733a9903a1d
View
@@ -1,5 +1,5 @@
name: snap
-version: 0.13.0.4
+version: 0.13.1
synopsis: Top-level package for the Snap Web Framework
description:
This is the top-level package for the official Snap Framework libraries.
@@ -19,6 +19,7 @@ module Snap.Snaplet.Heist
, addTemplates
, addTemplatesAt
, Unclassed.addConfig
+ , getHeistState
, modifyHeistState
, withHeistState
@@ -123,6 +124,13 @@ addTemplatesAt h pfx p =
withTop' heistLens (Unclassed.addTemplatesAt h pfx p)
+------------------------------------------------------------------------------
+-- | More general function allowing arbitrary HeistState modification.
+getHeistState :: (HasHeist b)
+ => Handler b v (HeistState (Handler b b))
+getHeistState = Unclassed.getHeistState heistLens
+
+
------------------------------------------------------------------------------
-- | More general function allowing arbitrary HeistState modification.
modifyHeistState :: (HasHeist b)
@@ -20,6 +20,7 @@ module Snap.Snaplet.Heist.Compiled
, H.addTemplates
, H.addTemplatesAt
, H.addConfig
+ , H.getHeistState
, H.modifyHeistState
, H.withHeistState
@@ -18,6 +18,7 @@ module Snap.Snaplet.Heist.Generic
, addTemplates
, addTemplatesAt
, addConfig
+ , getHeistState
, modifyHeistState
, withHeistState
@@ -19,6 +19,7 @@ module Snap.Snaplet.Heist.Interpreted
, addTemplates
, addTemplatesAt
, addConfig
+ , getHeistState
, modifyHeistState
, withHeistState
@@ -26,6 +26,7 @@ module Snap.Snaplet.HeistNoClass
, addTemplates
, addTemplatesAt
+ , getHeistState
, modifyHeistState
, modifyHeistState'
, withHeistState
@@ -220,6 +221,12 @@ getCurHeistConfig h = case view snapletValue h of
error "Can't get HeistConfig after heist is initialized."
+------------------------------------------------------------------------------
+getHeistState :: SnapletLens (Snaplet b) (Heist b)
+ -> Handler b v (HeistState (Handler b b))
+getHeistState heist = withTop' heist $ gets _heistState
+
+
------------------------------------------------------------------------------
modifyHeistState' :: SnapletLens (Snaplet b) (Heist b)
-> (HeistState (Handler b b) -> HeistState (Handler b b))

0 comments on commit f8655ec

Please sign in to comment.