This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "snap".

The branch, master has been updated
       via  d463106f9464f8df5d30b29495c301a5f122503e (commit)
       via  77e31f5d2b41fffe0350aeb42b4df8f8aae407af (commit)
       via  fcd8bc97d196017e6e91ac4b7e84437ae085e96b (commit)
       via  1dc8880efe3affbb660f52cb97508ac057297cec (commit)
      from  766199dda8cd7704185d4ee5e96d34f822ec81ea (commit)


Summary of changes:
 snap.cabal                                     |    2 +-
 src/Snap/Extension/Heist.hs                    |   15 ++++++++++++++-
 src/Snap/Extension/Heist/{Heist.hs => Impl.hs} |    9 +++++----
 3 files changed, 20 insertions(+), 6 deletions(-)
 rename src/Snap/Extension/Heist/{Heist.hs => Impl.hs} (96%)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit d463106f9464f8df5d30b29495c301a5f122503e
Author: Mighty Byte <[email protected]>
Date:   Wed Dec 8 16:59:15 2010 -0500

    Renamed Heist.Heist to Heist.Impl.

diff --git a/snap.cabal b/snap.cabal
index 701c679..70509fb 100644
--- a/snap.cabal
+++ b/snap.cabal
@@ -45,7 +45,7 @@ Library
 
   exposed-modules:
     Snap.Extension.Heist,
-    Snap.Extension.Heist.Heist,
+    Snap.Extension.Heist.Impl,
     Snap.Extension.Server.Hint,
     Snap.Extension.Server,
     Snap.Extension,
diff --git a/src/Snap/Extension/Heist/Heist.hs 
b/src/Snap/Extension/Heist/Impl.hs
similarity index 88%
rename from src/Snap/Extension/Heist/Heist.hs
rename to src/Snap/Extension/Heist/Impl.hs
index 3aca9cf..350c138 100644
--- a/src/Snap/Extension/Heist/Heist.hs
+++ b/src/Snap/Extension/Heist/Impl.hs
@@ -6,7 +6,7 @@
 
 {-|
 
-'Snap.Extension.Heist.Heist' is an implementation of the 'MonadHeist'
+'Snap.Extension.Heist.Impl' is an implementation of the 'MonadHeist'
 interface defined in 'Snap.Extension.Heist'.
 
 As always, to use, add 'HeistState' to your application's state, along with an
@@ -14,7 +14,7 @@ instance of 'HasHeistState' for your application's state, 
making sure to
 use a 'heistInitializer' in your application's 'Initializer', and then you're
 ready to go.
 
-'Snap.Extension.Heist.Heist' is a little different to other Snap Extensions,
+'Snap.Extension.Heist.Impl' is a little different to other Snap Extensions,
 which is unfortunate as it is probably the most widely useful one. As
 explained below, 'HeistState' takes your application's monad as a type
 argument, and 'HasHeistState' is a multi-parameter type class, the additional
@@ -46,11 +46,11 @@ interfaces from any other Snap Extension.
 
 -}
 
-module Snap.Extension.Heist.Heist
+module Snap.Extension.Heist.Impl
   ( HeistState
+  , MonadHeist(..)
   , HasHeistState(..)
   , heistInitializer
-  , persistSplices
   ) where
 
 import           Control.Applicative
@@ -126,7 +126,7 @@ heistInitializer path = do
 
 ------------------------------------------------------------------------------
 instance MonadSnap m => InitializerState (HeistState m) where
-    extensionId = const "Heist/Heist"
+    extensionId = const "Heist/Impl"
     mkCleanup   = const $ return ()
     mkReload (HeistState path origTs tsMVar sts _) = do
         clearStaticTagCache $ sts
@@ -161,24 +161,3 @@ instance HasHeistState m s => MonadHeist m (ReaderT s m) 
where
 
     heistLocal f = local $ modifyHeistState $ \s ->
         s { _modifier = f . _modifier s }
-
-
-------------------------------------------------------------------------------
--- | Take your application's state and persistently add these splices to it so
--- that you don't have to re-list them in every handler.
---
--- Typical use cases are dynamically generated components that are present in
--- many of your views.
-persistSplices
-  :: (MonadSnap m, MonadIO n) 
-  => HeistState m   
-  -- ^ Heist state that you are going to embed in your application's state.
-  -> [(B.ByteString, Splice m)]   
-  -- ^ Your splices.
-  -> n ()
-persistSplices s sps = liftIO $ do
-  let mv = _tsMVar s
-  modifyMVar_ mv $ (return . bindSplices sps) 
-
-
-  
commit 77e31f5d2b41fffe0350aeb42b4df8f8aae407af
Author: Ozgun Ataman <[email protected]>
Date:   Wed Dec 8 14:53:14 2010 -0500

    * persistSplices function to permanently add some splices to HeistState

diff --git a/src/Snap/Extension/Heist/Heist.hs 
b/src/Snap/Extension/Heist/Heist.hs
index b177661..3aca9cf 100644
--- a/src/Snap/Extension/Heist/Heist.hs
+++ b/src/Snap/Extension/Heist/Heist.hs
@@ -50,6 +50,7 @@ module Snap.Extension.Heist.Heist
   ( HeistState
   , HasHeistState(..)
   , heistInitializer
+  , persistSplices
   ) where
 
 import           Control.Applicative
@@ -160,3 +161,24 @@ instance HasHeistState m s => MonadHeist m (ReaderT s m) 
where
 
     heistLocal f = local $ modifyHeistState $ \s ->
         s { _modifier = f . _modifier s }
+
+
+------------------------------------------------------------------------------
+-- | Take your application's state and persistently add these splices to it so
+-- that you don't have to re-list them in every handler.
+--
+-- Typical use cases are dynamically generated components that are present in
+-- many of your views.
+persistSplices
+  :: (MonadSnap m, MonadIO n) 
+  => HeistState m   
+  -- ^ Heist state that you are going to embed in your application's state.
+  -> [(B.ByteString, Splice m)]   
+  -- ^ Your splices.
+  -> n ()
+persistSplices s sps = liftIO $ do
+  let mv = _tsMVar s
+  modifyMVar_ mv $ (return . bindSplices sps) 
+
+
+  
commit fcd8bc97d196017e6e91ac4b7e84437ae085e96b
Author: Ozgun Ataman <[email protected]>
Date:   Wed Dec 8 02:17:52 2010 -0500

    * Snap.Extension.Heist: renderWithSplices convenience function

diff --git a/src/Snap/Extension/Heist.hs b/src/Snap/Extension/Heist.hs
index db7e8c7..9828aa9 100644
--- a/src/Snap/Extension/Heist.hs
+++ b/src/Snap/Extension/Heist.hs
@@ -18,7 +18,9 @@ always, also your application's monad.
 
 -}
 
-module Snap.Extension.Heist (MonadHeist(..)) where
+module Snap.Extension.Heist 
+  ( MonadHeist(..)
+  , renderWithSplices ) where
 
 import           Control.Applicative
 import           Data.ByteString (ByteString)
@@ -51,3 +53,14 @@ class (Monad n, MonadSnap m) => MonadHeist n m | m -> n where
     heistServeSingle :: ByteString -> m ()
     heistServeSingle t = render t
         <|> error ("Template " ++ show t ++ " not found.")
+
+
+------------------------------------------------------------------------------
+-- | Helper function for common use case: 
+-- Render a template with a given set of splices.
+renderWithSplices 
+  :: (MonadHeist n m) => [(ByteString, Splice n)]   -- ^ Splice mapping
+  -> ByteString   -- ^ Template to render
+  -> m ()
+renderWithSplices sps t = heistLocal bsps $ render t
+  where bsps = bindSplices sps
commit 1dc8880efe3affbb660f52cb97508ac057297cec
Author: Ozgun Ataman <[email protected]>
Date:   Wed Dec 8 01:18:37 2010 -0500

    * Expose Snap.Extension.Heist.Heist so initializer, etc. can be used

diff --git a/snap.cabal b/snap.cabal
index 5667ec8..701c679 100644
--- a/snap.cabal
+++ b/snap.cabal
@@ -45,6 +45,7 @@ Library
 
   exposed-modules:
     Snap.Extension.Heist,
+    Snap.Extension.Heist.Heist,
     Snap.Extension.Server.Hint,
     Snap.Extension.Server,
     Snap.Extension,
@@ -53,7 +54,6 @@ Library
     Snap.Loader.Static
 
   other-modules:
-    Snap.Extension.Heist.Heist
 
   build-depends:
     base >= 4 && < 5,
-----------------------------------------------------------------------


hooks/post-receive
-- 
snap
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap

Reply via email to