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 faf165c266aafed48c605eb00b22c499ab1063cc (commit)
from d463106f9464f8df5d30b29495c301a5f122503e (commit)
Summary of changes:
project_template/default/foo.cabal | 17 +++++++++----
project_template/default/src/Application.hs | 26 ++++++++++----------
project_template/default/src/Main.hs | 4 +-
.../default/src/Snap/Extension/Timer.hs | 7 +++--
.../src/Snap/Extension/Timer/{Timer.hs => Impl.hs} | 6 ++--
5 files changed, 34 insertions(+), 26 deletions(-)
rename project_template/default/src/Snap/Extension/Timer/{Timer.hs => Impl.hs}
(94%)
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 faf165c266aafed48c605eb00b22c499ab1063cc
Author: Mighty Byte <[email protected]>
Date: Thu Dec 9 10:33:39 2010 -0500
Updated the default project template to work with modificiations to
extensions.
diff --git a/project_template/default/foo.cabal
b/project_template/default/foo.cabal
index 125270f..3747996 100644
--- a/project_template/default/foo.cabal
+++ b/project_template/default/foo.cabal
@@ -14,7 +14,7 @@ Flag development
Description: Whether to build the server in development (interpreted) mode
Default: False
-Executable foo
+Executable projname
hs-source-dirs: src
main-is: Main.hs
@@ -26,13 +26,20 @@ Executable foo
MonadCatchIO-transformers >= 0.2.1 && < 0.3,
base >= 4 && < 5,
bytestring >= 0.9.1 && < 0.10,
- heist >= 0.3 && <0.4,
- mtl >= 2 && <3,
+ heist >= 0.3 && < 0.4,
+ hexpat >= 0.19 && < 0.20,
+ mtl >= 2 && < 3,
snap >= 0.3 && < 0.4,
- snap-core >= 0.3 && < 0.4
+ snap-core >= 0.3 && < 0.4,
+ text >= 0.10 && < 0.12,
+ time >= 1.1 && < 1.2
+
+ extensions: TypeSynonymInstances MultiParamTypeClasses
if impl(ghc >= 6.12.0)
ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields -O2
- -fno-warn-unused-do-bind
+ -fno-warn-orphans -fno-warn-unused-do-bind
else
ghc-options: -threaded -Wall -fwarn-tabs -funbox-strict-fields -O2
+ -fno-warn-orphans
+
diff --git a/project_template/default/src/Application.hs
b/project_template/default/src/Application.hs
index be2798a..0b927a7 100644
--- a/project_template/default/src/Application.hs
+++ b/project_template/default/src/Application.hs
@@ -7,13 +7,12 @@ information it requires.
module Application
( Application
- , applicationRunner
+ , applicationInitializer
) where
import Snap.Extension
-import Snap.Extension.Heist
-import Snap.Extension.Timer
-import Text.Templating.Heist
+import Snap.Extension.Heist.Impl
+import Snap.Extension.Timer.Impl
------------------------------------------------------------------------------
@@ -35,7 +34,7 @@ data ApplicationState = ApplicationState
------------------------------------------------------------------------------
-instance HasHeistState ApplicationState where
+instance HasHeistState Application ApplicationState where
getHeistState = templateState
setHeistState s a = a { templateState = s }
@@ -47,12 +46,13 @@ instance HasTimerState ApplicationState where
------------------------------------------------------------------------------
--- | The 'Runner' for ApplicationState. For more on 'Runner's, see the README
--- from the snap-extensions package. Briefly, this is used to generate the
--- 'ApplicationState' needed for our application and will automatically
--- generate reload\/cleanup actions for us which we don't need to worry about.
-applicationRunner :: Runner ApplicationState
-applicationRunner = do
- heist <- heistRunner "resources/templates" emptyTemplateState
- timer <- timerRunner
+-- | The 'Initializer' for ApplicationState. For more on 'Initializer's, see
+-- the documentation from the snap package. Briefly, this is used to
+-- generate the 'ApplicationState' needed for our application and will
+-- automatically generate reload\/cleanup actions for us which we don't need
+-- to worry about.
+applicationInitializer :: Initializer ApplicationState
+applicationInitializer = do
+ heist <- heistInitializer "resources/templates"
+ timer <- timerInitializer
return $ ApplicationState heist timer
diff --git a/project_template/default/src/Main.hs
b/project_template/default/src/Main.hs
index 38018d8..8d3b1f9 100644
--- a/project_template/default/src/Main.hs
+++ b/project_template/default/src/Main.hs
@@ -23,7 +23,7 @@ resources it depends on.
Second, the generated server binary is MUCH larger, since it links in the GHC
API (via the hint library).
-Third, it results in initialization\/cleanup code defined by the @Runner@
+Third, it results in initialization\/cleanup code defined by the @Initializer@
being called for each request. This is to ensure that the current state is
compatible with the running action. If your application state takes a long
time to load or clean up, the penalty will be visible.
@@ -52,4 +52,4 @@ import Application
import Site
main :: IO ()
-main = quickHttpServe applicationRunner site
+main = quickHttpServe applicationInitializer site
diff --git a/project_template/default/src/Snap/Extension/Timer.hs
b/project_template/default/src/Snap/Extension/Timer.hs
index 0c699ce..75ea4ee 100644
--- a/project_template/default/src/Snap/Extension/Timer.hs
+++ b/project_template/default/src/Snap/Extension/Timer.hs
@@ -23,8 +23,9 @@ module Snap.Extension.Timer
) where
import Control.Monad.Trans
-import qualified Data.ByteString.UTF8 as U
import Data.Time.Clock
+import qualified Data.Text as T
+import Data.Text.Encoding
import Snap.Types
import Text.Templating.Heist
import Text.XML.Expat.Tree hiding (Node)
@@ -42,7 +43,7 @@ class MonadSnap m => MonadTimer m where
startTimeSplice :: MonadTimer m => Splice m
startTimeSplice = do
time <- lift startTime
- return $ [mkText $ U.fromString $ show $ time]
+ return $ [mkText $ encodeUtf8 $ T.pack $ show $ time]
------------------------------------------------------------------------------
@@ -50,4 +51,4 @@ startTimeSplice = do
currentTimeSplice :: MonadTimer m => Splice m
currentTimeSplice = do
time <- lift $ liftIO getCurrentTime
- return $ [mkText $ U.fromString $ show $ time]
+ return $ [mkText $ encodeUtf8 $ T.pack $ show $ time]
diff --git a/project_template/default/src/Snap/Extension/Timer/Timer.hs
b/project_template/default/src/Snap/Extension/Timer/Impl.hs
similarity index 94%
rename from project_template/default/src/Snap/Extension/Timer/Timer.hs
rename to project_template/default/src/Snap/Extension/Timer/Impl.hs
index 3222a41..44e44fc 100644
--- a/project_template/default/src/Snap/Extension/Timer/Timer.hs
+++ b/project_template/default/src/Snap/Extension/Timer/Impl.hs
@@ -2,7 +2,7 @@
{-|
-'Snap.Extension.Timer.Timer' is an implementation of the 'MonadTimer'
+'Snap.Extension.Timer.Impl' is an implementation of the 'MonadTimer'
interface defined in 'Snap.Extension.Timer'.
As always, to use, add 'TimerState' to your application's state, along with an
@@ -14,14 +14,14 @@ interfaces from any other Snap Extension.
-}
-module Snap.Extension.Timer.Timer
+module Snap.Extension.Timer.Impl
( TimerState
, HasTimerState(..)
, timerInitializer
+ , module Snap.Extension.Timer
) where
import Control.Monad.Reader
-import Control.Monad.Trans
import Data.Time.Clock
import Snap.Extension
import Snap.Extension.Timer
-----------------------------------------------------------------------
hooks/post-receive
--
snap
_______________________________________________
Snap mailing list
[email protected]
http://mailman-mail5.webfaction.com/listinfo/snap