From f9a5154922039d3c219df54a984277d6e4e7ef31 Mon Sep 17 00:00:00 2001 From: Gregory Collins Date: Mon, 9 Jan 2012 04:24:09 +0800 Subject: [PATCH] Fix debug code, which bitrotted somehow (?) --- src/Snap/Internal/Debug.hs | 51 ++++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 24 deletions(-) diff --git a/src/Snap/Internal/Debug.hs b/src/Snap/Internal/Debug.hs index 2f1edb3d..c61a0c3b 100644 --- a/src/Snap/Internal/Debug.hs +++ b/src/Snap/Internal/Debug.hs @@ -16,20 +16,21 @@ module Snap.Internal.Debug where ------------------------------------------------------------------------------ -import Control.Monad.Trans +import Control.Monad.Trans #ifndef NODEBUG -import Control.Concurrent -import Control.DeepSeq -import Control.Exception -import Data.Char -import Data.List -import Data.Maybe -import Foreign.C.Error -import System.Environment -import System.IO -import System.IO.Unsafe -import Text.Printf +import Control.Concurrent +import Control.DeepSeq +import Data.Either +import Control.Exception +import Data.Char +import Data.List +import Data.Maybe +import Foreign.C.Error +import System.Environment +import System.IO +import System.IO.Unsafe +import Text.Printf #endif ------------------------------------------------------------------------------ @@ -43,12 +44,13 @@ debug = let !x = unsafePerformIO $! do !e <- try $ getEnv "DEBUG" !f <- either (\(_::SomeException) -> return debugIgnore) - (\y -> if y == "1" || y == "on" - then return debugOn - else if y == "testsuite" - then return debugSeq - else return debugIgnore) - (fmap (map toLower) e) + (\y0 -> let y = map toLower y0 + in if y == "1" || y == "on" + then return debugOn + else if y == "testsuite" + then return debugSeq + else return debugIgnore) + e return $! f in x @@ -58,12 +60,13 @@ debugErrno = let !x = unsafePerformIO $ do e <- try $ getEnv "DEBUG" !f <- either (\(_::SomeException) -> return debugErrnoIgnore) - (\y -> if y == "1" || y == "on" - then return debugErrnoOn - else if y == "testsuite" - then return debugErrnoSeq - else return debugErrnoIgnore) - (fmap (map toLower) e) + (\y0 -> let y = map toLower y0 + in if y == "1" || y == "on" + then return debugErrnoOn + else if y == "testsuite" + then return debugErrnoSeq + else return debugErrnoIgnore) + e return $! f in x