[scaffold] remove the cryptic dev/prod combinators

This commit is contained in:
Patrick Palka 2012-04-09 11:09:42 -04:00
parent 27d8f13e7f
commit 78be263e02
4 changed files with 9 additions and 11 deletions

View File

@ -33,8 +33,9 @@ makeApplication conf logger = do
app <- toWaiAppPlain foundation
return $ logWare app
where
logWare = dev logCallbackDev logCallback (logBS setLogger)
setLogger = dev id toProduction logger
(logWare, setLogger)
| development = (logCallbackDev (logBS setLogger), logger)
| production = (logCallback (logBS setLogger), logger)
makeFoundation :: AppConfig DefaultEnv Extra -> Logger -> IO ~sitearg~
makeFoundation conf setLogger = do

View File

@ -54,8 +54,9 @@ staticRoot conf = [st|#{appRoot conf}/static|]
-- user.
widgetFile :: String -> Q Exp
widgetFile = dev Yesod.Default.Util.widgetFileReload
Yesod.Default.Util.widgetFileNoReload
widgetFile
| development = Yesod.Default.Util.widgetFileReload
| production = Yesod.Default.Util.widgetFileNoReload
data Extra = Extra
{ extraCopyright :: Text

View File

@ -10,11 +10,5 @@ development =
False
#endif
dev :: a -> a -> a
dev a b = if development then a else b
production :: Bool
production = not development
prod :: a -> a -> a
prod a b = if production then a else b

View File

@ -8,7 +8,9 @@ import Settings.Development
-- | use this to create your static file serving site
staticSite :: IO Static.Static
staticSite = dev Static.staticDevel Static.static staticDir
staticSite
| development = Static.staticDevel staticDir
| production = Static.static staticDir
-- | This generates easy references to files in the static directory at compile time,
-- giving you compile-time verification that referenced files exist.