From 21c9e84d4efc486a857f7a25e604a7f825e71ff2 Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Thu, 15 Mar 2012 18:35:53 +0200 Subject: [PATCH] Fix logic of warning messages for widgetFile --- yesod-default/Yesod/Default/Util.hs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/yesod-default/Yesod/Default/Util.hs b/yesod-default/Yesod/Default/Util.hs index 24778224..8100c392 100644 --- a/yesod-default/Yesod/Default/Util.hs +++ b/yesod-default/Yesod/Default/Util.hs @@ -14,7 +14,7 @@ import Control.Monad.IO.Class (liftIO) import qualified Data.ByteString.Lazy as L import Data.Text (Text, pack, unpack) import Yesod.Core -- purposely using complete import so that Haddock will see addStaticContent -import Control.Monad (unless) +import Control.Monad (when, unless) import System.Directory (doesFileExist, createDirectoryIfMissing) import Language.Haskell.TH.Syntax import Text.Lucius (luciusFile, luciusFileReload) @@ -99,5 +99,5 @@ warnUnlessExists :: Bool -> String -> String -> (FilePath -> Q Exp) -> Q (Maybe warnUnlessExists shouldWarn x glob f = do let fn = globFile glob x e <- qRunIO $ doesFileExist fn - unless (shouldWarn && e) $ qRunIO $ putStrLn $ "widget file not found: " ++ fn + when (shouldWarn && not e) $ qRunIO $ putStrLn $ "widget file not found: " ++ fn if e then fmap Just $ f fn else return Nothing