From 7951869a07526746cd03f9fa03ed11ce360caa08 Mon Sep 17 00:00:00 2001 From: Jasper Van der Jeugt Date: Sat, 3 Dec 2011 12:57:20 +0100 Subject: Bump Snap dependency Fixes #46 --- hakyll.cabal | 4 ++-- src/Hakyll/Web/Preview/Server.hs | 30 +++++++++++++----------------- 2 files changed, 15 insertions(+), 19 deletions(-) diff --git a/hakyll.cabal b/hakyll.cabal index 2e8f1b6..5a9df80 100644 --- a/hakyll.cabal +++ b/hakyll.cabal @@ -136,8 +136,8 @@ Library If flag(previewServer) Build-depends: - snap-core >= 0.5.1 && < 0.6, - snap-server >= 0.5.1 && < 0.6 + snap-core >= 0.6 && < 0.8, + snap-server >= 0.6 && < 0.8 Cpp-Options: -DPREVIEW_SERVER Other-Modules: diff --git a/src/Hakyll/Web/Preview/Server.hs b/src/Hakyll/Web/Preview/Server.hs index 22d48ad..15a1a33 100644 --- a/src/Hakyll/Web/Preview/Server.hs +++ b/src/Hakyll/Web/Preview/Server.hs @@ -7,25 +7,21 @@ module Hakyll.Web.Preview.Server import Control.Monad.Trans (liftIO) -import Snap.Types (Snap) -import Snap.Util.FileServe ( DirectoryConfig (..), fancyDirectoryConfig - , serveDirectoryWith - ) -import Snap.Http.Server ( httpServe, setAccessLog, setErrorLog - , setPort, emptyConfig - ) +import qualified Snap.Core as Snap +import qualified Snap.Http.Server as Snap +import qualified Snap.Util.FileServe as Snap -- | Serve a given directory -- static :: FilePath -- ^ Directory to serve -> (FilePath -> IO ()) -- ^ Pre-serve hook - -> Snap () + -> Snap.Snap () static directory preServe = - serveDirectoryWith directoryConfig directory + Snap.serveDirectoryWith directoryConfig directory where - directoryConfig :: DirectoryConfig Snap - directoryConfig = fancyDirectoryConfig - { preServeHook = liftIO . preServe + directoryConfig :: Snap.DirectoryConfig Snap.Snap + directoryConfig = Snap.fancyDirectoryConfig + { Snap.preServeHook = liftIO . preServe } -- | Main method, runs a static server in the given directory @@ -35,10 +31,10 @@ staticServer :: FilePath -- ^ Directory to serve -> Int -- ^ Port to listen on -> IO () -- ^ Blocks forever staticServer directory preServe port = - httpServe config $ static directory preServe + Snap.httpServe config $ static directory preServe where -- Snap server config - config = setPort port - $ setAccessLog Nothing - $ setErrorLog Nothing - $ emptyConfig + config = Snap.setPort port + $ Snap.setAccessLog Snap.ConfigNoLog + $ Snap.setErrorLog Snap.ConfigNoLog + $ Snap.emptyConfig -- cgit v1.2.3