Browse files

Fixed warnings/updated for newer happstack.

  • Loading branch information...
1 parent 67b51de commit c82f68c95618dd70ecd47963912da676c220ca0c John MacFarlane committed Nov 1, 2012
Showing with 10 additions and 8 deletions.
  1. +4 −3 Network/Gitit/Config.hs
  2. +3 −2 Network/Gitit/Util.hs
  3. +3 −3 gitit.hs
View
7 Network/Gitit/Config.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE CPP, FlexibleContexts #-}
+{-# LANGUAGE CPP, FlexibleContexts, ScopedTypeVariables #-}
{-
Copyright (C) 2009 John MacFarlane <jgm@berkeley.edu>
@@ -39,6 +39,7 @@ import Data.Char (toLower, toUpper, isDigit)
import Paths_gitit (getDataFileName)
import System.FilePath ((</>))
import Text.Pandoc hiding (MathML, WebTeX, MathJax)
+import qualified Control.Exception as E
forceEither :: Show e => Either e a -> a
forceEither = either (error . show) id
@@ -249,12 +250,12 @@ getDefaultConfig = getDefaultConfigParser >>= extractConfig
-- mime type, followed by space, followed by a list of zero or more
-- extensions, separated by spaces. Example: text/plain txt text
readMimeTypesFile :: FilePath -> IO (M.Map String String)
-readMimeTypesFile f = catch
+readMimeTypesFile f = E.catch
(liftM (foldr go M.empty . map words . lines) $ readFileUTF8 f)
handleMimeTypesFileNotFound
where go [] m = m -- skip blank lines
go (x:xs) m = foldr (\ext -> M.insert ext x) m xs
- handleMimeTypesFileNotFound e = do
+ handleMimeTypesFileNotFound (e :: E.SomeException) = do
logM "gitit" WARNING $ "Could not read mime types file: " ++
f ++ "\n" ++ show e ++ "\n" ++ "Using defaults instead."
return mimeTypes
View
5 Network/Gitit/Util.hs
@@ -1,4 +1,4 @@
-{-# LANGUAGE CPP #-}
+{-# LANGUAGE CPP, ScopedTypeVariables #-}
{-
Copyright (C) 2009 John MacFarlane <jgm@berkeley.edu>
This program is free software; you can redistribute it and/or modify
@@ -36,6 +36,7 @@ import Data.Char (toLower)
import Data.ByteString.Lazy.UTF8 (toString)
import qualified Data.ByteString.Lazy as B
import Network.Gitit.Types
+import qualified Control.Exception as E
import Control.Monad (liftM)
#if MIN_VERSION_base(4,5,0)
#else
@@ -72,7 +73,7 @@ createTempDir :: Integer -> FilePath -> IO FilePath
createTempDir num baseName = do
sysTempDir <- getTemporaryDirectory
let dirName = sysTempDir </> baseName <.> show num
- liftIO $ catch (createDirectory dirName >> return dirName) $
+ liftIO $ E.catch (createDirectory dirName >> return dirName) $
\e -> if isAlreadyExistsError e
then createTempDir (num + 1) baseName
else ioError e
View
6 gitit.hs
@@ -35,7 +35,7 @@ import System.Console.GetOpt
import Network.Socket hiding (Debug)
import Network.URI
import Data.Version (showVersion)
-import qualified Data.ByteString as B
+import qualified Data.ByteString.Char8 as B
import Data.ByteString.UTF8 (fromString)
import Paths_gitit (version, getDataFileName)
@@ -76,8 +76,8 @@ main = do
-- initialize state
initializeGititState conf'
- let serverConf = Conf { validator = Nothing, port = portNumber conf',
- timeout = 20, logAccess = Nothing }
+ let serverConf = nullConf { validator = Nothing, port = portNumber conf',
+ timeout = 20, logAccess = Nothing }
-- open the requested interface
sock <- socket AF_INET Stream defaultProtocol

0 comments on commit c82f68c

Please sign in to comment.