summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joey@kitenet.net>2013-03-10 15:43:10 -0400
committerGravatar Joey Hess <joey@kitenet.net>2013-03-10 15:43:17 -0400
commit30cf4d4df7a4fda22e997366731af910f9996c78 (patch)
treec0ffb1882ad668df3b6bb0940ceb673ab8dc3003
parentcbe2b256dbe6657dae559896ec2957fbde6595ff (diff)
simpler use of MIN_VERSION checks
-rw-r--r--Remote/WebDAV.hs10
-rw-r--r--Utility/WebApp.hs2
-rw-r--r--Utility/Yesod.hs10
3 files changed, 6 insertions, 16 deletions
diff --git a/Remote/WebDAV.hs b/Remote/WebDAV.hs
index 5714cd075..84c30774a 100644
--- a/Remote/WebDAV.hs
+++ b/Remote/WebDAV.hs
@@ -7,12 +7,6 @@
{-# LANGUAGE ScopedTypeVariables, CPP #-}
-#if defined VERSION_http_conduit
-#if ! MIN_VERSION_http_conduit(1,9,0)
-#define WITH_OLD_HTTP_CONDUIT
-#endif
-#endif
-
module Remote.WebDAV (remote, davCreds, setCredsEnv) where
import Network.Protocol.HTTP.DAV
@@ -234,7 +228,7 @@ davUrlExists :: DavUrl -> DavUser -> DavPass -> IO (Either String Bool)
davUrlExists url user pass = decode <$> catchHttp (getProps url user pass)
where
decode (Right _) = Right True
-#ifdef WITH_OLD_HTTP_CONDUIT
+#if ! MIN_VERSION_http_conduit(1,9,0)
decode (Left (Left (StatusCodeException status _)))
#else
decode (Left (Left (StatusCodeException status _ _)))
@@ -285,7 +279,7 @@ catchHttp a = (Right <$> a) `E.catches`
type EitherException = Either HttpException E.IOException
showEitherException :: EitherException -> String
-#ifdef WITH_OLD_HTTP_CONDUIT
+#if ! MIN_VERSION_http_conduit(1,9,0)
showEitherException (Left (StatusCodeException status _)) =
#else
showEitherException (Left (StatusCodeException status _ _)) =
diff --git a/Utility/WebApp.hs b/Utility/WebApp.hs
index 0623d4a48..29daacab1 100644
--- a/Utility/WebApp.hs
+++ b/Utility/WebApp.hs
@@ -59,6 +59,7 @@ runWebApp app observer = do
void $ forkIO $ runSettingsSocket webAppSettings sock app
observer =<< getSocketName sock
+webAppSettings :: Settings
webAppSettings = defaultSettings
-- disable buggy sloworis attack prevention code
{ settingsTimeout = 30 * 60
@@ -140,6 +141,7 @@ webAppSessionBackend _ = do
Right (s, _) -> case CS.initKey s of
Left e -> error $ "failed to initialize key: " ++ show e
Right key -> return $ Just $
+
Yesod.clientSessionBackend key 120
{- Generates a random sha512 string, suitable to be used for an
diff --git a/Utility/Yesod.hs b/Utility/Yesod.hs
index 93000587c..2861f279d 100644
--- a/Utility/Yesod.hs
+++ b/Utility/Yesod.hs
@@ -7,23 +7,17 @@
{-# LANGUAGE CPP #-}
-#if defined VERSION_yesod_default
-#if ! MIN_VERSION_yesod_default(1,1,0)
-#define WITH_OLD_YESOD
-#endif
-#endif
-
module Utility.Yesod where
import Yesod.Default.Util
import Language.Haskell.TH.Syntax
-#ifndef WITH_OLD_YESOD
+#if MIN_VERSION_yesod_default(1,1,0)
import Data.Default (def)
import Text.Hamlet
#endif
widgetFile :: String -> Q Exp
-#ifdef WITH_OLD_YESOD
+#if ! MIN_VERSION_yesod_default(1,1,0)
widgetFile = widgetFileNoReload
#else
widgetFile = widgetFileNoReload $ def